/**
 * Art Catalog Enquiry - Frontend Styles
 */

/* Buttons Wrapper */
.ace-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

/* Base Button Style */
.ace-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    text-align: center;
    border: 1px solid #1a1a1a;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    line-height: 1.4;
}

/* Primary Button (Enquire) */
.ace-btn-primary {
    background-color: #1a1a1a;
    color: #ffffff;
}

.ace-btn-primary:hover {
    background-color: #333333;
    border-color: #333333;
    color: #ffffff;
}

/* Secondary Buttons */
.ace-btn-secondary {
    background-color: #ffffff;
    color: #1a1a1a;
}

.ace-btn-secondary:hover {
    background-color: #f5f5f5;
    color: #1a1a1a;
    text-decoration: none;
}

/* Button Arrow */
.ace-btn-arrow {
    font-size: 16px;
    line-height: 1;
}

/* Archive Page Link */
.ace-enquiry-link {
    text-align: center;
}

/* Modal Overlay */
.ace-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

/* Modal Content */
.ace-modal-content {
    background: #fff;
    border-radius: 0;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: aceModalFadeIn 0.3s ease;
}

.ace-room-modal-content {
    max-width: none;
    width: auto;
}

@keyframes aceModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close Button */
.ace-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: color 0.2s ease;
}

.ace-modal-close:hover {
    color: #333;
}

/* View In Room Modal */
.ace-room-modal-content {
    max-width: 95vw;
    width: auto;
    padding: 20px;
    display: inline-block;
    background: #f5f5f5;
}

.ace-room-visualizer {
    text-align: center;
    overflow: visible;
}

.ace-room-container {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
    max-height: 75vh;
    overflow: visible;
}

.ace-room-image {
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    display: block;
}

.ace-art-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: none;
}

.ace-art-overlay img {
    display: block;
    max-width: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ace-art-overlay.ace-hanging {
    display: block;
    animation: aceHangingArt 1.5s ease-out forwards;
}

.ace-art-overlay.ace-positioned {
    display: block;
    /* Final resting transform — offset applied via --ace-offset-px set by JS */
    transform: translate(-50%, calc(-50% - var(--ace-offset-px, 0px)));
}

/*
 * Hanging animation — uses CSS custom property --ace-offset-px set by JS
 * so the final resting position correctly reflects the configured offset.
 * Positive --ace-offset-px moves the artwork up; negative moves it down.
 */
@keyframes aceHangingArt {
    0% {
        opacity: 0;
        transform: translate(-50%, calc(-150% - var(--ace-offset-px, 0px))) rotate(0deg);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - var(--ace-offset-px, 0px))) rotate(3deg);
    }
    40% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - var(--ace-offset-px, 0px))) rotate(-2.5deg);
    }
    60% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - var(--ace-offset-px, 0px))) rotate(1.5deg);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - var(--ace-offset-px, 0px))) rotate(-1deg);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - var(--ace-offset-px, 0px))) rotate(0deg);
    }
}

.ace-art-overlay img {
    display: block;
    max-width: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ace-room-dimensions {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.ace-room-dimensions span {
    background: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    display: inline-block;
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    .ace-room-modal-content {
        padding: 15px;
    }
    
    .ace-room-container {
        max-height: 60vh;
    }
    
    .ace-room-image {
        max-height: 60vh;
    }
    
    .ace-room-dimensions {
        font-size: 12px;
    }
}

/* Form Wrapper */
.ace-enquiry-form-wrapper {
    padding: 30px;
}

.ace-enquiry-form-wrapper h3 {
    margin: 0 0 15px;
    padding-right: 30px;
    font-size: 22px;
    color: #333;
}

/* Product Info */
.ace-product-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    border-left: 4px solid #0073aa;
}

.ace-product-info strong {
    color: #333;
}

/* Form Fields */
.ace-enquiry-form {
    margin: 0;
}

.ace-form-field {
    margin-bottom: 18px;
}

.ace-form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ace-form-field .required {
    color: #e74c3c;
}

.ace-form-field input[type="text"],
.ace-form-field input[type="email"],
.ace-form-field input[type="tel"],
.ace-form-field textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.ace-form-field input:focus,
.ace-form-field textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.ace-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Submit Button */
.ace-form-submit {
    margin-top: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Opt-in Checkbox */
.ace-optin-field {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.ace-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal !important;
}

.ace-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.ace-checkbox-label span {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.ace-form-submit button {
    flex: 1;
    padding: 14px 30px !important;
    font-size: 16px !important;
    cursor: pointer;
}

.ace-form-submit button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ace-loading {
    color: #666;
    font-style: italic;
}

/* Messages */
.ace-form-messages {
    margin-top: 15px;
}

.ace-form-messages .ace-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
}

.ace-form-messages .ace-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .ace-modal {
        padding: 10px;
    }
    
    .ace-modal-content {
        max-height: 95vh;
    }
    
    .ace-enquiry-form-wrapper {
        padding: 20px;
    }
    
    .ace-enquiry-form-wrapper h3 {
        font-size: 18px;
    }
    
    .ace-form-submit {
        flex-direction: column;
    }
    
    .ace-form-submit button {
        width: 100%;
    }
}

/* Body class when modal is open */
body.ace-modal-open {
    overflow: hidden;
}
