/* Planning Support Design System */

:root {
    /* Typography */
    --font-sans: "Work Sans", system-ui, -apple-system, sans-serif;
    --font-display: "Work Sans", system-ui, -apple-system, sans-serif;

    /* Brand Colors - Indigo & Emerald for growth/support/trust */
    --brand-primary: #6366f1;
    /* Indigo 500 */
    --brand-primary-hover: #4f46e5;
    /* Indigo 600 */
    --brand-secondary: #f97316;
    /* Existing accent for contrast */
    --brand-accent: #10b981;
    /* Emerald 500 - Growth */

    /* Neutral Palette */
    --bg-page: #f8fafc;
    /* Slate 50 */
    --bg-panel: #ffffff;
    --bg-primary: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --bg-glass: rgba(255, 255, 255, 0.7);

    --text-primary: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-tertiary: #94a3b8;
    /* Slate 400 */
    --text-muted: #64748b;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    --border-glass: rgba(255, 255, 255, 0.4);

    /* Semantic Colors */
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-error: #ef4444;
    --color-error-bg: #fef2f2;

    /* Legacy Compat */
    --success: var(--color-success);
    --success-bg: var(--color-success-bg);
    --warning: var(--color-warning);
    --warning-bg: var(--color-warning-bg);
    --danger: var(--color-error);
    --danger-bg: var(--color-error-bg);

    --border-focus: var(--brand-primary);
    --ring-focus: rgba(99, 102, 241, 0.2);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-float: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Spacing */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset & Typography --- */
html {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-page);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.05), transparent 50%),
        radial-gradient(circle at 85% 15%, rgba(16, 185, 129, 0.08), transparent 45%),
        var(--bg-page);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    font-family: var(--font-display);
}

p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

a {
    color: var(--brand-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-primary-hover);
}

/* --- Layout --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    flex: 1;
    padding: 2rem 0 4rem;
}

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

.eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--brand-accent);
}

.cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    background: var(--brand-primary);
    color: #fff;
    border: 1px solid transparent;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 25px -15px rgba(15, 118, 110, 0.8);
    color: #fff;
}

.cta.secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.cta.secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem 1.5rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    align-self: end;
}

.results-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.result-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    animation: floatIn 0.6s ease both;
    z-index: 0;
}

.result-card::after {
    content: "";
    position: absolute;
    inset: auto -40% -60% 40%;
    height: 120px;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.12), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.result-card>* {
    position: relative;
    z-index: 1;
}

.result-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.result-card__header>div {
    min-width: 0;
}

.result-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.result-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.result-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem 1rem;
}

.result-facts span {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}

.result-facts strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.result-proposal {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.doc-list {
    display: grid;
    gap: 0.75rem;
}

.doc-item {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Header & Nav --- */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 0;
}

.nav-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-brand {
    font-weight: 800;
    font-size: 1.125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-display);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    margin-right: auto;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--brand-primary);
    background: #eff6ff;
}

/* --- Search Input in Nav --- */
.nav-search {
    position: relative;
    flex: 0 1 260px;
    max-width: 320px;
}

.nav-search input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-panel);
    font-size: 0.9rem;
    width: 100%;
    min-width: 0;
    transition: all var(--transition-fast);
}

.nav-search input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--ring-focus);
}

.nav-search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

/* --- Panels & Cards --- */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.panel-body {
    padding: 1.5rem;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: #f8fafc;
}

/* --- Hero Section --- */
.hero-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    background: linear-gradient(to bottom right, #f8fafc, #fff);
    border: 1px solid var(--border-subtle);
    margin-bottom: 2rem;
}

.hero-banner {
    text-align: center;
    margin-bottom: 5rem;
    padding-top: 3rem;
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.03), transparent);
    border-radius: 0 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.hero-content {
    margin-bottom: 2rem;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.cta-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* --- Map Section --- */
.map-container-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
}

#authorities-map {
    width: 100%;
    height: 100%;
}

.map-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}

.map-legend {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 0.7rem;
    z-index: 10;
}

.legend-scale {
    display: flex;
    gap: 2px;
}

.legend-scale span {
    width: 20px;
    height: 10px;
    display: inline-block;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--text-secondary);
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- Steps Section --- */
.steps-section {
    margin-bottom: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.step-card {
    background: white;
    padding: 2.5rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.step-number {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    display: inline-block;
}

.step-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
}

.step-icon {
    font-size: 2.5rem;
    margin-bottom: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 20px;
    transition: transform var(--transition-smooth);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.step-card:hover .step-icon {
    transform: scale(1.1) rotate(-3deg);
}

/* Step Variants */
.step-find {
    border-bottom: 4px solid var(--brand-primary);
}

.step-find .step-number {
    background: #eff6ff;
    color: var(--brand-primary);
}

.step-find .step-icon {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: var(--brand-primary);
}

.step-find .step-title {
    color: var(--brand-primary);
}

.step-review {
    border-bottom: 4px solid #8b5cf6;
}

.step-review .step-number {
    background: #f5f3ff;
    color: #8b5cf6;
}

.step-review .step-icon {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    color: #8b5cf6;
}

.step-review .step-title {
    color: #7c3aed;
}

.step-act {
    border-bottom: 4px solid var(--brand-success);
}

.step-act .step-number {
    background: #ecfdf5;
    color: var(--brand-success);
}

.step-act .step-icon {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: var(--brand-success);
}

.step-act .step-title {
    color: #059669;
}

.step-title {
    font-weight: 800;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* --- Forms & Inputs --- */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.input-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--ring-focus);
}

/* Button Styles */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: none;
}

.button-primary {
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.button-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.4);
    color: white;
}

.button-outline {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.button-outline:hover {
    background: #f8fafc;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.button-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn {
    /* Legacy alias */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: #e2e8f0;
}


/* Modern Tables */
.table-wrapper {
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    white-space: nowrap;
    /* Prevent messy wrapping */
}

thead th {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    /* Sticky header */
    top: 0;
    z-index: 10;
}

tbody tr {
    border-bottom: 1px solid var(--bg-secondary);
    transition: background-color 0.15s ease;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f8fafc;
}

td {
    padding: 0.5rem 0.75rem;
    /* Reduced padding */
    vertical-align: top;
    color: var(--text-secondary);
}

/* ... */

/* Proposal Text Column - Allow wrapping */
td:last-child,
td.proposal-cell {
    white-space: normal;
    min-width: 200px;
    /* Reduced from 300px */
    max-width: 400px;
    /* Reduced from 500px */
}

/* AI Summary Box */
.ai-summary {
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-size: 0.85rem;
    color: #0369a1;
    position: relative;
}

.ai-summary-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #0284c7;
    margin-bottom: 0.25rem;
}

.ai-summary-header svg {
    width: 12px;
    height: 12px;
}

/* Responsive Tables (Card View on Mobile) */
@media (max-width: 768px) {
    .table-wrapper {
        border: none;
        box-shadow: none;
        background: none;
    }

    .table-wrapper table {
        border-collapse: separate;
        border-spacing: 0 1rem;
        /* Space between cards */
    }

    .table-wrapper thead {
        display: none;
        /* Hide headers */
    }

    .table-wrapper tbody {
        display: block;
        width: 100%;
    }

    .table-wrapper tr {
        display: block;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        margin-bottom: 1rem;
        padding: 1rem;
        position: relative;
        box-shadow: var(--shadow-sm);
    }

    .table-wrapper td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.5rem 0;
        border: none;
        text-align: right;
        font-size: 0.9rem;
    }

    .table-wrapper td::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        width: 100%;
    }

    .table-wrapper td,
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.25rem 0;
        border: none;
        text-align: right;
        font-size: 0.9rem;
    }

    .table-wrapper td::before,
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--text-tertiary);
        text-align: left;
    }

    /* Specific tweaks for better card layout */
    .table-wrapper td[data-label="Proposal"] {
        display: block;
        text-align: left;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-subtle);
    }

    .table-wrapper td[data-label="Proposal"]::before {
        display: block;
        margin-bottom: 0.25rem;
    }
}

/* Badges & Pills */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
}

.badge-major {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
}

.badge-major-type {
    background-color: #fce7f3;
    /* pink-100 */
    color: #db2777;
    /* pink-600 */
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

/* --- Scraper Terminal --- */
.terminal-window {
    background: #1e293b;
    /* Dark Slate */
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
}

.terminal-header {
    background: #334155;
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red {
    background: #ef4444;
}

.terminal-dot.yellow {
    background: #f59e0b;
}

.terminal-dot.green {
    background: #10b981;
}

.terminal-body {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}

.terminal-line {
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 0.25rem;
    white-space: pre-wrap;
}

.terminal-line:last-child {
    border-bottom: none;
}

/* --- Grid & Utils --- */
.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stack-h {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    /* Ensure buttons wrap on small screens */
}

/* Mobile Nav Adjustments */
@media (max-width: 768px) {
    .site-header {
        padding: 0.5rem 0;
        /* Compact padding */
    }

    .nav-flex {
        gap: 0.5rem;
        /* Reduced gap */
        flex-direction: column;
        align-items: stretch;
        /* Full width */
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        margin-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll */
    }

    .nav-search {
        width: 100%;
        flex: none;
        /* Reset flex-basis/growth */
        max-width: none;
    }

    .nav-search input {
        width: 100%;
        padding: 0.6rem 1rem 0.6rem 2.2rem;
        font-size: 16px;
        /* Prevent iOS zoom */
        margin: 0;
    }

    .nav-search-icon {
        font-size: 0.85rem;
        left: 0.75rem;
    }
}

@media (max-width: 640px) {
    .hero-section {
        padding: 1.5rem;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        /* Increased gap to prevent overlap */
        display: flex;
        /* Switch to flex column for better control */
        flex-direction: column;
    }

    .stat-card {
        margin-bottom: 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .stack-h {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-group {
        flex-direction: column;
    }

    .actions-row {
        flex-direction: column;
    }

    /* Fixes for Mobile Regression */
    .hero-title-large {
        font-size: 2.25rem;
        line-height: 1.2;
    }

    .hero-banner {
        padding-top: 2rem;
        margin-bottom: 3rem;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .hero-map-container {
        min-height: 350px;
        height: 50vh;
    }

    .hero-input-group {
        flex-direction: column;
        border-radius: var(--radius-lg);
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .hero-input {
        text-align: center;
        padding: 0.5rem;
        width: 100%;
    }

    .hero-btn {
        width: 100%;
        margin-top: 0;
    }

    .actions-row .btn {
        width: 100%;
    }
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-cols-2 {
        grid-template-columns: 1fr 1fr;
    }
}

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

.text-right {
    text-align: right;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: auto;
}

.list-group {
    display: flex;
    flex-direction: column;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    transition: background-color 0.15s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: #f8fafc;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: var(--radius-sm);
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--brand-primary);
}

.list-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.list-item-name {
    font-weight: 500;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Auth Pages --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
}

.auth-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.error-banner {
    background: var(--color-error-bg);
    color: var(--color-error);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-error);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.nav-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.nav-user .nav-link {
    padding-bottom: 0;
}

/* --- Dropdown Navigation --- */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropbtn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.nav-dropbtn:hover,
.nav-dropdown:hover .nav-dropbtn {
    color: var(--brand-primary);
    background: #eff6ff;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-panel);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    top: 100%;
    right: 0;
    margin-top: 0.4rem;
    animation: fadeIn 0.2s ease-out;
}

.nav-dropdown-content::before {
    content: "";
    position: absolute;
    top: -0.4rem;
    left: 0;
    right: 0;
    height: 0.4rem;
}

/* Align Browse left, User right */
.nav-dropdown:first-child .nav-dropdown-content {
    right: auto;
    left: 0;
}

.nav-dropdown:hover .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background-color var(--transition-fast);
}

.nav-dropdown-content a:hover {
    background-color: var(--bg-secondary);
    color: var(--brand-primary);
}

.dropdown-header {
    display: block;
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.dropdown-header strong {
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-subtle);
    margin: 0.25rem 0;
}

/* User specifics */
.user-btn {
    font-weight: 600;
    color: var(--text-primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Register Button (Nav) */
.nav-button {
    background-color: var(--brand-primary);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: background-color var(--transition-fast);
}

.nav-button:hover {
    background-color: var(--brand-primary-hover);
    box-shadow: var(--shadow-sm);
}

/* --- New Hero Styles --- */

.hero-title-large {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #0f172a, #334155);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}

.hero-input-group {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-subtle);
    transition: box-shadow 0.2s ease;
}

.hero-input-group:focus-within {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--brand-primary);
}

.hero-input {
    flex: 1;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 1.125rem;
    outline: none;
}

.hero-btn {
    padding: 0.75rem 2rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.hero-map-container {
    height: 60vh;
    /* Shorter than full atlas */
    min-height: 500px;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    background: #dbeafe;
    box-shadow: var(--shadow-md);
}

.hero-secondary-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.hero-secondary-link:hover {
    color: var(--brand-primary);
}