:root {
    --color-bg: #020617;         /* very dark blue */
    --color-bg-alt: #0b1020;
    --color-primary: #1d4ed8;    /* blue */
    --color-accent: #dc2626;     /* red */
    --color-light: #ffffff;
    --color-muted: #94a3b8;
    --color-border: rgba(148, 163, 184, 0.35);
    --radius-lg: 18px;
    --radius-xl: 28px;
    --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.8);
    --transition-fast: 0.2s ease-out;
    --transition-med: 0.3s ease-out;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at 0% 0%, rgba(37,99,235,0.45), transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(239,68,68,0.45), transparent 55%),
        radial-gradient(circle at 50% 120%, rgba(15,23,42,1), rgba(15,23,42,1));
    color: var(--color-light);
    -webkit-font-smoothing: antialiased;
}

/* Layout wrapper */

/* Full-width breakout for immersive content (maps, charts, etc.) */
.full-width {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

/* Top bar / nav (used on projects page) */

.app-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(18px);
    background: linear-gradient(
        90deg,
        rgba(15, 23, 42, 0.95),
        rgba(15, 23, 42, 0.7)
    );
    border-bottom: 1px solid rgba(148,163,184,0.35);
}

.app-nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0.9rem 1.25rem;
    gap: 1.5rem;
}

.app-nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* Logo */

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-light);
}

.logo-mark {
    position: relative;
    width: 42px;
    height: 26px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #ffffff, #1d4ed8);
    box-shadow: 0 12px 30px rgba(37,99,235,0.65);
    overflow: hidden;
}

.logo-mark::before {
    content: "";
    position: absolute;
    inset: 40% -10px auto;
    height: 2px;
    background: linear-gradient(90deg, #ffffff, #dc2626, #1d4ed8);
    transform: rotate(-9deg);
}

.logo-mark::after {
    content: "";
    position: absolute;
    right: 4px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 3px 3px 1px 3px;
    background: #ffffff;
    box-shadow: -3px 4px 0 #0f172a;
}

.logo-text-primary {
    color: var(--color-light);
}

.logo-text-accent {
    color: var(--color-accent);
}

/* =========================================================
   NAV PILLS (uniform top-nav buttons with dot indicator)
   Grey dot = inactive, Blue dot = active
========================================================= */

.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    /* ✅ NEW: uniform sizing across all pills (fixes Logout being smaller) */
    min-width: 150px;
    text-align: center;

    padding: 0.55rem 1rem;
    border-radius: 999px;

    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(2,6,23,0.18);

    color: var(--color-muted);
    text-decoration: none;
    cursor: pointer;

    backdrop-filter: blur(10px);

    transition: transform var(--transition-fast),
                background var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast);
}

.nav-pill:hover {
    transform: translateY(-1px);
    background: rgba(15,23,42,0.85);
    border-color: rgba(148,163,184,0.75);
    color: var(--color-light);
    box-shadow: 0 12px 26px rgba(15,23,42,0.65);
}

.nav-pill:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 8px 18px rgba(15,23,42,0.55);
}

.nav-pill-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;

    /* Inactive dot = grey */
    background: rgba(148,163,184,0.75);
    box-shadow: 0 0 0 4px rgba(148,163,184,0.12);

    flex: 0 0 auto;
}

/* Active page */
.nav-pill.is-active {
    border-color: rgba(56,189,248,0.55);
    background: rgba(56,189,248,0.10);
    color: var(--color-light);
}

.nav-pill.is-active:hover {
    border-color: rgba(56,189,248,0.75);
    background: rgba(56,189,248,0.16);
}

.nav-pill.is-active .nav-pill-dot {
    /* Active dot = blue */
    background: rgba(56,189,248,0.95);
    box-shadow: 0 0 0 4px rgba(56,189,248,0.18);
}

/* Optional: "accent but still uniform" for destructive actions like Logout */
.nav-pill.is-danger:hover {
    border-color: rgba(248,113,113,0.65);
    box-shadow: 0 12px 26px rgba(239,68,68,0.18);
}

/* =========================================================
   HARD NAV SAFETY NET (PRODUCTION FIX)
   If ANY global <a> styles are overriding your pills (purple links / underline),
   this forces ALL header actions to render as pills.
========================================================= */

.app-nav .app-nav-actions a,
.app-nav .app-nav-actions a:visited {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;

    /* ✅ NEW: uniform sizing across all header buttons */
    min-width: 150px !important;
    text-align: center !important;

    padding: 0.55rem 1rem !important;
    border-radius: 999px !important;

    border: 1px solid rgba(148,163,184,0.6) !important;
    background: rgba(2,6,23,0.18) !important;

    color: var(--color-muted) !important;
    text-decoration: none !important;

    cursor: pointer !important;
    backdrop-filter: blur(10px) !important;

    transition: transform var(--transition-fast),
                background var(--transition-fast),
                border-color var(--transition-fast),
                color var(--transition-fast),
                box-shadow var(--transition-fast) !important;
}

/* Hover pill behavior for ALL nav links */
.app-nav .app-nav-actions a:hover {
    transform: translateY(-1px) !important;
    background: rgba(15,23,42,0.85) !important;
    border-color: rgba(148,163,184,0.75) !important;
    color: var(--color-light) !important;
    box-shadow: 0 12px 26px rgba(15,23,42,0.65) !important;
}

/* Active pill behavior when the anchor has is-active */
.app-nav .app-nav-actions a.is-active,
.app-nav .app-nav-actions a.is-active:visited {
    border-color: rgba(56,189,248,0.55) !important;
    background: rgba(56,189,248,0.10) !important;
    color: var(--color-light) !important;
}

.app-nav .app-nav-actions a.is-active:hover {
    border-color: rgba(56,189,248,0.75) !important;
    background: rgba(56,189,248,0.16) !important;
}

/* Logout hover tint */
.app-nav .app-nav-actions a.is-danger:hover {
    border-color: rgba(248,113,113,0.65) !important;
    box-shadow: 0 12px 26px rgba(239,68,68,0.18) !important;
}

/* Dots stay correct inside nav links */
.app-nav .app-nav-actions a .nav-pill-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 999px !important;

    background: rgba(148,163,184,0.75) !important;
    box-shadow: 0 0 0 4px rgba(148,163,184,0.12) !important;

    flex: 0 0 auto !important;
}

.app-nav .app-nav-actions a.is-active .nav-pill-dot {
    background: rgba(56,189,248,0.95) !important;
    box-shadow: 0 0 0 4px rgba(56,189,248,0.18) !important;
}

/* Login page layout */

.login-grid {
    max-width: 1120px;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 2.75rem;
    align-items: center;
}

.login-hero {
    color: var(--color-light);
}

.login-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--color-muted);
    margin-bottom: 0.85rem;
}

.kicker-pill {
    width: 34px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #1d4ed8, #dc2626);
}

.login-title {
    font-size: clamp(2.2rem, 4vw, 2.85rem);
    line-height: 1.1;
    margin-bottom: 0.8rem;
}

.login-subtitle {
    max-width: 34rem;
    font-size: 0.98rem;
    line-height: 1.65;
    color: var(--color-muted);
}

/* Hero stats / badges */

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 1.85rem;
}

.hero-stat {
    padding: 0.85rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.45);
    background: radial-gradient(circle at 0% 0%, rgba(37,99,235,0.25), transparent),
                rgba(15,23,42,0.92);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--color-muted);
}

/* Login card */

.card {
    background: linear-gradient(
        145deg,
        rgba(15, 23, 42, 0.98),
        rgba(15, 23, 42, 0.96)
    );
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
    padding: 2.25rem 2.25rem 2rem;
    backdrop-filter: blur(22px);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: -60%;
    opacity: 0.16;
    background:
      conic-gradient(from 220deg,
        rgba(37,99,235,1),
        rgba(239,68,68,1),
        rgba(37,99,235,1)
      );
    mix-blend-mode: screen;
    filter: blur(32px);
}

.card-inner {
    position: relative;
    z-index: 1;
}

/* Tag pills in card */

.card-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.card-pill {
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.55);
    padding: 0.3rem 0.7rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-muted);
    background: rgba(15,23,42,0.94);
}

/* Form styles */

.form-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-subtitle {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 1.6rem;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    color: var(--color-muted);
}

.form-label span {
    font-weight: 500;
    color: var(--color-light);
}

.form-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.95);
    color: var(--color-light);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-fast), transform var(--transition-fast);
}

.form-input::placeholder {
    color: rgba(148,163,184,0.8);
}

.form-input:focus {
    border-color: rgba(59,130,246,0.9);
    box-shadow: 0 0 0 1px rgba(59,130,246,0.8);
    background: rgba(15,23,42,0.98);
    transform: translateY(-1px);
}

/* Error + flash messages */

.alert {
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.alert-danger {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(248,113,113,0.6);
    color: #fecaca;
}

.alert-success {
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(74,222,128,0.6);
    color: #bbf7d0;
}

/* Button */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.35rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-fast), opacity var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, #1d4ed8, #dc2626);
    color: #ffffff;
    box-shadow: 0 16px 30px rgba(30,64,175,0.55);
}

.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 18px 40px rgba(30,64,175,0.75);
}

.btn-primary:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 8px 20px rgba(30,64,175,0.55);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(148,163,184,0.6);
    color: var(--color-muted);
}

.btn-ghost:hover {
    background: rgba(15,23,42,0.85);
    color: var(--color-light);
}

/* Checkbox row */

.form-aux {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.35rem;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.form-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.form-checkbox {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(148,163,184,0.7);
    appearance: none;
    background: rgba(15,23,42,0.9);
    cursor: pointer;
    position: relative;
}

.form-checkbox:checked {
    background: linear-gradient(135deg, #1d4ed8, #dc2626);
    border-color: transparent;
}

.form-checkbox:checked::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: #ffffff;
}

/* Projects page */

.page-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2.25rem 1.5rem 2.5rem;
}

/* Map page: allow immersive content without changing other pages */
.map-page {
    width: 100%;
}

.map-full-bleed {
    width: 100%;
}

.map-full-bleed .arcgis-map-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.page-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 600;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--color-muted);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1.2rem;
}

.project-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: radial-gradient(circle at 0% 0%, rgba(37,99,235,0.2), transparent),
                rgba(15,23,42,0.96);
    padding: 1.1rem 1.1rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: transform var(--transition-med), box-shadow var(--transition-med),
                border-color var(--transition-med), background var(--transition-med);
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59,130,246,0.8);
    box-shadow: 0 18px 40px rgba(15,23,42,0.9);
    background: radial-gradient(circle at 0% 0%, rgba(37,99,235,0.3), transparent),
                rgba(15,23,42,0.98);
}

.project-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.project-name {
    font-size: 0.98rem;
    font-weight: 500;
}

.project-badge {
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    background: rgba(15,23,42,0.85);
    border: 1px solid rgba(148,163,184,0.6);
    color: var(--color-muted);
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    font-size: 0.78rem;
    color: var(--color-muted);
}

.project-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.project-footer {
    margin-top: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--color-muted);
}

.subtle-link {
    color: var(--color-muted);
    text-decoration: none;
    border-bottom: 1px dashed rgba(148,163,184,0.5);
    padding-bottom: 1px;
}

.subtle-link:hover {
    color: var(--color-light);
    border-bottom-style: solid;
}

/* Footer */

.app-footer {
    padding: 0.75rem 1.5rem 1.5rem;
    font-size: 0.75rem;
    color: var(--color-muted);
    text-align: center;
}

/* Responsive */

@media (max-width: 900px) {
    .login-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }

    .login-hero {
        text-align: center;
    }

    .hero-stats {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .card {
        padding: 1.7rem 1.4rem 1.5rem;
        border-radius: 18px;
    }

    .app-nav-inner {
        padding-inline: 0.9rem;
    }

    .page-container {
        padding-inline: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Table container (collapsed by default) */
/* Table container (collapsed by default) */
.arcgis-table-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 360px; /* FIXED: no PHP here */
    background: #0b1220;
    transition: transform 0.25s ease, opacity 0.2s ease;
    z-index: 5;
}

/* Hidden state */
.arcgis-table-wrap.is-collapsed {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Toggle button */
.arcgis-table-toggle {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.85);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.arcgis-table-toggle:hover {
    background: rgba(15,23,42,0.95);
}

/* ================= FULLSCREEN MAP MODE ================= */

.map-fullscreen-mode {
    position: relative;
    height: 100vh;
    overflow: hidden;
    --map-nav-height: 76px;
}

/* Map occupies the viewport minus nav so controls stay visible */
.map-stage {
    position: fixed;
    top: var(--map-nav-height);
    left: 0;
    right: 0;
    height: calc(100vh - var(--map-nav-height));
    z-index: 1;
}

/* Ensure ArcGIS card fills container */
.map-stage .arcgis-map-card {
    height: 100% !important;
    border-radius: 0;
    border: none;
}

/* Let nav float above the map */
.map-fullscreen-mode .app-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

/* Project info glass panel */
.map-project-overlay {
    position: absolute;
    top: calc(72px + 1rem); /* below nav */
    left: 1.5rem;
    z-index: 20;
    max-width: 520px;

    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);

    background: linear-gradient(
        145deg,
        rgba(15, 23, 42, 0.95),
        rgba(15, 23, 42, 0.85)
    );

    border: 1px solid var(--color-border);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-soft);
}

/* Tighten typography for overlays */
.map-project-overlay .page-title {
    font-size: 1.35rem;
}

.map-project-overlay .page-subtitle {
    font-size: 0.82rem;
    line-height: 1.5;
}

/* Table drawer already exists — just ensure correct stacking */
.map-fullscreen-mode .arcgis-table-wrap {
    z-index: 30;
}

/* Table toggle floats over the map cleanly */
.map-fullscreen-mode .arcgis-table-toggle {
    z-index: 40;
}
