/* Enhanced Modern CSS for Cincinnati Steel Engravings */
:root {
    /* Joy & Curiosity Color System - Historical Elegance */
    --color-primary: #D4AF37; /* Warm gold - historical elegance */
    --color-primary-dark: #B8941F;
    --color-primary-light: #E8C865;
    --color-secondary: #8B4513; /* Warm brown - aged leather */
    --color-accent: #CD853F; /* Warm amber - aged brass */
    --color-success: #4F7942; /* Deep forest green - "extant" */
    --color-warning: #CD853F; /* Warm amber - "altered" */
    --color-error: #8B4513; /* Warm brown - "razed" */
    --color-info: #5F7A8A; /* Muted blue-gray */
    
    /* Historical Status Colors */
    --color-extant: #4F7942; /* Deep forest green */
    --color-razed: #8B4513; /* Warm brown */
    --color-altered: #CD853F; /* Warm amber */
    
    /* Background System */
    --color-background: #0a0a0a;
    --color-surface: #1a1a1a;
    --color-surface-variant: #242424;
    --color-surface-elevated: #2a2a2a;
    --color-surface-glass: rgba(26, 26, 26, 0.8);
    --color-surface-hover: rgba(255, 255, 255, 0.05);
    --color-surface-active: rgba(255, 255, 255, 0.1);
    
    /* Text System */
    --color-text: #ffffff;
    --color-text-secondary: #b3b3b3;
    --color-text-tertiary: #808080;
    --color-text-disabled: #666666;
    --color-text-inverse: #000000;
    
    /* Border System */
    --color-border: #333333;
    --color-border-light: #404040;
    --color-border-focus: var(--color-primary);
    
    /* Typography System */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-display: 'Playfair Display', Georgia, serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    /* Type Scale */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing System */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.625rem;
    --space-4: 0.875rem;
    --space-5: 1rem;
    --space-6: 1.25rem;
    --space-8: 1.5rem;
    --space-10: 2rem;
    --space-12: 2.5rem;
    --space-16: 3rem;
    
    /* Border Radius System */
    --radius-xs: 0.125rem;
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadow System */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    
    /* Animation System */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 350ms;
    --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0.0, 1, 1);
    --ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Layout System */
    --header-height: 3.5rem;
    --sidebar-width: 14rem;
    --sidebar-width-collapsed: 3.5rem;
    --content-max-width: 1400px;
    
    /* Z-Index System */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

/* Selection Styling */
::selection {
    background: rgba(76, 175, 80, 0.3);
    color: var(--color-text);
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Layout Components */
.app-container {
    min-height: 100vh;
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    background: var(--color-background);
}

/* Enhanced Header */
.app-header {
    background: var(--color-surface-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    transition: all var(--duration-normal) var(--ease-out);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.sidebar-toggle:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    transform: scale(1.05);
}

.header-title h1 {
    font-family: var(--font-family-display);
    font-size: var(--font-size-xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.header-subtitle {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: -2px;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.breadcrumb-item {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-out);
}

.breadcrumb-item.active {
    color: var(--color-text);
    background: var(--color-surface-elevated);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.stat-number {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}

.header-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    transform: scale(1.05);
}

/* Main Layout */
.app-main {
    display: block;
    min-height: calc(100vh - var(--header-height));
}

/* Enhanced Sidebar */
.app-sidebar {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
}

.app-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, var(--color-border), transparent);
    opacity: 0.5;
}

.sidebar-header {
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
}

.sidebar-content {
    flex: 1;
    padding: var(--space-4) var(--space-6);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Content Area */
.app-content {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-background);
}

.content-header {
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-glass);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
}

.content-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-decoration: none;
}

.action-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-btn.secondary {
    background: transparent;
    color: var(--color-text-secondary);
}

.action-btn.secondary:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

.map-container {
    flex: 1;
    position: relative;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    margin: 0 var(--space-6) 0;
    box-shadow: var(--shadow-lg);
    height: calc(100vh - var(--header-height) - 70px);
}

#map {
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: #000;
}

/* Leaflet Dark Mode - Clean Implementation */
.leaflet-container {
    background: #000;
}

.leaflet-control-container .leaflet-control {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.leaflet-control-zoom a {
    background: var(--color-surface-elevated);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    transition: all var(--duration-fast) var(--ease-out);
}

.leaflet-control-zoom a:hover {
    background: var(--color-surface-hover);
    color: var(--color-primary);
}

.leaflet-control-attribution {
    background: var(--color-surface-elevated) !important;
    color: var(--color-text-secondary) !important;
    font-size: var(--font-size-xs);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border) !important;
}

.leaflet-control-attribution a {
    color: var(--color-primary) !important;
    text-decoration: none;
}

.leaflet-control-attribution a:hover {
    color: var(--color-primary-light) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--color-surface-elevated);
    color: var(--color-text);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
}

.leaflet-popup-tip {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
}

.leaflet-popup-close-button {
    color: var(--color-text-secondary);
    font-size: var(--font-size-lg);
    font-weight: bold;
    padding: var(--space-1);
}

.leaflet-popup-close-button:hover {
    color: var(--color-text);
    background: var(--color-surface-hover);
}

/* Hide mobile elements on desktop */
.mobile-menu-toggle,
.mobile-bottom-nav {
    display: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 18rem;
    }
}

@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
    }
    
    .app-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        height: calc(100vh - var(--header-height));
        z-index: var(--z-fixed);
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--ease-out);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-stats,
    .header-center {
        display: none;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #666666;
        --color-text-secondary: #cccccc;
    }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* Hide sidebar and related elements */
.app-sidebar,
.sidebar-toggle,
#engravings-list {
    display: none !important;
}

/* Adjust app-content to take full width */
.app-content {
    width: 100%;
    height: calc(100vh - var(--header-height));
}
