/**
 * Modal System Styles - UX/UI Expert Refonte
 *
 * @package Forever_BE_Premium
 * @since 2.0.0
 */

/* ============================================================
   MODAL OVERLAY & CONTAINER
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-large {
    max-width: 700px;
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1f2937;
    transform: rotate(90deg);
}

/* ============================================================
   MODAL CONTENT
   ============================================================ */

.modal-content {
    padding: 2rem;
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon .text-gold {
    color: #d97706;
}

.modal-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: #1e5a3e;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.modal-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
}

/* ============================================================
   FORM STYLES
   ============================================================ */

.modal-form {
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    color: #1f2937;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1e5a3e;
    box-shadow: 0 0 0 3px rgba(30, 90, 62, 0.1);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group-checkbox {
    margin: 1.5rem 0;
}

.form-group-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.form-group-checkbox input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.form-group-checkbox span {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.form-group-checkbox a {
    color: #1e5a3e;
    text-decoration: underline;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-modal-primary {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #1e5a3e 0%, #2d8659 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1.0625rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(30, 90, 62, 0.3);
}

.btn-modal-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 90, 62, 0.4);
}

.btn-modal-primary:active {
    transform: translateY(0);
}

.btn-modal-primary .btn-loader {
    display: none;
}

.btn-modal-primary.loading .btn-text {
    display: none;
}

.btn-modal-primary.loading .btn-loader {
    display: flex;
}

.btn-modal-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: white;
    border: 2px solid #1e5a3e;
    color: #1e5a3e;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-modal-secondary:hover {
    background: #1e5a3e;
    color: white;
    transform: translateY(-2px);
}

.modal-footer-text {
    text-align: center;
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

/* ============================================================
   SUCCESS MESSAGE
   ============================================================ */

.success-message {
    text-align: center;
    padding: 2rem 1rem;
}

.success-message h3 {
    margin: 0 0 0.5rem;
}

.success-message p {
    margin: 0;
}

/* ============================================================
   TESTIMONIALS PREVIEW (Modal 5)
   ============================================================ */

.testimonials-preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (min-width: 640px) {
    .testimonials-preview-grid {
        grid-template-columns: 1fr;
    }
}

.testimonial-card-modal {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid #fbbf24;
}

.testimonial-stars {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.testimonial-text {
    font-style: italic;
    color: #374151;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.testimonial-author {
    font-size: 0.875rem;
    color: #6b7280;
}

.testimonial-author strong {
    color: #1e5a3e;
    font-weight: 600;
}

.modal-cta-footer {
    text-align: center;
    margin-top: 2rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
    .modal-container {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-overlay {
        padding: 0;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-container,
    .modal-close {
        transition: none !important;
    }
}

/* Focus trap */
.modal-overlay.active {
    overflow-y: auto;
}

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

/* Redirect dots animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.redirect-dot {
    display: inline-block;
}

/* Success message styling */
#pre-order-success-message {
    animation: fadeInUp 0.4s ease;
}

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