/* ==========================================================================
   NDU External Captive Portal - Clean, Elegant & Professional LIGHT MODE
   ========================================================================== */

:root {
    --bg-main: #f1f5f9;
    --bg-gradient: radial-gradient(circle at 50% 0%, #e0f2fe 0%, #f1f5f9 60%, #e2e8f0 100%);
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.09), 0 4px 12px rgba(15, 23, 42, 0.04);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-blue: #1d4ed8;
    --accent-blue-hover: #1e40af;
    --accent-gold: #d97706;
    --accent-emerald: #059669;
    --accent-red: #dc2626;

    --btn-gradient: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    --btn-hover: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);

    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    --input-focus-border: #2563eb;
    --input-focus-shadow: rgba(37, 99, 235, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --transition-fast: 0.16s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ==========================================================================
   Decorative Background Ambience (Light & Subtle)
   ========================================================================== */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
}

.bg-glow-1 {
    width: 400px;
    height: 400px;
    background: #bfdbfe;
    top: -100px;
    left: 5%;
}

.bg-glow-2 {
    width: 350px;
    height: 350px;
    background: #bae6fd;
    bottom: -80px;
    right: 5%;
}

.bg-glow-3 {
    width: 250px;
    height: 250px;
    background: #fde68a;
    top: 40%;
    left: 45%;
    opacity: 0.25;
}

/* ==========================================================================
   Page Wrapper & Top Nav
   ========================================================================== */
.page-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 430px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.network-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent-blue);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-emerald);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.lang-switch {
    display: inline-flex;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-full);
    padding: 3px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.lang-btn.active {
    background: #eff6ff;
    color: var(--accent-blue);
    font-weight: 800;
}

/* ==========================================================================
   Main Portal Card (White Elegant Light Card)
   ========================================================================== */
.portal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    transition: var(--transition-normal);
}

/* ==========================================================================
   Brand Header
   ========================================================================== */
.brand-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-circle {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1.5px solid rgba(217, 119, 6, 0.35);
    padding: 4px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
    margin-bottom: 2px;
}

.ndu-emblem {
    width: 100%;
    height: 100%;
    display: block;
}

.portal-title {
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.portal-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.access-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}

/* ==========================================================================
   Alert Box
   ========================================================================== */
.alert-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    animation: fadeIn 0.25s ease-in-out;
}

.alert-box.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

/* ==========================================================================
   Login Form
   ========================================================================== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.2px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--accent-blue);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: var(--transition-fast);
}

.link-btn:hover {
    color: var(--accent-blue-hover);
}

.field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.field-wrapper input {
    width: 100%;
    height: 48px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0 42px 0 44px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition-fast);
    outline: none;
}

.field-wrapper input::placeholder {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 400;
}

.field-wrapper input:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    background: #ffffff;
}

.field-wrapper:focus-within .field-icon {
    color: var(--accent-blue);
}

.eye-toggle {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.eye-toggle:hover {
    color: var(--text-primary);
}

/* Checkbox */
.terms-row {
    display: flex;
    align-items: center;
    margin-top: -3px;
}

.custom-check {
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    font-size: 0.77rem;
    color: var(--text-secondary);
    user-select: none;
    gap: 8px;
}

.custom-check input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    width: 18px;
    height: 18px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    transition: var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

.custom-check input:checked ~ .checkmark {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-check input:checked ~ .checkmark::after {
    display: block;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */
.submit-btn {
    width: 100%;
    height: 50px;
    background: var(--btn-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px -3px rgba(29, 78, 216, 0.35);
    transition: var(--transition-normal);
    margin-top: 4px;
}

.submit-btn:hover {
    background: var(--btn-hover);
    transform: translateY(-1.5px);
    box-shadow: 0 12px 24px -3px rgba(29, 78, 216, 0.45);
}

.submit-btn:active {
    transform: translateY(0.5px);
}

.arrow-icon {
    transition: transform 0.2s ease;
}

.submit-btn:hover .arrow-icon {
    transform: translateX(4px);
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Help Modal (Light)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
}

.modal-window {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-body strong {
    color: var(--text-primary);
}

.support-contact {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-top: 4px;
}

.support-contact h4 {
    font-size: 0.78rem;
    color: #166534;
    margin-bottom: 4px;
}

.modal-footer {
    padding: 12px 20px 16px;
    display: flex;
    justify-content: flex-end;
}

.modal-btn {
    background: var(--btn-gradient);
    border: none;
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   Helpers
   ========================================================================== */
.d-none {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   Mobile Tweaks
   ========================================================================== */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .portal-card {
        padding: 26px 20px;
        border-radius: 16px;
    }

    .portal-title {
        font-size: 0.98rem;
    }

    .logo-circle {
        width: 70px;
        height: 70px;
    }
}
