@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-BlackItalic.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-LightItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-Thin.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Roboto';
    src: url('/static/fonts/Roboto-ThinItalic.ttf') format('truetype');
    font-weight: 100;
    font-style: italic;
    font-display: swap;
}

/* CSS Custom Properties for Mobile-First Design */
:root {
    --mobile-padding: 16px;
    --tablet-padding: 24px;
    --desktop-padding: 32px;
    --touch-target-min: 44px;
    --border-radius: 8px;
    --transition-smooth: 0.2s ease;
    --color-primary: #007bff;
    --color-secondary: #6c757d;
    --color-background: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #333333;
    --color-text-secondary: #666666;
}

/* Base Mobile-First Styles */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    width: 100%;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Container - Mobile First */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--mobile-padding);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--tablet-padding);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--desktop-padding);
        max-width: 1800px;
    }
}

@media (min-width: 1440px) {
    .container {
        max-width: 95vw;
        padding: 0 2%;
    }
}

/* Header - Mobile First */
.header {
    position: relative;
    padding: var(--mobile-padding);
    background-color: #2c3e50;
    color: white;
    text-align: center;
    margin-bottom: var(--mobile-padding);
}

.header h1 {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.header #last-updated {
    font-size: clamp(0.875rem, 3vw, 1rem);
    opacity: 0.9;
    margin: 0;
}

@media (min-width: 768px) {
    .header {
        padding: var(--tablet-padding);
        margin-bottom: var(--tablet-padding);
    }
}

@media (min-width: 1024px) {
    .header {
        padding: var(--desktop-padding);
        margin-bottom: var(--desktop-padding);
    }
}

/* Support Button Container - Mobile First */
.support-button-container {
    display: flex;
    justify-content: center;
    padding: var(--mobile-padding) 0;
    margin-bottom: var(--mobile-padding);
}

/* Support Button - Mobile First */
.support-button {
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 600;
    color: white;
    background-color: var(--color-primary);
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
    border-radius: var(--border-radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: var(--touch-target-min);
    transition: var(--transition-smooth);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: fit-content;
    z-index: 1000;
}

.support-button:hover,
.support-button:focus {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.support-button:active {
    transform: translateY(0);
}

@media (min-width: 768px) {
    .support-button-container {
        position: absolute;
        top: var(--tablet-padding);
        right: calc(var(--tablet-padding) + 100px);
        padding: 0;
        margin: 0;
    }
    
    .support-button {
        font-size: 14px;
        padding: 8px 16px;
    }
}

@media (min-width: 1024px) {
    .support-button-container {
        top: var(--desktop-padding);
        right: calc(var(--desktop-padding) + 100px);
    }
    
    .support-button {
        font-size: 16px;
        padding: 12px 24px;
    }
}

/* KPI Section - Mobile First */
.kpi-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mobile-padding);
    padding: var(--mobile-padding);
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: var(--mobile-padding);
}

.kpi-item {
    padding: clamp(12px, 3vw, 16px);
    text-align: center;
    background-color: var(--color-background);
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
    transition: var(--transition-smooth);
    min-height: var(--touch-target-min);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kpi-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-title {
    font-size: clamp(0.875rem, 3vw, 1rem);
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.kpi-value {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

@media (min-width: 768px) {
    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
        padding: var(--tablet-padding);
        margin-bottom: var(--tablet-padding);
    }
}

@media (min-width: 1024px) {
    .kpi-section {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        padding: var(--desktop-padding);
        margin-bottom: var(--desktop-padding);
    }
}

/* Filter Section - Mobile First with Accordion Support */
.filter-section {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: var(--mobile-padding);
    padding: var(--mobile-padding);
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: var(--mobile-padding);
    position: relative;
    z-index: 100;
    overflow: visible;
}

.filter-section .filter-item {
    font-size: 1.0em;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    z-index: 101;
}

.filter-section .filter-item label {
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
    text-align: center;
}

@media (min-width: 768px) {
    .filter-section {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: var(--tablet-padding);
        justify-content: space-between;
        padding: var(--tablet-padding);
        margin-bottom: var(--tablet-padding);
        z-index: 200;
    }
    
    .filter-section .filter-item {
        min-width: 180px;
        flex: 1;
        max-width: 250px;
        z-index: 201;
    }
    
    .filter-section .filter-item label {
        text-align: left;
        margin-bottom: 6px;
    }
}

@media (min-width: 1024px) {
    .filter-section {
        padding: var(--desktop-padding);
        margin-bottom: var(--desktop-padding);
        gap: var(--desktop-padding);
        z-index: 300;
    }
    
    .filter-section .filter-item {
        min-width: 200px;
        max-width: 280px;
        z-index: 301;
    }
}

/* Date Picker Container */
.date-picker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    text-align: center;
}

.date-picker-container label {
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.9em;
    color: #333;
    text-align: center;
    width: 100%;
}

@media (min-width: 768px) {
    .date-picker-container {
        min-width: 200px;
        max-width: calc(20% - 10px);
        align-items: stretch;
        text-align: left;
    }
}

/* Mantine DatePickerInput Styling */
.date-picker-container .mantine-DatePickerInput-root {
    width: 100%;
}

.date-picker-container .mantine-DatePickerInput-input {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 14px;
    min-height: var(--touch-target-min);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: var(--transition-smooth);
    box-sizing: border-box;
}

.date-picker-container .mantine-DatePickerInput-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    outline: none;
}

.date-picker-container .mantine-DatePickerInput-input:hover {
    border-color: #999;
}

/* Style the dropdown calendar */
.mantine-DatePickerInput-dropdown {
    background-color: white;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    min-width: 300px;
}

/* Enhanced Calendar header styling */
.mantine-DatePickerInput-calendarHeader {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Year/Month navigation button styling */
.mantine-DatePickerInput-calendarHeaderLevel {
    background-color: transparent;
    border: none;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mantine-DatePickerInput-calendarHeaderLevel:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Navigation arrow buttons */
.mantine-DatePickerInput-calendarHeaderControl {
    background-color: white;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    font-weight: 700;
    font-size: 18px;
}

.mantine-DatePickerInput-calendarHeaderControl:hover {
    background-color: var(--color-primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.mantine-DatePickerInput-calendarHeaderControl:active {
    transform: scale(0.95);
}

/* Year and decade view styling */
.mantine-YearsList-yearsListCell button,
.mantine-DecadesList-decadesListCell button {
    background-color: white;
    border: 1px solid #e9ecef;
    color: var(--color-text);
    padding: 12px;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition-smooth);
    width: 100%;
    margin: 2px;
}

.mantine-YearsList-yearsListCell button:hover,
.mantine-DecadesList-decadesListCell button:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.mantine-YearsList-yearsListCell[data-selected] button,
.mantine-DecadesList-decadesListCell[data-selected] button {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 700;
}

/* Month view styling */
.mantine-Month-monthsList .mantine-Month-monthsListCell button {
    background-color: white;
    border: 1px solid #e9ecef;
    color: var(--color-text);
    padding: 12px;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition-smooth);
    width: 100%;
    margin: 2px;
}

.mantine-Month-monthsList .mantine-Month-monthsListCell button:hover {
    background-color: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.mantine-Month-monthsList .mantine-Month-monthsListCell[data-selected] button {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 700;
}

/* Day picker styling */
.mantine-DatePickerInput-day {
    background-color: white;
    border: 1px solid transparent;
    color: var(--color-text);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition-smooth);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mantine-DatePickerInput-day:hover {
    background-color: rgba(0, 123, 255, 0.1);
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.mantine-DatePickerInput-day[data-selected] {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 700;
}

.mantine-DatePickerInput-day[data-in-range] {
    background-color: rgba(0, 123, 255, 0.2);
    color: var(--color-primary);
    font-weight: 600;
}

/* Enhanced year navigation indicators */
.mantine-DatePickerInput-calendarHeader::before {
    content: "← Double-click arrows for year navigation →";
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--color-text-secondary);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mantine-DatePickerInput-calendarHeader:hover::before {
    opacity: 1;
}

/* Mobile responsiveness for Mantine date picker */
@media (max-width: 767px) {
    .date-picker-container .mantine-DatePickerInput-input {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px;
        min-height: 48px;
    }
    
    .mantine-DatePickerInput-dropdown {
        max-width: 95vw;
        margin: 0 auto;
    }
}

/* Reset Button - Mobile First */
.reset-button {
    background-color: #28a745;
    border: none;
    color: white;
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 20px);
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 3.5vw, 16px);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--border-radius);
    min-height: var(--touch-target-min);
    width: 100%;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
}

.reset-button:hover,
.reset-button:focus {
    background-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.reset-button:active {
    transform: translateY(0);
    background-color: #1e7e34;
}

@media (min-width: 768px) {
    .reset-button {
        width: auto;
        min-width: 120px;
    }
}

@media (min-width: 1024px) {
    .reset-button {
        width: auto;
        min-width: 150px;
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* Main Content Layout - Mobile First Grid */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mobile-padding);
    padding: var(--mobile-padding);
    width: 100%;
}

.map-section {
    width: 100%;
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    order: 1;
    min-height: 600px;
}

.charts-section {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mobile-padding);
    order: 2;
}

.chart-container {
    width: 100%;
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 55vh;
    max-height: none;
}

.city-chart-container {
    width: 100%;
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 60vh;
    max-height: none;
}

.city-chart-inner-container {
    position: relative;
    padding-top: 40px;
    overflow-y: scroll;
    max-height: 55vh;
    font-size: 0.8em;
}

/* Desktop-specific city chart optimization */
@media (min-width: 1024px) {
    .city-chart-inner-container {
        max-height: calc(100% - 50px);  /* Use almost full container height for desktop */
        height: calc(100% - 50px);      /* Force full height utilization */
    }
}

.chart-title {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    padding: 10px 0;
    text-align: center;
    font-size: 1.25em;
    font-weight: bold;
}

.last-alarms-section {
    width: 100%;
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: var(--mobile-padding);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    order: 3;
}

/* Tablet Layout */
@media (min-width: 768px) {
    .main-content {
        padding: var(--tablet-padding);
        gap: var(--tablet-padding);
        grid-template-columns: 1.3fr 1.7fr;
        grid-template-areas: 
            "map charts"
            "table table";
    }
    
    .map-section {
        grid-area: map;
        padding: var(--tablet-padding);
        min-height: 700px;
    }
    
    .charts-section {
        grid-area: charts;
        grid-template-columns: 1fr;
        gap: calc(var(--tablet-padding) / 2);
    }
    
    .chart-container {
        padding: 16px;
        min-height: 400px;
        max-height: none;
    }
    
    .city-chart-container {
        padding: 16px;
        min-height: 480px;
        max-height: none;
    }
    
    .last-alarms-section {
        grid-area: table;
        padding: var(--tablet-padding);
    }
}

/* Desktop Layout */
@media (min-width: 1024px) {
    .main-content {
        padding: var(--desktop-padding);
        gap: var(--desktop-padding);
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas: 
            "map charts"
            "table charts"
            ". charts";
    }
    
    .map-section {
        grid-area: map;
        padding: 4px;  /* Further reduced from 16px to maximize map height */
        /* Height increased to give map more vertical space */
        height: calc(2.8 * 380px);
        min-height: unset;  /* Remove min-height constraint */
        max-height: unset;  /* Remove max-height constraint */
    }
    
    .charts-section {
        grid-area: charts;
        grid-template-columns: 1fr;  /* Changed from 1fr 1fr to 1fr for vertical stacking */
        gap: var(--desktop-padding);
    }
    
    .chart-container,
    .city-chart-container {
        padding: 16px;
        height: 380px;  /* Changed from min-height to height for exact alignment */
        max-height: none;
    }
    
    .last-alarms-section {
        grid-area: table;
        padding: var(--desktop-padding);
        margin: 0 4px;  /* Reduced horizontal margins to give more space to table */
        /* Height calculated to match 2 chart containers (hour + minute) + gap between them */
        height: calc(2 * 380px + var(--desktop-padding));
        min-height: unset;  /* Remove min-height constraint */
        max-height: unset;  /* Remove max-height constraint */
        overflow: visible;
    }
}

/* Large Desktop Layout */
@media (min-width: 1440px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas: 
            "map charts"
            "table charts"
            ". charts";
    }
    
    .chart-container,
    .city-chart-container {
        height: 400px;  /* Changed from min-height to height for exact alignment */
        max-height: none;
    }
    
    .map-section {
        /* Height increased to give map more vertical space for large desktop */
        height: calc(2.8 * 400px);
        min-height: unset;  /* Remove min-height constraint */
        max-height: unset;  /* Remove max-height constraint */
        padding: 4px;  /* Further reduced from 16px to maximize map height */
    }
    
    .last-alarms-section {
        /* Height calculated to match 2 chart containers (hour + minute) + gap for large desktop */
        height: calc(2 * 400px + var(--desktop-padding));
        min-height: unset;  /* Remove min-height constraint */
        max-height: unset;  /* Remove max-height constraint */
        margin: 0 20px;  /* Add horizontal margins to prevent text cutoff */
    }
}

/* Extra Large Desktop Layout */
@media (min-width: 1600px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas: 
            "map charts"
            "table charts"
            ". charts";
    }
    
    .map-section {
        /* Height increased to give map more vertical space for extra large desktop */
        height: calc(2.8 * 420px);
        min-height: unset;  /* Remove min-height constraint */
        max-height: unset;  /* Remove max-height constraint */
        padding: 4px;  /* Further reduced from 16px to maximize map height */
    }
    
    .chart-container,
    .city-chart-container {
        height: 420px;  /* Changed from min-height to height for exact alignment */
        max-height: none;
    }
    
    .last-alarms-section {
        /* Height calculated to match 2 chart containers (hour + minute) + gap for extra large desktop */
        height: calc(2 * 420px + var(--desktop-padding));
        min-height: unset;  /* Remove min-height constraint */
        max-height: unset;  /* Remove max-height constraint */
        margin: 0 24px;  /* Add horizontal margins to prevent text cutoff */
    }
}

/* Table Responsiveness */
.last-alarms-table {
    width: 100%;
    height: auto;
    border-collapse: collapse;
    overflow-y: auto;
    display: block;
}

.last-alarms-table th, 
.last-alarms-table td {
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
    padding: clamp(6px, 2vw, 8px);
    font-size: clamp(12px, 3vw, 14px);
}

/* Add left padding to city column for mobile */
.last-alarms-table th:nth-child(1),
.last-alarms-table td:nth-child(1) {
    padding-left: 14px;
    text-align: left;
}

.last-alarms-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.last-alarms-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.last-alarms-table tr:hover {
    background-color: #ddd;
}

/* Mobile horizontal scroll solution for very small screens (400px and below) */
@media (max-width: 400px) {
    .last-alarms-section {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        position: relative;
        padding: 8px;
        /* Force scrollable container */
        width: 100%;
        max-width: 100vw;
    }
    
    /* Make the table wrapper scrollable */
    .last-alarms-table {
        /* Force table to be wider than container to ensure horizontal scroll */
        min-width: 480px !important;
        width: 480px !important;
        display: table !important;
        table-layout: fixed !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        margin: 0 !important;
    }
    
    /* Force table elements to display properly */
    .enhanced-table-head {
        display: table-header-group !important;
        width: 100% !important;
    }
    
    .enhanced-table-body {
        display: table-row-group !important;
        width: 100% !important;
    }
    
    .table-header-row,
    .table-row {
        display: table-row !important;
        width: 100% !important;
    }
    
    /* Fixed column widths - updated to use 480px total width */
    .table-header-cell:nth-child(1),
    .table-cell.city-cell {
        width: 130px !important;
        min-width: 130px !important;
        max-width: 130px !important;
        display: table-cell !important;
    }
    
    .table-header-cell:nth-child(2),
    .table-cell.date-cell {
        width: 110px !important;
        min-width: 110px !important;
        max-width: 110px !important;
        display: table-cell !important;
    }
    
    .table-header-cell:nth-child(3),
    .table-cell.time-cell {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
        display: table-cell !important;
    }
    
    .table-header-cell:nth-child(4),
    .table-cell.cause-cell {
        width: 160px !important;
        min-width: 160px !important;
        max-width: 160px !important;
        display: table-cell !important;
    }
    
    /* General cell styling */
    .table-header-cell,
    .table-cell {
        padding: 6px 4px !important;
        font-size: 10px !important;
        line-height: 1.3 !important;
        overflow: hidden !important;
        border: 1px solid #ddd !important;
        vertical-align: top !important;
    }
    
    /* Allow text wrapping for city column only */
    .table-header-cell:nth-child(1),
    .table-cell.city-cell {
        white-space: normal !important;
        word-wrap: break-word !important;
        hyphens: auto !important;
        text-overflow: unset !important;
    }
    
    /* Keep other columns compact with no wrap */
    .table-header-cell:nth-child(2),
    .table-header-cell:nth-child(3),
    .table-header-cell:nth-child(4),
    .table-cell.date-cell,
    .table-cell.time-cell,
    .table-cell.cause-cell {
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
    }
    
    /* Text content sizing */
    .city-name,
    .date-main,
    .time-main,
    .cause-text {
        font-size: 10px !important;
        line-height: 1.2 !important;
    }
    
    .date-relative {
        font-size: 8px !important;
    }
    
    /* Hide timezone indicator completely on mobile */
    .timezone-indicator {
        display: none !important;
    }
    
    /* Alignment */
    .table-header-cell:nth-child(1),
    .table-cell.city-cell {
        text-align: left !important;
        padding-left: 6px !important;
    }
    
    .table-header-cell:nth-child(2),
    .table-header-cell:nth-child(3),
    .table-header-cell:nth-child(4),
    .table-cell.date-cell,
    .table-cell.time-cell,
    .table-cell.cause-cell {
        text-align: center !important;
    }
    
    /* Visual scroll indicator */
    .last-alarms-section::after {
        content: '→';
        position: absolute;
        top: 50%;
        right: 5px;
        transform: translateY(-50%);
        background: rgba(0, 123, 255, 0.8);
        color: white;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: bold;
        z-index: 100;
        pointer-events: none;
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0%, 100% { opacity: 0.7; }
        50% { opacity: 1; }
    }
    
    /* Ensure content flows properly */
    .city-cell-content,
    .date-cell-content,
    .time-cell-content,
    .cause-cell-content {
        display: block !important;
        width: 100% !important;
    }
    
    /* Override any conflicting desktop styles */
    .last-alarms-section h3 {
        font-size: 1.2rem !important;
        margin-bottom: 12px !important;
    }
}

@media (min-width: 768px) {
    .last-alarms-table {
        display: table;
        height: 700px;
    }
    
    .last-alarms-table th, 
    .last-alarms-table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    /* Add left padding to city column for tablet */
    .last-alarms-table th:nth-child(1),
    .last-alarms-table td:nth-child(1) {
        padding-left: 14px;
        text-align: left;
    }
}

@media (min-width: 1024px) {
    .last-alarms-table {
        height: 100%;
        max-height: none;
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .last-alarms-table th, 
    .last-alarms-table td {
        padding: 10px 8px;
        font-size: 14px;
        line-height: 1.4;
        overflow: hidden;
    }
    
    /* Allow text wrapping for city and alert type columns */
    .last-alarms-table th:nth-child(1),
    .last-alarms-table td:nth-child(1),
    .last-alarms-table th:nth-child(4),
    .last-alarms-table td:nth-child(4) {
        white-space: normal;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    /* Add extra left padding to city column for better visual spacing */
    .last-alarms-table th:nth-child(1),
    .last-alarms-table td:nth-child(1) {
        padding-left: 16px;
        text-align: left;
    }
    
    /* Keep time and date columns compact */
    .last-alarms-table th:nth-child(2),
    .last-alarms-table td:nth-child(2),
    .last-alarms-table th:nth-child(3),
    .last-alarms-table td:nth-child(3) {
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    .last-alarms-table th:nth-child(1),
    .last-alarms-table td:nth-child(1) {
        width: 35%;
    }
    
    .last-alarms-table th:nth-child(2),
    .last-alarms-table td:nth-child(2) {
        width: 25%;
    }
    
    .last-alarms-table th:nth-child(3),
    .last-alarms-table td:nth-child(3) {
        width: 15%;
    }
    
    .last-alarms-table th:nth-child(4),
    .last-alarms-table td:nth-child(4) {
        width: 25%;
    }
}

@media (min-width: 1440px) {
    .last-alarms-table th, 
    .last-alarms-table td {
        padding: 8px 6px;
        font-size: 12px;
    }
}

/* Table Container Improvements */
.table-container {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: var(--mobile-padding);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.table-container h3 {
    margin: 0 0 var(--mobile-padding) 0;
    font-size: 1.5rem;
    color: var(--color-text);
    font-weight: 600;
}

@media (min-width: 768px) {
    .table-container {
        padding: var(--tablet-padding);
    }
    
    .table-container h3 {
        margin-bottom: var(--tablet-padding);
    }
}

@media (min-width: 1024px) {
    .table-container {
        padding: var(--desktop-padding);
    }
    
    .table-container h3 {
        margin-bottom: var(--desktop-padding);
        font-size: 1.75rem;
    }
}

/* Dropdown Styles - Mobile Optimized */
.dash-dropdown {
    position: relative;
    width: 100%;
    z-index: 1;
}

.dash-dropdown .Select-control {
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    padding: 8px;
    min-height: var(--touch-target-min);
    touch-action: manipulation;
    font-size: 16px; /* Prevent iOS zoom */
}

.dash-dropdown .Select.is-open .Select-menu-outer {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    width: 100% !important;
    z-index: 9999 !important;
    background-color: white !important;
    border: 1px solid #ccc !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    border-radius: var(--border-radius) !important;
    margin-top: 2px !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
}

.dash-dropdown .Select-option {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    min-height: var(--touch-target-min);
    font-size: 16px;
    touch-action: manipulation;
}

.dash-dropdown .Select-option:hover,
.dash-dropdown .Select-option:active {
    background-color: #f8f9fa;
    color: #333;
}

.dash-dropdown .Select-option.Select-option--focused {
    background-color: var(--color-primary);
    color: white;
}

@media (min-width: 768px) {
    .dash-dropdown .Select-control {
        font-size: 14px;
        min-height: 40px;
    }
    
    .dash-dropdown .Select-option {
        padding: 8px 12px;
        font-size: 14px;
        min-height: auto;
    }
    
    .dash-dropdown .Select.is-open .Select-menu-outer {
        max-height: 300px !important;
    }
}

/* Accordion-Style Mobile Filters */
@media (max-width: 767px) {
    .filter-accordion-item {
        border: 1px solid #ddd;
        border-radius: var(--border-radius);
        background-color: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        overflow: visible;
        margin-bottom: 8px;
        position: relative;
        z-index: 1010;
    }
    
    .filter-accordion-item.accordion-open {
        z-index: 1100;
        overflow: visible;
    }
    
    .filter-accordion-header {
        min-height: 48px;
        background-color: #f8f9fa;
        padding: 12px 16px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #e9ecef;
        touch-action: manipulation;
        user-select: none;
        transition: background-color 0.2s ease;
        position: relative;
        z-index: 1;
    }
    
    .filter-accordion-header:hover {
        background-color: #e9ecef;
    }
    
    .filter-accordion-header:active {
        background-color: #dee2e6;
    }
    
    .filter-accordion-header .accordion-title {
        font-weight: 600;
        color: #495057;
        font-size: 16px;
    }
    
    .filter-accordion-header .accordion-current-value {
        color: #6c757d;
        font-size: 14px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .filter-accordion-header .accordion-arrow {
        color: #6c757d;
        font-size: 18px;
        transition: transform 0.3s ease;
        margin-left: 8px;
    }
    
    .filter-accordion-header.open .accordion-arrow {
        transform: rotate(180deg);
    }
    
    .filter-accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: white;
        position: relative;
        z-index: 2;
    }
    
    .filter-accordion-content.open {
        max-height: 400px;
        padding: 16px;
        border-top: 1px solid #e9ecef;
        overflow: visible;
        z-index: 1200;
    }
    
    .filter-accordion-item label {
        display: none;
    }
    
    .filter-accordion-content .dash-dropdown {
        width: 100%;
        margin: 0;
        position: relative;
        z-index: 1300;
    }
    
    .filter-accordion-content .dash-dropdown .Select.is-open .Select-menu-outer {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: auto !important;
        width: 100% !important;
        z-index: 1400 !important;
        background-color: white !important;
        border: 1px solid #ccc !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
        border-radius: var(--border-radius) !important;
        margin-top: 2px !important;
        max-height: 50vh !important;
        overflow-y: auto !important;
    }
    
    .filter-accordion-content .reset-button {
        width: 100%;
        margin-top: 8px;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Date Picker Styles */
.date-picker-container {
    position: relative;
    z-index: 1002;
}

.SingleDatePicker_picker,
.DateRangePicker_picker {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #ccc;
    z-index: 9999 !important;
}

.SingleDatePicker_picker__directionRight,
.DateRangePicker_picker__directionRight {
    left: auto !important;
    right: 0 !important;
}

.DayPicker {
    z-index: 9999 !important;
}

.DayPickerNavigation_button {
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 0 !important;
    z-index: 10001 !important;
    background: white !important;
    border: 1px solid #e4e7e7 !important;
    color: #484848 !important;
}

.DayPickerNavigation_button svg {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
}

/* Responsive Chart Info */
.chart-info {
    font-size: clamp(12px, 1.4vw, 14px);
    line-height: 1.35;
    background: #f8fafc;
    border-left: 4px solid #94a3b8;
    padding: .5rem .75rem;
    border-radius: var(--border-radius);
    margin: .25rem 0 .5rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

.area-intensity-title {
    font-size: clamp(1.15em, 4vw, 2em);
    font-weight: bold;
    text-align: center;
    margin: 18px 0 8px 0;
    color: #222;
    line-height: 1.2;
    word-break: break-word;
    padding: 0 4px;
}

@media (min-width: 992px) {
    .area-intensity-title {
        font-size: 1.6em;
        margin-top: 32px;
        margin-bottom: 12px;
        padding: 0;
    }
    
    .chart-info {
        max-width: 420px;
        margin: 24px auto 12px auto;
    }
}

.chart-info summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.chart-info summary::-webkit-details-marker { 
    display: none; 
}

.intensity-block { 
    width: 100%; 
    margin: 24px 0; 
}

/* Intensity Calculation Click-to-Reveal Styles */
.intensity-calculation-details {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    margin: 0.75rem 0 1rem 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.intensity-calculation-toggle {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    outline: none;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
    display: block;
    margin: 0;
    list-style: none;
}

.intensity-calculation-toggle::-webkit-details-marker {
    display: none;
}

.intensity-calculation-toggle::after {
    content: "▼";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.intensity-calculation-details[open] .intensity-calculation-toggle::after {
    transform: translateY(-50%) rotate(180deg);
}

.intensity-calculation-toggle:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.intensity-calculation-toggle:active {
    transform: translateY(0);
}

.intensity-calculation-content {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid #e2e8f0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculation-line {
    margin: 0.5rem 0;
    padding: 0.25rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #2d3748;
    background-color: #f7fafc;
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 4px solid #4299e1;
}

.calculation-line:first-child {
    margin-top: 0;
}

.calculation-line:last-child {
    margin-bottom: 0;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .intensity-calculation-toggle {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .intensity-calculation-content {
        padding: 0.875rem;
    }
    
    .calculation-line {
        font-size: 0.85rem;
        padding: 0.4rem;
    }
}

/* Dark mode considerations */
@media (prefers-color-scheme: dark) {
    .intensity-calculation-details {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .intensity-calculation-content {
        background-color: #2d3748;
        border-top-color: #4a5568;
    }
    
    .calculation-line {
        background-color: #4a5568;
        color: #e2e8f0;
    }
}

/* Enhanced Table Styles */
.enhanced-table-head {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-header-row {
    background: transparent;
}

.table-header-cell {
    padding: 12px 10px;
    border: none;
    color: #ffffff !important;
    font-weight: 800;
    text-align: left;
    position: relative;
    font-size: 14px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    background-color: #1a202c;
}

.header-text {
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 14px;
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Desktop optimizations for better readability with larger fonts */
@media (min-width: 1024px) {
    .table-header-cell {
        padding: 12px 10px;
        font-size: 14px;
    }
    
    .header-text {
        font-size: 14px;
    }
    
    .table-cell {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .city-name {
        font-size: 13px;
    }
    
    .date-main {
        font-size: 13px;
    }
    
    .date-relative {
        font-size: 12px;
    }
    
    .time-main {
        font-size: 13px;
    }
    
    .cause-text {
        font-size: 13px;
    }
    
    .timezone-indicator {
        font-size: 11px;
        padding: 2px 6px;
    }
}

.enhanced-table-body {
    background-color: white;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.table-row {
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.table-row:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.table-row:last-child {
    border-bottom: none;
}

.table-cell {
    padding: 10px 8px;
    border: none;
    vertical-align: middle;
    font-size: 13px;
}

/* City Cell Styles */
.city-cell-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-icon {
    font-size: 16px;
    opacity: 0.7;
}

.city-name {
    font-weight: 600;
    color: #2d3748;
}

/* Date Cell Styles */
.date-cell-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.date-main {
    font-weight: 500;
    color: #2d3748;
    font-size: 14px;
}

.date-relative {
    font-size: 12px;
    color: #718096;
    font-style: italic;
}

/* Time Cell Styles */
.time-cell-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-main {
    font-weight: 500;
    color: #2d3748;
    font-family: 'Courier New', monospace;
}

.timezone-indicator {
    background-color: #e2e8f0;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Cause Cell Styles */
.cause-cell-content {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.cause-icon {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    background-color: #e2e8f0;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.cause-text {
    font-weight: 500;
    color: #2d3748;
}

/* Priority-based hover effects (without colored stripes) */
.priority-critical:hover {
    background-color: #fed7d7;
}

.priority-high:hover {
    background-color: #feebc8;
}

.priority-medium:hover {
    background-color: #faf089;
}

.priority-low:hover {
    background-color: #c6f6d5;
}

/* Row alternating colors */
.row-0 {
    background-color: #ffffff;
}

.row-1 {
    background-color: #f9fafb;
}

/* Error state styling */
.error-cell {
    padding: 32px;
    text-align: center;
    background-color: #fef2f2;
    border-radius: 12px;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.error-text {
    color: #e53e3e;
    font-weight: 600;
    font-size: 16px;
}

.error-subtext {
    color: #a0aec0;
    font-size: 14px;
}

/* Mobile responsive enhancements */
@media (max-width: 768px) {
    .table-header-cell,
    .table-cell {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .cause-icon {
        font-size: 9px;
        padding: 3px 6px;
        margin-right: 6px;
    }
    
    .city-name {
        font-size: 13px;
    }
    
    .date-main {
        font-size: 13px;
    }
    
    .date-relative {
        font-size: 11px;
    }
    
    .time-main {
        font-size: 13px;
    }
    
    .cause-text {
        font-size: 13px;
    }
    
    .table-row:hover {
        transform: none;
    }
}

/* Hide Plotly map attribution elements */
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib-inner,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-attrib-inner,
.plotly-map-attribution,
[class*="attribution"],
.maplibregl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-right {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Target any text content that might contain attribution */
.js-plotly-plot .maplibregl-canvas-container + div,
.js-plotly-plot .mapboxgl-canvas-container + div,
.js-plotly-plot [class*="ctrl"] {
    display: none !important;
}

/* Enhanced table container */
.last-alarms-section {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    padding: var(--mobile-padding);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.last-alarms-section h3 {
    color: #2d3748;
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

.last-alarms-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
    background-color: white;
    max-height: 100%;
}

/* Desktop table container optimization */
@media (min-width: 1024px) {
    .last-alarms-section {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    .last-alarms-table {
        flex: 1;
        overflow-y: visible;
        max-height: none;
        height: auto;
    }
    
    .last-alarms-table th, 
    .last-alarms-table td {
        padding: 8px 6px;
        font-size: 12px;
        line-height: 1.3;
    }
}

/* Custom Scrollbars */
.dash-dropdown .Select-menu-outer::-webkit-scrollbar,
.city-chart-inner-container::-webkit-scrollbar,
.last-alarms-table::-webkit-scrollbar {
    width: 8px;
    background-color: #f5f5f5;
}

.dash-dropdown .Select-menu-outer::-webkit-scrollbar-thumb,
.city-chart-inner-container::-webkit-scrollbar-thumb,
.last-alarms-table::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: #ccc;
}

/* Legacy Support for Chart X-Axis */
.city-chart-container .x-axis-ticks {
    position: sticky;
    top: 40px;
    background-color: white;
    z-index: 10;
    text-align: center;
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    padding: 5px 20px;
}

/* Mobile Chart Optimizations */
@media (max-width: 767px) {
    body, html {
        overflow-x: hidden;
    }
    
    /* Override any remaining old mobile styles that conflict */
    .kpi-item {
        border-right: none;
    }
    
    .filter-section {
        margin: 0 !important;
        z-index: 1000;
    }
    
    /* Mobile Chart Container Fixes */
    .chart-container {
        min-height: 450px !important;  /* Increased to accommodate legend below */
        max-height: 500px !important;
        padding: 8px !important;
        overflow: visible !important;
    }
    
    /* Mobile-specific Plotly chart styling */
    .js-plotly-plot {
        width: 100% !important;
        height: 100% !important;
    }
    
    .js-plotly-plot .xtick text {
        font-size: 8px !important;
    }
    
    .js-plotly-plot .ytick text {
        font-size: 9px !important;
    }
    
    /* Target specific chart elements for better mobile readability */
    .chart-container .js-plotly-plot .xtick text,
    .chart-container .js-plotly-plot .ytick text {
        font-size: 8px !important;
    }
    
    /* Mobile legend positioning */
    .js-plotly-plot .legend {
        font-size: 8px !important;
    }
    
    /* Mobile chart title sizing */
    .js-plotly-plot .gtitle {
        font-size: 14px !important;
    }
    
    /* Ensure mobile charts have proper padding for legends */
    .chart-container > div {
        padding-bottom: 50px !important;
    }
    
    /* Mobile modebar hiding */
    .js-plotly-plot .modebar {
        display: none !important;
    }
    
    /* Mobile hover label styling */
    .js-plotly-plot .hoverlayer .hovertext {
        font-size: 11px !important;
        max-width: 200px !important;
        word-wrap: break-word !important;
    }
}

/* Tablet Chart Optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
    .chart-container {
        min-height: 420px !important;
        padding: 12px !important;
    }
    
    .js-plotly-plot .xtick text {
        font-size: 9px !important;
    }
    
    .js-plotly-plot .ytick text {
        font-size: 10px !important;
    }
    
    .js-plotly-plot .legend {
        font-size: 9px !important;
    }
}

/* Desktop Chart Optimizations */
@media (min-width: 1024px) {
    .chart-container {
        padding: 16px !important;
    }
    
    /* Desktop legend positioning - back to top for more space */
    .js-plotly-plot .legend {
        transform: translateY(-10px) !important;
    }
}
