/* =========================================
   PROPERTY INTELLIGENCE PLATFORM - SMART THEME
   ========================================= */

:root {
    /* --- Brand Palette (Smart Teal & Tech Blue) --- */
    --brand-dark: #0f3f4c;
    /* Deep Teal/Slate for Sidebar */
    --brand-dark-alt: #164e5b;
    /* Lighter mix for hover/active */

    --brand-primary: #0ea5e9;
    /* Tech Blue (Primary Actions) */
    --brand-primary-hover: #0284c7;

    --brand-teal: #14b8a6;
    /* Vibrant Teal (Success/Brand) */
    --brand-accent: #f59e0b;
    /* Amber (Attention/Gold Coast Sun) */

    --success: #10b981;
    /* Emerald */
    --danger: #ef4444;
    /* Red */
    --warning: #f59e0b;
    /* Amber */

    /* --- Surface & Backgrounds --- */
    --bg-app: #f1f5f9;
    /* Slate 100 - Main Background */
    --bg-panel: #ffffff;
    /* Pure White - Cards */
    --bg-sidebar: #0f172a;
    /* Slate 900 - Dark Sidebar container */
    --bg-header: rgba(255, 255, 255, 0.90);
    /* Glassy Header */

    --surface-alt: #f8fafc;
    /* Slate 50 - Table headers/Alt rows */
    --surface-hover: #e2e8f0;
    /* Slate 200 - Hover states */

    /* --- Text Colors (High Contrast) --- */
    --text-main: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --text-inverse: #ffffff;
    /* White */

    /* --- Borders & Depth --- */
    --border-subtle: #e2e8f0;
    --border-light: #cbd5e1;
    --border-focus: #0ea5e9;
    /* Focus Ring */

    /* Smart Shadows (Diffuse & Colored) */
    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
    --shadow-blue: 0 4px 14px 0 rgba(14, 165, 233, 0.25);

    /* --- Dimensions & Radius --- */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* =========================================
   RESET & BASE
   ========================================= */
/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   APP LAYOUT
   ========================================= */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar content";
    height: 100vh;
    width: 100vw;
}

/* --- Sidebar (Premium Dark) --- */
.app-sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, var(--brand-dark) 0%, #0f172a 100%);
    color: var(--text-inverse);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 20;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.1);
}

.brand-logo {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.sidebar-section-header {
    padding: 24px 18px 8px 18px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.05em;
    pointer-events: none;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.2) 0%, rgba(14, 165, 233, 0.05) 100%);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #38bdf8;
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px #38bdf8;
}

.nav-icon {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    display: flex;
    /* Ensure SVG centers */
    align-items: center;
    justify-content: center;
    color: #64748b;
    /* Default muted color */
    transition: color 0.2s ease;
}

.nav-item:hover .nav-icon {
    color: #f8fafc;
}

.nav-item.active .nav-icon {
    color: #38bdf8;
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.6));
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3));
}

/* --- Header (Glassy) --- */
.app-header {
    grid-area: header;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.global-search {
    position: relative;
    width: 480px;
}

.search-bar {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border-radius: 30px;
    /* Pill shape */
    border: 1px solid transparent;
    background: #f1f5f9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    color: var(--text-main);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-bar:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 8px 20px -4px rgba(14, 165, 233, 0.25), inset 0 0 0 1px var(--brand-primary);
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: color 0.3s;
}

.search-bar:focus+.search-icon {
    color: var(--brand-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* --- Main Content --- */
.app-content {
    grid-area: content;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-app);
}

/* =========================================
   VIEWS & COMPONENTS
   ========================================= */
.view-section {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    padding: 32px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.view-section.active {
    opacity: 1;
    transform: translateY(0);
    display: flex;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Staggered Animation for Grid Items */
.dashboard-grid>* {
    animation: slideUpFade 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.dashboard-grid>*:nth-child(1) {
    animation-delay: 0.1s;
}

.dashboard-grid>*:nth-child(2) {
    animation-delay: 0.15s;
}

.dashboard-grid>*:nth-child(3) {
    animation-delay: 0.2s;
}

.dashboard-grid>*:nth-child(4) {
    animation-delay: 0.25s;
}

.dashboard-grid>*:nth-child(5) {
    animation-delay: 0.3s;
}

.stat-card {
    background: var(--bg-panel);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(14, 165, 233, 0.3);
}

/* Decorative background circle for cards */
.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0) 70%);
    pointer-events: none;
    transition: transform 0.5s ease;
}

.stat-card:hover::after {
    transform: scale(1.5);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, var(--text-main) 0%, var(--text-secondary) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}

/* Quick Access Card Styles */
.quick-access-card {
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
}

.quick-access-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px -8px rgba(14, 165, 233, 0.2);
    border-color: var(--brand-primary);
}

.quick-access-card .stat-value {
    font-size: 1.1rem;
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--text-main);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: #fff;
    border-color: var(--border-light);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    border-color: var(--brand-primary);
    background-color: #f0f9ff;
    color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.15);
}

.btn-outline.active {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    box-shadow: inset 0 2px 4px rgba(14, 165, 233, 0.05);
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: var(--surface-alt);
}

.file-drop-zone:hover {
    border-color: var(--brand-primary);
    background: #fff;
    box-shadow: var(--shadow-md);
}

/* --- Explorer -- */
.explorer-layout {
    display: flex;
    height: 100%;
    gap: 24px;
}

.explorer-sidebar {
    width: 320px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.explorer-sidebar::-webkit-scrollbar {
    width: 6px;
}

.explorer-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.explorer-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-light);
    border-radius: 10px;
}

.explorer-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

.explorer-main {
    flex: 1;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* --- Tables (Smart) --- */
.property-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}



.property-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
    color: var(--text-secondary);
}

.property-table tr:hover td {
    background-color: rgba(241, 245, 249, 0.8);
}

.property-table th {
    text-align: left;
    padding: 14px 16px;
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

/* Compact Mode */
.property-table.compact-mode th {
    padding: 8px 12px;
    font-size: 0.75rem;
}

.property-table.compact-mode td {
    padding: 8px 12px;
    font-size: 0.85rem;
}

/* Specific Columns */
.address-content {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.lot-plan-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.8rem;
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* Status Badges (Smart) */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1;
}

.status-badge::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-P {
    /* Active/Primary */
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.status-P::before {
    background: #10b981;
    animation: pulse 2s infinite;
}

.status-A {
    /* Amber/Warning */
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.status-A::before {
    background: #f59e0b;
}

.status-C {
    /* Cancelled/Inactive */
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.status-C::before {
    background: #3b82f6;
}

/* Location Cell */
.coords-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Map Button */
.map-link-btn {
    display: inline-flex;
    padding: 4px 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.map-link-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: #fff;
}

/* --- Scrollbars (Webkit) --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =========================================
   COMPACT MODE (Table)
   ========================================= */
.compact-mode td,
.compact-mode th {
    padding: 6px 12px;
}

.compact-mode .address-content {
    font-size: 0.85rem;
}

.compact-mode .lot-plan-container {
    padding: 1px 4px;
    font-size: 0.75rem;
}

.compact-mode .status-badge {
    padding: 2px 8px;
    font-size: 0.7rem;
}

.compact-mode .map-link-btn {
    padding: 2px 6px;
    font-size: 0.7rem;
}

/* =========================================
   EXPLORER SPECIFICS
   ========================================= */

/* --- Custom Suburb List --- */
.custom-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Custom Scrollbar for list */
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.custom-list-container::-webkit-scrollbar {
    width: 6px;
}

.custom-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.custom-list-container::-webkit-scrollbar-thumb {
    background-color: var(--border-light);
    border-radius: 10px;
}

.custom-list-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

.empty-list-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.list-header {
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 8px;
    margin-bottom: 4px;
}

.suburb-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.suburb-item:hover {
    background-color: var(--surface-hover);
}

.suburb-item.active {
    background-color: #f0f9ff;
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.suburb-item.active .suburb-name {
    color: var(--brand-primary);
    font-weight: 600;
}

.suburb-name {
    font-size: 0.9rem;
    color: var(--text-main);
}

.suburb-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.suburb-item.active .suburb-count {
    background: rgba(14, 165, 233, 0.1);
    color: var(--brand-primary);
}

#streetsContainer {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    min-height: 0;
}

#street-scroll-sentinel {
    height: 20px;
    width: 100%;
}

.street-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    animation: slideUpFade 0.3s ease-out;
}

.street-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.street-card.expanded {
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary);
    transform: none;
    /* Prevent hover lift when expanded to keep table stable */
}

.street-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: linear-gradient(to right, #ffffff, #f8fafc);
    transition: background 0.2s;
}

.street-header:hover {
    background: #f1f5f9;
}

.street-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.property-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface-alt);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.street-details {
    border-top: 1px solid var(--border-subtle);
    background: #fff;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top;
    max-height: 60vh;
    overflow-y: auto;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: scaleY(0.95);
        height: 0;
    }

    to {
        opacity: 1;
        transform: scaleY(1);
        height: auto;
    }
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--brand-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.toggle-btn:hover {
    text-decoration: underline;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Global Notification */
.notification {
    background: var(--bg-panel);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

/* Loading Bar */
.progress-container {
    height: 6px;
    background: var(--border-subtle);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar {
    height: 100%;
    background: var(--brand-primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* =========================================
   MAP & POPUP STYLES
   ========================================= */

/* --- Custom Map Controls (Zoom) --- */
.leaflet-bar {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
}

.leaflet-bar a {
    background-color: #fff !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    color: var(--text-main) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    transition: all 0.2s !important;
}

.leaflet-bar a:hover {
    background-color: #f8fafc !important;
    color: var(--brand-primary) !important;
}

.leaflet-bar a:last-child {
    border-bottom: none !important;
}

/* --- Cluster Styles --- */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(14, 165, 233, 0.6);
    /* Brand Blue Transparent */
}

.marker-cluster div {
    background-color: rgba(14, 165, 233, 0.9);
    /* Brand Blue Solid */
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.marker-cluster:hover div {
    transform: scale(1.1);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--brand-primary);
}

.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 280px !important;
    font-family: inherit;
}

.popup-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.popup-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 2px;
}

.popup-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.popup-body {
    padding: 12px 16px;
    background: #fff;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.data-item {
    display: flex;
    flex-direction: column;
}

.data-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.data-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}