/* Schema Design System - Blue, Black & Red */
/* Modern, vibrant design language inspired by Milkrun */

:root {
    /* Override Bootstrap's primary with Schema blue */
    --bs-primary: #0055ff !important;
    --bs-primary-rgb: 0, 85, 255 !important;
    --bs-link-color: #0055ff;
    --bs-link-hover-color: #0044cc;

    /* Primary Palette - Vibrant Blue (Milkrun-style) */
    --blue-50: #e6f0ff;
    --blue-100: #cce0ff;
    --blue-200: #99c2ff;
    --blue-300: #66a3ff;
    --blue-400: #3385ff;
    --blue-500: #0066ff;
    --blue-600: #0055ff;
    --blue-700: #0044cc;
    --blue-800: #003399;
    --blue-900: #002266;

    /* Accent Palette - Red (for highlights/warnings) */
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-200: #fecaca;
    --red-300: #fca5a5;
    --red-400: #f87171;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;

    /* Neutrals - Clean greys */
    --black: #0a0a0a;
    --grey-900: #171717;
    --grey-800: #262626;
    --grey-700: #404040;
    --grey-600: #525252;
    --grey-500: #737373;
    --grey-400: #a3a3a3;
    --grey-300: #d4d4d4;
    --grey-200: #e5e5e5;
    --grey-100: #f5f5f5;
    --grey-50: #fafafa;
    --white: #ffffff;

    /* Semantic colors */
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: var(--red-500);
    --warning-light: var(--red-100);
    --danger: var(--red-600);
    --danger-light: var(--red-100);
    --info: var(--blue-500);
    --info-light: var(--blue-100);

    /* Theme Colors - Blue primary, Red accent */
    --primary: var(--blue-600);
    --primary-light: var(--blue-100);
    --primary-dark: var(--blue-800);
    --accent: var(--red-500);
    --accent-light: var(--red-100);
    --accent-dark: var(--red-700);

    /* UI Colors - clean monochrome with blue accents */
    --bg-primary: var(--white);
    --bg-secondary: var(--grey-50);
    --bg-tertiary: var(--grey-100);
    --bg-accent: var(--blue-50);
    --text-primary: var(--grey-900);
    --text-secondary: var(--grey-600);
    --text-muted: var(--grey-400);
    --border-color: var(--grey-200);
    --border-light: var(--grey-100);

    /* Panels */
    --panel-bg: var(--white);
    --panel-border: var(--grey-200);

    /* Inputs */
    --input-bg: var(--white);
    --input-border: var(--grey-300);
    --input-focus: var(--blue-500);

    /* Shadows - subtle, modern */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Radius - modern rounded corners */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: 200ms ease;
    --transition-fast: 100ms ease;

    /* Legacy compatibility */
    --primary-color: var(--text-primary);
    --secondary-color: var(--text-secondary);
    --schema-cyan: var(--blue-500);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: var(--grey-900);
    --bg-secondary: var(--grey-800);
    --bg-tertiary: var(--grey-700);
    --bg-accent: rgba(59, 130, 246, 0.1);
    --text-primary: var(--grey-50);
    --text-secondary: var(--grey-400);
    --text-muted: var(--grey-500);
    --border-color: var(--grey-700);
    --border-light: var(--grey-800);
    --panel-bg: var(--grey-800);
    --panel-border: var(--grey-700);
    --input-bg: var(--grey-800);
    --input-border: var(--grey-600);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    margin: 0;
    transition: background var(--transition), color var(--transition);
}

/* Typography - Black/Grey focused */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.5em;
}

h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9375rem; }
h6 { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }

p { margin: 0 0 1em; }

/* Navigation */
.schema-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.schema-nav-brand { text-decoration: none; }
.schema-nav-logo { height: 28px; }

/* Schema Logo - Blue Icon */
.schema-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schema-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--blue-600) !important;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0, 85, 255, 0.3);
}

.schema-logo-icon svg {
    color: white !important;
    stroke: white !important;
}

.schema-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--grey-900);
    letter-spacing: -0.02em;
}

[data-theme="dark"] .schema-logo-text {
    color: var(--white);
}

.schema-nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.schema-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.schema-nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.schema-nav-link.active,
.schema-nav-link.active:focus,
.schema-nav-link.active:visited,
a.schema-nav-link.active {
    background: var(--blue-600) !important;
    color: white !important;
    box-shadow: 0 2px 12px rgba(0, 85, 255, 0.4) !important;
    border-color: transparent !important;
}

.schema-nav-link.active:hover,
a.schema-nav-link.active:hover {
    background: var(--blue-700) !important;
    color: white !important;
}

.schema-nav-link.active svg,
a.schema-nav-link.active svg {
    color: white !important;
    stroke: white !important;
}

.schema-nav-actions { display: flex; gap: 0.5rem; }

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 1rem; }

/* Panels */
.search-panel,
.property-info-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: all var(--transition);
    cursor: pointer;
}

.btn-primary {
    background: var(--blue-500);
    border: 1px solid var(--blue-500);
    color: white;
}

.btn-primary:hover {
    background: var(--blue-600);
    border-color: var(--blue-600);
    color: white;
}

.btn-secondary {
    background: var(--grey-900);
    border: 1px solid var(--grey-900);
    color: white;
}

.btn-secondary:hover {
    background: var(--black);
    border-color: var(--black);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--blue-500);
    color: var(--blue-600);
}

.btn-outline-primary:hover {
    background: var(--blue-500);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    border: 1px solid var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    border: 1px solid var(--danger);
    color: white;
}

/* Forms */
.form-control,
.form-select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: border-color var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px var(--blue-100);
}

.form-control::placeholder { color: var(--text-muted); }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    border: 1.5px solid var(--grey-400);
    border-radius: 3px;
}

.form-check-input:checked {
    background: var(--blue-500);
    border-color: var(--blue-500);
}

.form-check-label {
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Range Sliders - Blue accent */
input[type="range"] {
    accent-color: var(--blue-500);
}

input[type="range"]::-webkit-slider-thumb {
    background: var(--blue-500);
}

input[type="range"]::-moz-range-thumb {
    background: var(--blue-500);
}

/* Active/Selected states with blue */
.selected, .active-item {
    border-color: var(--blue-500) !important;
    box-shadow: 0 0 0 2px var(--blue-100);
}

/* Layer Controls */
.layer-control-section { background: transparent; }
.layer-control-section h6 { color: var(--text-primary); }

/* Metrics */
.metric-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-value.positive { color: var(--success); }
.metric-value.negative { color: var(--danger); }

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Badges */
.badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.bg-primary { background: var(--blue-500) !important; color: white !important; }
.bg-secondary { background: var(--grey-800) !important; color: white !important; }
.bg-info { background: var(--blue-50) !important; color: var(--blue-700) !important; }
.bg-success { background: var(--success-light) !important; color: #16a34a !important; }
.bg-warning { background: var(--red-50) !important; color: var(--red-700) !important; }
.bg-danger { background: var(--danger-light) !important; color: #dc2626 !important; }
.bg-dark { background: var(--grey-900) !important; color: white !important; }
.bg-light { background: var(--grey-100) !important; color: var(--grey-900) !important; }

/* Loading */
.spinner-border { color: var(--blue-500); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--grey-400); }

[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--grey-600); }

/* Map */
.zoom-indicator {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.75);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: white;
    z-index: 1000;
}

.zoom-indicator span { color: var(--blue-400); font-weight: 600; }

.layer-status {
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.layer-status.active { background: var(--success-light); color: #16a34a; }
.layer-status.zoom-required { background: var(--danger-light); color: #dc2626; }

/* Leaflet */
.leaflet-container { font-family: var(--font-sans); }
.leaflet-popup-content-wrapper {
    background: var(--panel-bg);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.leaflet-popup-tip { background: var(--panel-bg); }

[data-theme="dark"] .leaflet-container { background: var(--grey-900); }
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip { background: var(--grey-800); }

/* Tables */
.table { color: var(--text-primary); }
.table thead th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.table-striped tbody tr:nth-of-type(odd) { background: var(--bg-secondary); }

/* Modals */
.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-footer { border-top: 1px solid var(--border-color); }

/* Alerts */
.alert { border-radius: var(--radius-md); }
.alert-info { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.alert-success { background: var(--success-light); border-color: #bbf7d0; color: #166534; }
.alert-warning { background: var(--red-50); border-color: var(--red-200); color: var(--red-700); }
.alert-danger { background: var(--danger-light); border-color: #fecaca; color: #991b1b; }

[data-theme="dark"] .alert-info { background: rgba(59, 130, 246, 0.15); border-color: var(--blue-500); color: #93c5fd; }
[data-theme="dark"] .alert-success { background: rgba(34, 197, 94, 0.15); border-color: var(--success); color: #86efac; }
[data-theme="dark"] .alert-warning { background: rgba(234, 179, 8, 0.15); border-color: #eab308; color: #fde047; }
[data-theme="dark"] .alert-danger { background: rgba(239, 68, 68, 0.15); border-color: var(--danger); color: #fca5a5; }

/* Responsive */
@media (max-width: 768px) {
    .schema-nav { height: 52px; padding: 0 1rem; }
    .schema-nav-logo { height: 24px; }
    .schema-nav-link span { display: none; }
    .schema-nav-link { padding: 0.5rem; }
}

/* ============================================
   Bootstrap Overrides - Blue, Black & Red Theme
   ============================================ */

/* Primary buttons - Vibrant Blue */
.btn-primary {
    background-color: var(--blue-600) !important;
    border-color: var(--blue-600) !important;
    box-shadow: 0 2px 8px rgba(0, 85, 255, 0.3) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--blue-700) !important;
    border-color: var(--blue-700) !important;
    box-shadow: 0 4px 16px rgba(0, 85, 255, 0.4) !important;
}

.btn-outline-primary {
    color: var(--blue-600) !important;
    border-color: var(--blue-600) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--blue-600) !important;
    border-color: var(--blue-600) !important;
    color: white !important;
}

/* Secondary buttons - Black */
.btn-secondary {
    background-color: var(--grey-900) !important;
    border-color: var(--grey-900) !important;
}

.btn-secondary:hover {
    background-color: var(--black) !important;
    border-color: var(--black) !important;
}

/* Danger/Warning buttons - Red */
.btn-danger,
.btn-warning {
    background-color: var(--red-600) !important;
    border-color: var(--red-600) !important;
    color: white !important;
}

.btn-danger:hover,
.btn-warning:hover {
    background-color: var(--red-700) !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4) !important;
}

/* Override any Bootstrap .active class styling */
.nav-link.active,
.nav-pills .nav-link.active,
.nav-tabs .nav-link.active,
a.active {
    background-color: var(--blue-600) !important;
    color: white !important;
    border-color: var(--blue-600) !important;
}

/* Form focus states - Blue */
.form-control:focus,
.form-select:focus {
    border-color: var(--blue-500) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 85, 255, 0.25) !important;
}

/* Form check inputs - Blue */
.form-check-input:checked {
    background-color: var(--blue-600) !important;
    border-color: var(--blue-600) !important;
}

.form-check-input:focus {
    border-color: var(--blue-500) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 85, 255, 0.25) !important;
}

/* Links - Blue */
a {
    color: var(--blue-600);
}

a:hover {
    color: var(--blue-700);
}

/* Red accent highlights */
.text-accent,
.text-danger {
    color: var(--red-600) !important;
}

.bg-accent {
    background-color: var(--red-600) !important;
}
