/* =========================================
   CORE ENGINE
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--brand-dark);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 1100px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 1; /* Ensure content is below modal */
}

/* --- Left Column --- */
.content-side { padding-right: 2rem; }

.badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(0, 122, 255, 0.15); /* Slightly stronger for visibility on dark */
    color: var(--brand-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--brand-dark);
    opacity: 0.8; /* Increased opacity for better read */
    margin-bottom: 3rem;
}

.benefits-list { list-style: none; }
.benefit-item { display: flex; gap: 1rem; margin-bottom: 2rem; }

.icon-box {
    flex-shrink: 0;
    width: 48px; height: 48px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.benefit-text h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
.benefit-text p { font-size: 0.95rem; opacity: 0.7; }

/* --- Right Column: Form --- */
.form-wrapper {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease;
}

.form-header { margin-bottom: 1.5rem; }
.form-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.form-header p { font-size: 0.9rem; opacity: 0.6; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.full-width { grid-column: span 2; }
.form-group { margin-bottom: 1rem; }

label {
    display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; opacity: 0.8;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent; /* Default border */
    background: var(--bg-input);
    font-size: 1rem;
    color: var(--brand-dark);
    transition: all 0.2s ease;
    font-family: inherit;
}

input:focus, select:focus {
    outline: none;
    background: var(--bg-card);
    box-shadow: var(--shadow-focus);
}

/* VALIDATION FIX: Only show red border if parent form has class 'was-validated' */
.was-validated input:invalid, 
.was-validated select:invalid {
    border: 1px solid #ff453a;
    background-image: none; /* Remove browser default icons */
}

.btn-submit {
    width: 100%;
    padding: 16px;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: transform 0.1s ease, opacity 0.2s ease;
}
.btn-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.legal-text { font-size: 0.75rem; text-align: center; margin-top: 1.5rem; opacity: 0.5; }

/* --- MODAL FIXES --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6); /* Darker dim */
    backdrop-filter: blur(8px);      /* Stronger blur */
    z-index: 9999;                   /* Ensure it is on top */
    
    /* Hiding Mechanism */
    display: none;                   /* Completely remove from layout by default */
    opacity: 0;
    transition: opacity 0.3s ease;   /* Only transition opacity */
    
    align-items: center;
    justify-content: center;
}

/* State: Display Block (Layout) */
.modal-overlay.is-open {
    display: flex; 
}

/* State: Visible (Opacity) */
.modal-overlay.is-visible {
    opacity: 1;
}

.modal-card {
    background: var(--bg-card);
    width: 90%;
    max-width: 400px;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.is-visible .modal-card {
    transform: scale(1);
}

.close-modal {
    position: absolute; top: 1rem; right: 1rem;
    background: transparent; border: none;
    font-size: 1.5rem; cursor: pointer;
    opacity: 0.5; color: var(--brand-dark);
}

.modal-icon { font-size: 3rem; margin-bottom: 1rem; }
.modal-card h3 { font-size: 1.5rem; margin-bottom: 0.5rem; color: var(--brand-dark); }
.modal-card p { font-size: 0.95rem; opacity: 0.7; margin-bottom: 1.5rem; line-height: 1.4; }

.otp-input-wrapper input {
    font-size: 2rem; text-align: center; letter-spacing: 0.5rem;
    font-weight: 700; padding: 1rem; margin-bottom: 1rem;
    background: var(--bg-input); color: var(--brand-primary);
    border: 1px solid transparent;
}
.resend-link { margin-top: 1rem; font-size: 0.85rem; color: var(--brand-dark); opacity: 0.6; }
.resend-link a { color: var(--brand-primary); text-decoration: none; font-weight: 600; }

/* Responsive */
@media (max-width: 900px) {
    .container { grid-template-columns: 1fr; gap: 2rem; }
    .content-side { padding-right: 0; text-align: center; }
    .benefit-item { text-align: left; }
    h1 { font-size: 2.5rem; }
}

/* Session Loading State */
.loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-body);
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.3s ease;
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(0,0,0,0.1);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
.fade-out { opacity: 0; pointer-events: none; }