/* ===================================================
   AUTH MODAL — Login / Signup / Recovery
   VPES SIMS Design System (Matching New Home Theme)
   =================================================== */

/* Overlay */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 41, 19, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: authModalFadeIn 0.25s ease;
}

@keyframes authModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Container */
.auth-modal-container {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid rgba(14, 104, 53, 0.12);
    box-shadow: 0 24px 64px rgba(4, 41, 19, 0.28), 0 6px 20px rgba(0, 0, 0, 0.12);
    width: 100%;
    max-width: 490px;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    animation: authModalSlideIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: max-width 0.35s ease;
    font-family: 'Plus Jakarta Sans', 'Poppins', sans-serif;
}

.auth-modal-container.auth-modal-wide {
    max-width: 840px;
}

@keyframes authModalSlideIn {
    from { opacity: 0; transform: scale(0.93) translateY(-14px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Scrollbar */
.auth-modal-container::-webkit-scrollbar { width: 5px; }
.auth-modal-container::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 10px; }
.auth-modal-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Close button */
.auth-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
    backdrop-filter: blur(4px);
}
.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.38);
    transform: rotate(90deg);
}

/* ── Header ─────────────────────────────────── */
.auth-modal-header {
    background: linear-gradient(135deg, #0E6835 0%, #07421E 60%, #042913 100%);
    padding: 32px 24px 24px;
    text-align: center;
    border-radius: 20px 20px 0 0;
    position: relative;
    overflow: hidden;
}

/* Subtle background glowing crest */
.auth-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(253, 230, 138, 0.25) 0%, rgba(245, 158, 11, 0.08) 50%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-modal-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.auth-modal-logo img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid rgba(253, 230, 138, 0.6);
    object-fit: contain;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
    padding: 2px;
}

.auth-modal-header h2 {
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.auth-modal-header p {
    color: rgba(253, 230, 138, 0.92);
    font-size: 0.88rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
    margin: 0;
}

/* ── Body ────────────────────────────────────── */
.auth-modal-body {
    padding: 26px 36px 32px;
}

/* Register / Login toggle bar */
.auth-modal-register-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #64748b;
}

.auth-modal-text-btn {
    background: none;
    border: none;
    color: #0E6835;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.auth-modal-text-btn:hover {
    background: rgba(14, 104, 53, 0.08);
    color: #07421E;
}

/* ── Messages ────────────────────────────────── */
.auth-modal-error,
.auth-modal-success {
    padding: 11px 15px;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.auth-modal-error {
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.auth-modal-success {
    background: #F0FDF4;
    color: #15803D;
    border: 1px solid #BBF7D0;
}

/* Loading */
.auth-modal-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 15px;
    background: #F8FAFC;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.86rem;
    color: #334155;
    border: 1px solid #E2E8F0;
}

.auth-modal-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid #E2E8F0;
    border-top-color: #0E6835;
    border-radius: 50%;
    animation: authSpin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes authSpin { to { transform: rotate(360deg); } }

/* ── Forms ───────────────────────────────────── */
.auth-modal-form { display: block; }

.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 2px;
}

.auth-form-row-3 {
    grid-template-columns: 1.15fr 0.9fr 1.15fr;
    gap: 16px;
}

.auth-form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.auth-form-group label {
    font-size: 0.84rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-form-group label i {
    color: #0E6835;
    font-size: 0.8rem;
}

.auth-form-control {
    padding: 11px 14px;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    font-size: 0.91rem;
    color: #0F172A;
    background: #ffffff;
    transition: all 0.2s ease;
    width: 100%;
    outline: none;
    font-family: inherit;
}

.auth-form-control:focus {
    border-color: #0E6835;
    box-shadow: 0 0 0 3.5px rgba(14, 104, 53, 0.15);
}

.auth-form-control::placeholder { color: #94A3B8; }

/* Password field */
.auth-password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-password-field .auth-form-control {
    padding-right: 42px;
}

/* Hide native Edge / Chrome / Safari reveal icon */
.auth-password-field input[type="password"]::-ms-reveal,
.auth-password-field input[type="password"]::-ms-clear,
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    color: #94A3B8;
    cursor: pointer;
    font-size: 0.88rem;
    transition: color 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    padding: 4px;
}
.auth-password-toggle:hover { color: #0E6835; }

/* ── Buttons ─────────────────────────────────── */
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 9999px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    margin-bottom: 10px;
    line-height: 1.4;
}

.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-btn:last-child { margin-bottom: 0; }

.auth-btn-primary {
    background-color: #0E6835;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(14, 104, 53, 0.28);
}
.auth-btn-primary:hover:not(:disabled) {
    background-color: #07421E;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(14, 104, 53, 0.38);
}

.auth-btn-secondary {
    background: #F1F5F9;
    color: #334155;
    border: 1px solid #CBD5E1;
}
.auth-btn-secondary:hover:not(:disabled) {
    background: #E2E8F0;
    color: #0F172A;
    transform: translateY(-1px);
}

/* Forgot password link */
.auth-forgot-link {
    text-align: center;
    margin: 4px 0 12px;
}

.auth-forgot-link a {
    color: #0E6835;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
.auth-forgot-link a:hover {
    color: #07421E;
    text-decoration: underline;
}

/* Signup prompt in login form */
.auth-signup-prompt {
    text-align: center;
    font-size: 0.84rem;
    color: #64748b;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid #F1F5F9;
}

.auth-inline-btn {
    background: none;
    border: none;
    color: #0E6835;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.84rem;
    padding: 0;
    text-decoration: underline;
    transition: color 0.15s;
}
.auth-inline-btn:hover { color: #07421E; }

/* Notice box (signup info) */
.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-left: 4px solid #0E6835;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 0.83rem;
    color: #166534;
    margin-bottom: 18px;
    line-height: 1.5;
}

.auth-notice i {
    font-size: 1rem;
    color: #0E6835;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Checkbox */
.auth-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 16px;
    font-size: 0.84rem;
    color: #334155;
    line-height: 1.4;
}

.auth-checkbox-group input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    accent-color: #0E6835;
    cursor: pointer;
}

.auth-checkbox-group a {
    color: #0E6835;
    font-weight: 700;
    text-decoration: underline;
}
.auth-checkbox-group a:hover { color: #07421E; }

/* reCAPTCHA */
.auth-recaptcha-wrap {
    margin-bottom: 18px;
    display: flex;
    justify-content: center;
    min-height: 78px;
}

/* ── Instruction Screen ──────────────────────── */
.auth-instruction-screen { display: none; }

.auth-instruction-content {
    text-align: center;
    padding: 6px 0 10px;
}

.auth-instruction-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    line-height: 1;
    color: #0E6835;
}

.auth-instruction-content h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0E6835;
    margin-bottom: 14px;
}

.auth-instruction-box {
    background: #F8FAFC;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
    border: 1px solid #E2E8F0;
    text-align: left;
}

.auth-instruction-box p {
    font-size: 0.875rem;
    color: #334155;
    margin-bottom: 6px;
    line-height: 1.55;
}
.auth-instruction-box p:last-child { margin-bottom: 0; }

.auth-instruction-email {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #0E6835 !important;
    word-break: break-all;
}

.auth-instruction-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.auth-instruction-actions .auth-btn {
    flex: 1;
    min-width: 120px;
}

.auth-instruction-note {
    font-size: 0.78rem;
    color: #94A3B8;
    margin: 0;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 880px) {
    .auth-modal-container.auth-modal-wide { max-width: 95%; }
    .auth-modal-body { padding: 24px 24px 28px; }
}

@media (max-width: 680px) {
    .auth-form-row,
    .auth-form-row-3 {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .auth-modal-container.auth-modal-wide { max-width: 100%; }
    .auth-modal-body { padding: 20px 18px 22px; }
    .auth-modal-header { padding: 26px 18px 20px; }
}

@media (max-height: 600px) {
    .auth-modal-container { max-height: 98vh; }
    .auth-modal-header { padding: 18px 20px 14px; }
    .auth-modal-logo img { width: 40px; height: 40px; }
    .auth-modal-header h2 { font-size: 1.25rem; }
}
