/**
 * Legal Agreement Lightbox Styles
 */

/* Prevent body scroll when lightbox is open */
body.spa-legal-lightbox-open {
    overflow: hidden;
}

/* Checkbox styling */
.spa-legal-checkbox {
    cursor: pointer;
}

/* Checkbox that requires reading - looks clickable but opens lightbox */
.spa-legal-checkbox.spa-legal-checkbox-requires-read {
    cursor: pointer;
}

.spa-legal-checkbox.spa-legal-checkbox-requires-read input[type="checkbox"] {
    cursor: pointer;
}

/* Checkbox that is pre-accepted (already accepted) - disabled appearance */
.spa-legal-checkbox.spa-legal-checkbox-accepted {
    opacity: 0.8;
}

.spa-legal-checkbox.spa-legal-checkbox-accepted input[type="checkbox"] {
    cursor: default;
}

.spa-legal-label {
    text-decoration: underline;
    cursor: pointer;
    color: black;
    transition: color 0.2s ease;
}

.spa-legal-label:hover {
    color: #58a8c9;
}

/* Accepted info text */
.spa-legal-accepted-info {
    display: block;
    font-size: 12px;
    color: #28a745;
    margin-top: 5px;
    font-style: italic;
}

/* Lightbox */
.spa-legal-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spa-legal-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.spa-legal-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    max-height: 800px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: spa-lightbox-appear 0.3s ease;
}

@keyframes spa-lightbox-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.spa-legal-lightbox-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.spa-legal-lightbox-close:hover {
    background: #f5f5f5;
    transform: scale(1.1);
}

.spa-legal-lightbox-document {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    background: #525659;
}

/* PDF.js rendered pages */
.spa-legal-pdf-page {
    display: block;
    margin: 0 auto 20px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: #fff;
}

.spa-legal-pdf-page:last-child {
    margin-bottom: 0;
}

.spa-legal-pdf-loading {
    text-align: center;
    padding: 60px 20px;
    color: #fff;
    font-size: 16px;
}

.spa-legal-lightbox-footer {
    padding: 20px;
    background: #f8f6f4;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    text-align: center;
}

.spa-legal-scroll-notice {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
}

.spa-legal-scroll-notice.spa-legal-scroll-complete {
    color: #28a745;
    font-weight: 500;
}

.spa-legal-confirm-btn {
    padding: 12px 30px !important;
    font-size: 16px !important;
    background: #92c5da !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.spa-legal-confirm-btn:hover:not(:disabled) {
    background: #58a8c9 !important;
}

.spa-legal-confirm-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .spa-legal-lightbox-content {
        width: 95%;
        height: 90vh;
        margin: 0 10px;
    }

    .spa-legal-lightbox-close {
        top: -10px;
        right: -5px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }

    .spa-legal-lightbox-document {
        padding: 10px;
    }

    .spa-legal-pdf-page {
        margin-bottom: 15px;
    }

    .spa-legal-lightbox-footer {
        padding: 15px;
    }

    .spa-legal-confirm-btn {
        width: 100%;
        padding: 15px 20px !important;
    }
}

/* Legal agreement section in checkout */
.spa-legal-agreement-section {
    margin-top: 20px;
}

.spa-legal-agreement-section h3 {
    margin-bottom: 10px;
}

#legal_agreement_checkbox_field {
    margin-bottom: 20px;
}

/* WooCommerce Blocks checkout specific styles */
.spa-legal-agreement-wrapper.spa-legal-agreement-blocks {
    margin: 20px 0;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 4px;
}

.spa-legal-agreement-blocks .spa-legal-agreement-section h3 {
    margin-top: 0;
    font-size: 18px;
}

/* Error styling */
.spa-legal-error {
    color: #cc1818;
    font-size: 14px;
    margin-top: 8px;
}

.spa-legal-error p {
    margin: 0;
}

#legal_agreement_checkbox_field.has-error {
    border-left: 3px solid #cc1818;
    padding-left: 10px;
}

#legal_agreement_checkbox_field.has-error .spa-legal-label {
    color: #cc1818;
}

/* Blocks checkout button override */
.spa-legal-agreement-blocks + .wc-block-checkout__actions {
    margin-top: 20px;
}

/* Booking popup specific styles */
.spa-legal-agreement-booking {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.booking-popup-section-cart .spa-legal-agreement-booking {
    padding: 20px 50px;
}

.spa-legal-agreement-booking .booking-popup-section-group {
    display: flex;
    flex-direction: column;
}

.spa-legal-agreement-booking label.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    width:fit-content;
}

.spa-legal-agreement-booking label.checkbox input[type="checkbox"] {
    flex-shrink: 0;
    margin-top:0;
}

.spa-legal-agreement-booking .spa-legal-label {
    flex: 1;
}

.spa-legal-agreement-booking abbr.required {
    color: #cc1818;
    text-decoration: none;
    margin-left: 5px;
}
