/* ===== AUTHENTICATION PAGES STYLES ===== */

/* Auth Section Layout */
.section-auth {
    background: linear-gradient(135deg, rgba(74, 28, 106, 0.03) 0%, rgba(125, 60, 152, 0.03) 100%);
    padding: 2rem 1rem;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

@media (min-width: 768px) {
    .section-auth {
        padding: 4rem 2rem;
        min-height: 100vh;
    }
}

.auth-container {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* Auth Card */
.auth-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Auth Header */
.auth-header {
    background: linear-gradient(135deg, var(--primary), var(--light-purple));
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
}

.auth-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    /* core/_typography.css sets a global h1-h6 { color: var(--dark) } rule
       that (being a rule on the element itself, not just inherited) beats
       the white text color this banner needs -- was rendering near-black
       text on the purple gradient. */
    color: #ffffff;
}

.auth-header p {
    opacity: 0.9;
    font-size: 1rem;
    margin-bottom: 0;
}

/* Auth Body */
.auth-body {
    padding: 2.5rem 2rem;
}

/* Form Groups */
.auth-form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

.auth-label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    padding-left: 5px;
    font-size: 0.95rem;
}

.auth-input-group {
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    background: white;
}

.auth-input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(74, 28, 106, 0.15);
    border-color: var(--primary);
}

.auth-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55px;
    background: var(--light-gray);
    color: var(--primary);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.auth-input-group:focus-within .auth-input-icon {
    background: var(--primary);
    color: white;
}

/* WhatsApp nu brand green ahiya CSS ma rakhyu chhe, markup ni Bootstrap
   .text-success utility ma nahi. Te utility `color: ... !important` set kare
   chhe, etle focus par icon-box dark purple thay tyare pan glyph green j rahi
   jato hato (2.78:1 - vanchvu mushkel). Ahiya thi focus state jite chhe. */
.auth-input-icon .fa-whatsapp {
    color: #157347;
}

.auth-input-group:focus-within .auth-input-icon .fa-whatsapp {
    color: #fff;
}

.auth-form-control {
    flex: 1;
    padding: 14px 18px;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--dark);
    transition: all 0.3s ease;
    outline: none;
}

.auth-form-control::placeholder {
    color: #9ca3af;
}

.auth-form-control:focus {
    background: #fcfcff;
}

/* Password Wrapper */
.auth-password-wrapper {
    display: flex;
    width: 100%;
}

.auth-toggle-password {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55px;
    background: var(--light-gray);
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.auth-toggle-password:hover {
    background: #e6e9ed;
    color: var(--primary);
}

/* Select Styles */
.auth-form-control select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 45px;
}

/* Auth Button */
.btn-auth {
    background: linear-gradient(135deg, var(--primary), var(--light-purple));
    border: none;
    color: white;
    padding: 0.7rem 1.25rem;
    font-size: 1.02rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 100%;
    min-height: 46px;
    box-shadow: 0 4px 12px rgba(90, 45, 130, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-auth:hover {
    background: linear-gradient(135deg, var(--light-purple), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(90, 45, 130, 0.35);
    color: white;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #eee;
    color: #666;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Alert Styles */
.alert-auth {
    background: rgba(220, 53, 69, 0.08);
    color: #721c24;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 4px solid #dc3545;
}

.alert-auth i {
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-auth h5 {
    margin-bottom: 5px;
    font-size: 1rem;
}

.alert-auth ul {
    margin-bottom: 0;
}

/* Form Validation */
.invalid-feedback {
    display: none !important;
}

.auth-form-group.has-error .auth-input-group,
.auth-input-group.is-invalid,
.was-validated .auth-form-control:invalid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.2) !important;
}

.was-validated .auth-form-control:valid {
    border-color: #22c55e !important;
}

/* Gujarati Text in Forms */
.gujarati.form-text {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Forgot Password Link */
.text-end a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.text-end a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
    .section-auth {
        padding: 1rem 0.6rem;
    }
    
    .auth-header {
        padding: 1.25rem 1rem;
    }
    
    .auth-header h2 {
        font-size: 1.25rem;
    }
    
    .auth-body {
        padding: 1.25rem 1rem;
    }
    
    .auth-form-group {
        margin-bottom: 1.15rem;
    }
    
    .auth-form-control {
        padding: 9px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .auth-input-icon {
        width: 42px;
    }
    
    .auth-toggle-password {
        width: 42px;
    }
    
    .btn-auth {
        padding: 0.55rem 1rem;
        font-size: 0.92rem;
        min-height: 42px;
        border-radius: 10px;
        gap: 6px;
    }

    #btn-change-phone,
    #btn-resend {
        font-size: 0.82rem;
        padding: 0.35rem 0.75rem;
        min-height: 34px;
    }

    .otp-container {
        gap: 6px;
        margin: 1rem auto;
        max-width: 300px;
    }

    .otp-digit {
        max-width: 42px;
        height: 48px;
        font-size: 1.35rem;
        border-radius: 8px;
    }

    .otp-timer-row {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .otp-timer-badge {
        font-size: 0.82rem;
        padding: 4px 10px;
    }

    .wa-status-box {
        padding: 1rem 0.75rem;
        margin-bottom: 1.15rem;
    }

    .wa-icon-pulse {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
        margin-bottom: 0.5rem;
    }

    .wa-steps-list {
        padding: 0.6rem 0.8rem;
        font-size: 0.82rem;
    }
}

@media (max-width: 375px) {
    .section-auth {
        padding: 0.75rem 0.4rem;
    }

    .auth-body {
        padding: 1rem 0.75rem;
    }

    .btn-auth {
        padding: 0.48rem 0.85rem;
        font-size: 0.88rem;
        min-height: 40px;
    }

    .otp-container {
        gap: 4px;
        margin: 0.85rem auto;
        max-width: 270px;
    }

    .otp-digit {
        max-width: 38px;
        height: 44px;
        font-size: 1.2rem;
        border-radius: 7px;
    }

    .otp-timer-badge {
        font-size: 0.78rem;
        padding: 3px 8px;
    }

    #btn-resend {
        font-size: 0.78rem;
    }
}

@media (max-width: 320px) {
    .section-auth {
        padding: 0.5rem 0.25rem;
    }

    .auth-body {
        padding: 0.85rem 0.5rem;
    }

    .otp-container {
        gap: 3px;
        max-width: 250px;
    }

    .otp-digit {
        max-width: 35px;
        height: 40px;
        font-size: 1.1rem;
        border-width: 1.5px;
        border-radius: 6px;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .auth-input-group {
        border-width: 2px;
    }
    
    .auth-header {
        background: var(--primary);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-input-group,
    .btn-auth,
    .auth-toggle-password {
        transition: none;
    }
}

/* ===== WhatsApp Verification & OTP Flow Styles ===== */
.wa-status-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.wa-status-box.waiting {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.wa-status-box.cancelled, .wa-status-box.failed {
    background: #fef2f2;
    border-color: #fecaca;
}

.wa-icon-pulse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #25d366;
    color: white;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    animation: wa-pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
}

.wa-icon-pulse.waiting {
    background: #0284c7;
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.5);
}

@keyframes wa-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
        transform: scale(0.98);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
        transform: scale(0.98);
    }
}

.wa-steps-list {
    text-align: left;
    background: white;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0 0 0;
    border: 1px dashed #cbd5e1;
    font-size: 0.9rem;
}

.wa-steps-list li {
    margin-bottom: 0.35rem;
}

.wa-steps-list li:last-child {
    margin-bottom: 0;
}

/* OTP Digits Container */
.otp-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 1.25rem auto;
    width: 100%;
    max-width: 330px;
    box-sizing: border-box;
    padding: 0 4px;
}

.otp-digit {
    flex: 1 1 0;
    min-width: 0;
    max-width: 48px;
    height: 52px;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
    box-sizing: border-box;
}

.otp-digit:focus {
    border-color: #25d366;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
    transform: translateY(-2px);
}

.otp-digit.filled {
    border-color: #4a1c6a;
    background: #faf5ff;
}

.otp-timer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
}

.otp-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
}

.otp-timer-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.otp-timer-badge.expired {
    background: #fee2e2;
    color: #991b1b;
}

.phone-badge {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 600;
    color: #334155;
}

/* Success Card */
.success-checkmark {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #22c55e;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 1rem auto;
    animation: scale-up 0.4s ease-out;
}

@keyframes scale-up {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}