/**
 * CM Contact Us Block - Centralized Styles
 * Envelope design with animations
 * Four-selector pattern for FSE compatibility
 */

/* Container */
.wp-block-cm-contactus .cm-contactus-block,
.wp-site-blocks .cm-contactus-block,
.editor-styles-wrapper .wp-block-cm-contactus .cm-contactus-block,
body .cm-contactus-block {
margin-left: auto;
margin-right: auto;
float: none; 
    padding: 20px;
}

/* Company Info */
.wp-block-cm-contactus .cm-company-info,
.wp-site-blocks .cm-company-info,
.editor-styles-wrapper .wp-block-cm-contactus .cm-company-info,
body .cm-company-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.wp-block-cm-contactus .cm-company-info-left,
.wp-site-blocks .cm-company-info-left,
.editor-styles-wrapper .wp-block-cm-contactus .cm-company-info-left,
body .cm-company-info-left {
    flex: 1;
}

.wp-block-cm-contactus .cm-company-info-right,
.wp-site-blocks .cm-company-info-right,
.editor-styles-wrapper .wp-block-cm-contactus .cm-company-info-right,
body .cm-company-info-right {
    flex: 1;
    text-align: right;
}

/* Envelope Container */
.wp-block-cm-contactus .cm-envelope,
.wp-site-blocks .cm-envelope,
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope,
body .cm-envelope {
    position: relative;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    background: linear-gradient(135deg, #e8d5b7 0%, #f0e6d5 100%);
    border: 2px solid #c9b08a;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    /* Start hidden off-screen */
    opacity: 0;
    transform: translateX(-120%);
}

/* Envelope Flap */
.wp-block-cm-contactus .cm-envelope-flap,
.wp-site-blocks .cm-envelope-flap,
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope-flap,
body .cm-envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, #d4b896 0%, #e8d5b7 100%);
    border-bottom: 2px solid #c9b08a;
    clip-path: polygon(0 0, 50% 100%, 100% 0);
    z-index: 1;
}

/* Envelope Stamp */
.wp-block-cm-contactus .cm-envelope-stamp,
.wp-site-blocks .cm-envelope-stamp,
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope-stamp,
body .cm-envelope-stamp {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 91px;
    height: 100px;
    background: #fff;
    border: 2px dashed #999;
    padding: 5px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.wp-block-cm-contactus .cm-envelope-stamp img,
.wp-site-blocks .cm-envelope-stamp img,
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope-stamp img,
body .cm-envelope-stamp img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Envelope Inner (form container) */
.wp-block-cm-contactus .cm-envelope-inner,
.wp-site-blocks .cm-envelope-inner,
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope-inner,
body .cm-envelope-inner {
    padding: 100px 40px 40px;
    background: #fff;
    min-height: 500px;
}

/* Form Section */
.wp-block-cm-contactus .cm-form-section,
.wp-site-blocks .cm-form-section,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-section,
body .cm-form-section {
    width: 100%;
}

/* Form Rows */
.wp-block-cm-contactus .cm-form-row,
.wp-site-blocks .cm-form-row,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-row,
body .cm-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.wp-block-cm-contactus .cm-form-field,
.wp-site-blocks .cm-form-field,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-field,
body .cm-form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wp-block-cm-contactus .cm-form-field.cm-full-width,
.wp-site-blocks .cm-form-field.cm-full-width,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-field.cm-full-width,
body .cm-form-field.cm-full-width {
    flex: 1 1 100%;
}

/* Form Labels */
.wp-block-cm-contactus .cm-form-label,
.wp-site-blocks .cm-form-label,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-label,
body .cm-form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

/* Form Inputs */
.wp-block-cm-contactus .cm-form-input,
.wp-site-blocks .cm-form-input,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-input,
body .cm-form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.wp-block-cm-contactus .cm-form-input:focus,
.wp-site-blocks .cm-form-input:focus,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-input:focus,
body .cm-form-input:focus {
    outline: none;
    border-color: #2271b1;
}

/* Textarea */
.wp-block-cm-contactus .cm-form-textarea,
.wp-site-blocks .cm-form-textarea,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-textarea,
body .cm-form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.wp-block-cm-contactus .cm-form-textarea:focus,
.wp-site-blocks .cm-form-textarea:focus,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-textarea:focus,
body .cm-form-textarea:focus {
    outline: none;
    border-color: #2271b1;
}

/* File Upload */
.wp-block-cm-contactus .cm-file-upload,
.wp-site-blocks .cm-file-upload,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-upload,
body .cm-file-upload {
    padding: 10px;
    font-size: 14px;
}

.wp-block-cm-contactus .cm-file-list,
.wp-site-blocks .cm-file-list,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-list,
body .cm-file-list {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}

/* File Items */
.wp-block-cm-contactus .cm-file-item,
.wp-site-blocks .cm-file-item,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-item,
body .cm-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.wp-block-cm-contactus .cm-file-item.uploading,
.wp-site-blocks .cm-file-item.uploading,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-item.uploading,
body .cm-file-item.uploading {
    opacity: 0.6;
}

.wp-block-cm-contactus .cm-file-preview,
.wp-site-blocks .cm-file-preview,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-preview,
body .cm-file-preview {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.wp-block-cm-contactus .cm-file-name,
.wp-site-blocks .cm-file-name,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-name,
body .cm-file-name {
    flex: 1;
    font-size: 13px;
    color: #333;
    word-break: break-word;
}

.wp-block-cm-contactus .cm-file-remove,
.wp-site-blocks .cm-file-remove,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-remove,
body .cm-file-remove {
    width: 24px;
    height: 24px;
    padding: 0;
    background: #dc3232;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.wp-block-cm-contactus .cm-file-remove:hover,
.wp-site-blocks .cm-file-remove:hover,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-remove:hover,
body .cm-file-remove:hover {
    background: #a00;
}

.wp-block-cm-contactus .cm-file-remove:disabled,
.wp-site-blocks .cm-file-remove:disabled,
.editor-styles-wrapper .wp-block-cm-contactus .cm-file-remove:disabled,
body .cm-file-remove:disabled {
    background: #999;
    cursor: not-allowed;
}

/* Submit Button */
.wp-block-cm-contactus .cm-form-button,
.wp-site-blocks .cm-form-button,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-button,
body .cm-form-button {
    padding: 14px 40px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.wp-block-cm-contactus .cm-form-button:hover,
.wp-site-blocks .cm-form-button:hover,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-button:hover,
body .cm-form-button:hover {
    background: #135e96;
}

.wp-block-cm-contactus .cm-form-button:disabled,
.wp-site-blocks .cm-form-button:disabled,
.editor-styles-wrapper .wp-block-cm-contactus .cm-form-button:disabled,
body .cm-form-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Disclaimer */
.wp-block-cm-contactus .cm-disclaimer,
.wp-site-blocks .cm-disclaimer,
.editor-styles-wrapper .wp-block-cm-contactus .cm-disclaimer,
body .cm-disclaimer {
    margin-top: 30px;
    padding: 15px;
    background: #f0f0f0;
    border-left: 4px solid #999;
    font-size: 12px;
    line-height: 1.6;
    color: #666;
}

.wp-block-cm-contactus .cm-disclaimer a,
.wp-site-blocks .cm-disclaimer a,
.editor-styles-wrapper .wp-block-cm-contactus .cm-disclaimer a,
body .cm-disclaimer a {
    color: #2271b1;
    text-decoration: none;
}

.wp-block-cm-contactus .cm-disclaimer a:hover,
.wp-site-blocks .cm-disclaimer a:hover,
.editor-styles-wrapper .wp-block-cm-contactus .cm-disclaimer a:hover,
body .cm-disclaimer a:hover {
    text-decoration: underline;
}

/* Animations - In from any direction */
.wp-block-cm-contactus .cm-envelope.animate-in,
.wp-site-blocks .cm-envelope.animate-in,
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope.animate-in,
body .cm-envelope.animate-in {
    animation: slideIn var(--cm-contactus-animation-speed, 1s) var(--cm-contactus-animation-easing, ease-in-out) forwards;
}

/* Animations - Out to any direction */
.wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="left"],
.wp-site-blocks .cm-envelope.animate-out[data-animate-from="left"],
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="left"],
body .cm-envelope.animate-out[data-animate-from="left"] {
    animation: slideOutLeft var(--cm-contactus-animation-speed, 1s) var(--cm-contactus-animation-easing, ease-in-out) forwards;
}

.wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="right"],
.wp-site-blocks .cm-envelope.animate-out[data-animate-from="right"],
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="right"],
body .cm-envelope.animate-out[data-animate-from="right"] {
    animation: slideOutRight var(--cm-contactus-animation-speed, 1s) var(--cm-contactus-animation-easing, ease-in-out) forwards;
}

.wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="top"],
.wp-site-blocks .cm-envelope.animate-out[data-animate-from="top"],
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="top"],
body .cm-envelope.animate-out[data-animate-from="top"] {
    animation: slideOutTop var(--cm-contactus-animation-speed, 1s) var(--cm-contactus-animation-easing, ease-in-out) forwards;
}

.wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="bottom"],
.wp-site-blocks .cm-envelope.animate-out[data-animate-from="bottom"],
.editor-styles-wrapper .wp-block-cm-contactus .cm-envelope.animate-out[data-animate-from="bottom"],
body .cm-envelope.animate-out[data-animate-from="bottom"] {
    animation: slideOutBottom var(--cm-contactus-animation-speed, 1s) var(--cm-contactus-animation-easing, ease-in-out) forwards;
}

/* Animation In - to center from any direction */
@keyframes slideIn {
    to {
        transform: translate(0, 0);
        opacity: 1;
    }
}

/* Animation Out - Left */
@keyframes slideOutLeft {
    from {
        transform: translate(0, 0);
        opacity: 1;
    }
    to {
        transform: translateX(-120%);
        opacity: 0;
    }
}

/* Animation Out - Right */
@keyframes slideOutRight {
    from {
        transform: translate(0, 0);
        opacity: 1;
    }
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* Animation Out - Top */
@keyframes slideOutTop {
    from {
        transform: translate(0, 0);
        opacity: 1;
    }
    to {
        transform: translateY(-120%);
        opacity: 0;
    }
}

/* Animation Out - Bottom */
@keyframes slideOutBottom {
    from {
        transform: translate(0, 0);
        opacity: 1;
    }
    to {
        transform: translateY(120%);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .wp-block-cm-contactus .cm-form-row,
    .wp-site-blocks .cm-form-row,
    .editor-styles-wrapper .wp-block-cm-contactus .cm-form-row,
    body .cm-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .wp-block-cm-contactus .cm-company-info,
    .wp-site-blocks .cm-company-info,
    .editor-styles-wrapper .wp-block-cm-contactus .cm-company-info,
    body .cm-company-info {
        flex-direction: column;
        gap: 20px;
    }

    .wp-block-cm-contactus .cm-company-info-right,
    .wp-site-blocks .cm-company-info-right,
    .editor-styles-wrapper .wp-block-cm-contactus .cm-company-info-right,
    body .cm-company-info-right {
        text-align: left;
    }

    .wp-block-cm-contactus .cm-envelope-inner,
    .wp-site-blocks .cm-envelope-inner,
    .editor-styles-wrapper .wp-block-cm-contactus .cm-envelope-inner,
    body .cm-envelope-inner {
        padding: 100px 20px 20px;
    }
}
