/**
 * WooCommerce Terms Gate - Frontend Styles
 * 
 * @package WC_Terms_Gate
 * @version 1.0.0
 */

/* ===== Modal Overlay ===== */
.bdptg-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
}

.bdptg-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ===== Modal Content ===== */
.bdptg-popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: bdptg-fadeInScale 0.3s ease-out;
}

@keyframes bdptg-fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===== Modal Header ===== */
#bdptg-popup-title {
    margin: 0;
    padding: 24px 24px 16px;
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

/* ===== Terms Content Area ===== */
.bdptg-terms-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    line-height: 1.6;
    color: #495057;
    font-size: 15px;
}

.bdptg-terms-content::-webkit-scrollbar {
    width: 8px;
}

.bdptg-terms-content::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.bdptg-terms-content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.bdptg-terms-content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.bdptg-terms-content h3 {
    color: #2c3e50;
    margin-top: 20px;
    margin-bottom: 12px;
    font-size: 18px;
}

.bdptg-terms-content ul,
.bdptg-terms-content ol {
    margin-left: 20px;
    margin-bottom: 16px;
}

.bdptg-terms-content li {
    margin-bottom: 8px;
}

.bdptg-terms-content p {
    margin-bottom: 16px;
}

/* ===== Acceptance Checkbox ===== */
.bdptg-accept-checkbox {
    padding: 20px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.bdptg-accept-checkbox:hover {
    background: #f1f3f5;
}

.bdptg-accept-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.bdptg-accept-checkbox span {
    color: #495057;
    font-size: 15px;
    user-select: none;
}

/* ===== Action Buttons ===== */
.bdptg-popup-buttons {
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #e9ecef;
}

.bdptg-popup-buttons button {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-width: 100px;
}

.bdptg-cancel {
    background: #e9ecef;
    color: #495057;
}

.bdptg-cancel:hover {
    background: #dee2e6;
    transform: translateY(-1px);
}

.bdptg-accept {
    background: #28a745;
    color: white;
}

.bdptg-accept:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.bdptg-accept:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Close Button ===== */
.bdptg-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #6c757d;
    transition: all 0.2s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdptg-close:hover {
    background: #f1f3f5;
    color: #343a40;
    transform: rotate(90deg);
}

/* ===== Loading State ===== */
.bdptg-terms-content p:first-child:last-child {
    text-align: center;
    color: #6c757d;
    padding: 40px 0;
}

/* ===== Error State ===== */
.bdptg-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

/* ===== Body Overlay Active ===== */
body.bdptg-popup-open {
    overflow: hidden;
}

/* ===== Mobile Responsiveness ===== */
@media (max-width: 640px) {
    .bdptg-popup-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
        top: auto;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        animation: bdptg-slideUp 0.3s ease-out;
    }
    
    @keyframes bdptg-slideUp {
        from {
            transform: translateX(-50%) translateY(100%);
        }
        to {
            transform: translateX(-50%) translateY(0);
        }
    }
    
    #bdptg-popup-title {
        padding: 20px 20px 16px;
        font-size: 20px;
    }
    
    .bdptg-terms-content {
        padding: 20px;
    }
    
    .bdptg-popup-buttons {
        flex-direction: column;
        padding: 16px 20px;
    }
    
    .bdptg-popup-buttons button {
        width: 100%;
        padding: 12px;
    }
    
    .bdptg-close {
        top: 16px;
        right: 16px;
    }
}

/* ===== Dark Mode Support (if theme supports) ===== */
@media (prefers-color-scheme: dark) {
    body.theme-dark .bdptg-popup-content {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    body.theme-dark #bdptg-popup-title {
        color: #ffffff;
        border-bottom-color: #333;
    }
    
    body.theme-dark .bdptg-terms-content {
        color: #cbd5e0;
    }
    
    body.theme-dark .bdptg-terms-content h3 {
        color: #ffffff;
    }
    
    body.theme-dark .bdptg-accept-checkbox {
        background: #2a2a2a;
        border-top-color: #333;
    }
    
    body.theme-dark .bdptg-accept-checkbox:hover {
        background: #333;
    }
    
    body.theme-dark .bdptg-popup-buttons {
        border-top-color: #333;
    }
    
    body.theme-dark .bdptg-cancel {
        background: #333;
        color: #e0e0e0;
    }
    
    body.theme-dark .bdptg-cancel:hover {
        background: #404040;
    }
    
    body.theme-dark .bdptg-close {
        color: #9ca3af;
    }
    
    body.theme-dark .bdptg-close:hover {
        background: #333;
        color: #ffffff;
    }
}

/* ===== Accessibility ===== */
.bdptg-popup-content:focus-visible,
.bdptg-popup button:focus-visible,
.bdptg-accept-checkbox input:focus-visible {
    outline: 2px solid #4c9aff;
    outline-offset: 2px;
}

/* Screen reader only text */
.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
}