/* ============================================================
   CDRRMO Emergency Management — Auth Pages Stylesheet
   Font  : Inter (matches dashboard)
   Theme : Topographic dark — deep navy with contour mapping
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ── */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Core palette — dashboard-aligned */
    --blue-600: #0d6efd;
    --blue-700: #0b5ed7;
    --blue-800: #084298;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;

    --red-500: #dc3545;
    --red-50: #fff5f5;
    --red-100: #fecdd3;

    --green-600: #198754;
    --green-50: #f0fdf4;
    --green-100: #bbf7d0;

    --amber-50: #fffbeb;
    --amber-200: #fde68a;

    /* Neutrals */
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;

    /* Semantic */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-500);
    --text-muted: var(--gray-400);
    --text-label: var(--gray-700);

    --border: var(--gray-200);
    --border-strong: var(--gray-300);

    --radius-card: 18px;
    --radius-input: 10px;
    --radius-btn: 10px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.10), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.35);

    --transition-fast: 0.15s ease;
    --transition: 0.2s ease;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Page — Dark topographic background ── */
body {
    min-height: 100vh;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    color: var(--text-primary);

    /* Deep navy — topographic theme */
    background-color: #0a0f1a;
    background-image: none;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

img {
    background-color: whitesmoke;
}

/* Atmospheric glow overlay (radial depth washes) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 55% at 25% 38%, rgba(13, 80, 160, 0.35) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 78% 65%, rgba(10, 55, 130, 0.28) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* ── Topographic SVG Background ── */
.topo-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ── Layout ── */
.auth-container {
    width: 100%;
    max-width: 448px;
    position: relative;
    z-index: 2;
    margin-inline: auto;
}

/* ── Card ── */
.auth-card {
    background: var(--white);
    border-radius: var(--radius-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: cardReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
    width: 100%;
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Card Header ── */
.auth-header {
    padding: 36px 36px 28px;
    text-align: center;
    background: linear-gradient(160deg, #0d1321 0%, #1a2540 100%);
    position: relative;
    overflow: hidden;
}

/* Mini topographic SVG inside header */
.auth-header-topo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.18;
    pointer-events: none;
}

/* Gloss sheen at top */
.auth-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

/* Blue accent stripe at bottom of header */
.auth-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue-800), var(--blue-600), #3d8bfd);
}

/* ── Logo ── */
.auth-logo {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07), var(--shadow-md);
    display: block;
    margin: 0 auto 16px;
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    z-index: 1;
}

.auth-logo:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.12), var(--shadow-lg);
}

/* ── Header Text ── */
.auth-org {
    font-family: var(--font-family);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(245, 245, 245, 0.833);
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.auth-title {
    font-family: var(--font-family);
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.25;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.auth-subtitle {
    font-family: var(--font-family);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
    margin-top: 5px;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* ── Step Indicator ── */
.auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}

.step-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all var(--transition);
}

.step-dot.active {
    background: var(--blue-600);
    width: 22px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.6);
}

.step-dot.done {
    background: rgba(13, 110, 253, 0.45);
}

.step-line {
    width: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.12);
}

/* ── Form Body ── */
.auth-body {
    padding: 28px 36px 36px;
    background: var(--white);
}

/* ── Django Messages ── */
.alert {
    font-family: var(--font-family);
    border-radius: var(--radius-input);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    padding: 10px 14px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-error,
.alert-danger {
    background: var(--red-50);
    color: var(--red-500);
    border-color: var(--red-100);
}

.alert-success {
    background: var(--green-50);
    color: var(--green-600);
    border-color: var(--green-100);
}

.alert-warning {
    background: var(--amber-50);
    color: #92400e;
    border-color: var(--amber-200);
}

.alert-info {
    background: var(--blue-50);
    color: var(--blue-700);
    border-color: var(--blue-100);
}

/* ── Form Fields ── */
.field-group {
    margin-bottom: 18px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-family);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 7px;
    letter-spacing: -0.01em;
}

.field-label .material-symbols-outlined {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.field-wrap {
    position: relative;
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--gray-50);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-input);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-control:hover {
    border-color: var(--border-strong);
    background: var(--white);
}

.form-control:focus {
    border-color: var(--blue-600);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.form-control.has-icon-right {
    padding-right: 44px;
}

.field-hint {
    font-family: var(--font-family);
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

/* ── Toggle password ── */
.btn-toggle-pw {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 11px;
    height: 40px;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
    border-radius: 0 var(--radius-input) var(--radius-input) 0;
}

.btn-toggle-pw:hover {
    color: var(--text-primary);
}

.btn-toggle-pw .material-symbols-outlined {
    font-size: 1.125rem;
}

/* ── PIN inputs ── */
.pin-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.pin-input {
    width: 48px !important;
    height: 56px;
    padding: 0 !important;
    text-align: center;
    font-family: var(--font-family) !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    border-radius: var(--radius-input) !important;
    caret-color: var(--blue-600);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast),
        background var(--transition-fast);
}

.pin-input:focus {
    transform: translateY(-2px);
    background: var(--white) !important;
}

/* ── Primary Button ── */
.btn-primary-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-height: 46px;
    padding: 0 20px;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--white);
    background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(13, 110, 253, 0.3);
    transition:
        background var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
    margin-top: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

/* Gloss shimmer on button */
.btn-primary-auth::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.btn-primary-auth:hover {
    background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-800) 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 6px 20px rgba(13, 110, 253, 0.4);
    transform: translateY(-1px);
}

.btn-primary-auth:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary-auth:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary-auth .material-symbols-outlined {
    font-size: 1.125rem;
}

/* ── Text link ── */
.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--blue-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-link:hover {
    color: var(--blue-700);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-link .material-symbols-outlined {
    font-size: 1rem;
}

/* ── Divider row ── */
.auth-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ── Loading spinner ── */
.auth-spinner {
    display: none;
    text-align: center;
    padding: 8px 0 18px;
}

.auth-spinner.active {
    display: block;
}

.spinner-ring {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border);
    border-top-color: var(--blue-600);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner-label {
    font-family: var(--font-family);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 8px;
}

/* ── Inline error box ── */
.auth-error {
    display: none;
    background: var(--red-50);
    border: 1px solid var(--red-100);
    border-radius: var(--radius-input);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    color: var(--red-500);
    font-weight: 500;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.45;
}

.auth-error.active {
    display: flex;
}

.auth-error .material-symbols-outlined {
    font-size: 1.125rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Footer ── */
.auth-footer {
    text-align: center;
    margin-top: 20px;
}

.auth-footer p {
    font-family: var(--font-family);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.28);
    letter-spacing: 0.01em;
}

/* ── Resend row ── */
.resend-row {
    text-align: center;
    margin-top: 14px;
}

.resend-label {
    font-family: var(--font-family);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-resend {
    background: none;
    border: none;
    font-family: var(--font-family);
    color: var(--blue-600);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0;
    transition: color var(--transition-fast);
}

.btn-resend:hover {
    color: var(--blue-700);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-resend:disabled {
    color: var(--text-muted);
    cursor: default;
    text-decoration: none;
}

/* ── Password strength ── */
.pw-strength {
    margin-top: 8px;
}

.pw-strength-bar {
    height: 3px;
    border-radius: 99px;
    background: var(--border);
    overflow: hidden;
}

.pw-strength-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.pw-strength-label {
    font-family: var(--font-family);
    font-size: 0.75rem;
    margin-top: 4px;
    font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    body {
        padding: 20px 12px;
    }

    .auth-header {
        padding: 28px 24px 22px;
    }

    .auth-body {
        padding: 22px 24px 28px;
    }

    .auth-title {
        font-size: 1.1875rem;
    }

    .auth-subtitle {
        font-size: 0.78rem;
    }

    .pin-input {
        width: 42px !important;
        height: 50px;
        font-size: 1.3rem !important;
    }
}