/**
 * Location Tracker Dashboard Styles
 * Enhanced for multiple chart types and responsive layout
 */

/* Dashboard Wrapper */
.lt-dashboard-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Dashboard Header */
.lt-dashboard-header {
    margin-bottom: 30px;
}

.lt-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lt-dashboard-header h2 {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
}

.lt-dashboard-filters select {
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    min-width: 120px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.lt-dashboard-filters select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Stats Cards */
.lt-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.lt-stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lt-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.lt-stat-card:nth-child(1) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.lt-stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.lt-stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.lt-stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.lt-stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1;
}

.lt-stat-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts Container */
.lt-dashboard-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

/* Chart Container */
.lt-chart-container {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.lt-chart-container:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.lt-chart-container h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #2c3e50;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8e8e8;
}

/* Full-width charts (LGA bar, Ward bar, Timeline, LGA Status) */
.lt-chart-container.lt-chart-full {
    grid-column: 1 / -1;
}

/* Canvas sizing */
.lt-chart-container canvas {
    width: 100% !important;
    height: auto !important;
}

/* Map Container */
.lt-dashboard-map {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.lt-dashboard-map h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #2c3e50;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8e8e8;
}

#lt-dashboard-project-map {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Loading State */
.lt-dashboard-loading {
    display: none;
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.lt-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lt-dashboard-loading p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Error State */
.lt-error {
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    color: #c53030;
    font-size: 15px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.leaflet-popup-content b {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 5px;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
    .lt-dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .lt-chart-container.lt-chart-full {
        grid-column: 1;
    }
}

@media screen and (max-width: 768px) {
    .lt-dashboard-wrapper {
        padding: 15px;
    }
    
    .lt-dashboard-header h2 {
        font-size: 24px;
    }
    
    .lt-dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .lt-stat-card {
        padding: 20px;
    }
    
    .lt-stat-value {
        font-size: 28px;
    }
    
    .lt-stat-label {
        font-size: 12px;
    }
    
    .lt-chart-container,
    .lt-dashboard-map {
        padding: 20px;
    }
    
    .lt-chart-container h3,
    .lt-dashboard-map h3 {
        font-size: 16px;
    }
    
    #lt-dashboard-project-map {
        height: 400px !important;
    }
}

@media screen and (max-width: 480px) {
    .lt-dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .lt-stat-value {
        font-size: 32px;
    }
    
    .lt-chart-container,
    .lt-dashboard-map {
        padding: 15px;
    }
    
    #lt-dashboard-project-map {
        height: 350px !important;
    }
}

/* Print Styles */
@media print {
    .lt-dashboard-wrapper {
        max-width: 100%;
    }
    
    .lt-chart-container,
    .lt-dashboard-map {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .lt-stat-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    #lt-dashboard-project-map {
        height: 500px !important;
    }
}

/* Dark Background Option (Opt-in via background="dark" attribute) */
.lt-dashboard-wrapper.lt-bg-dark {
    background-color: #1a1a1a;
}

.lt-dashboard-wrapper.lt-bg-dark .lt-chart-container,
.lt-dashboard-wrapper.lt-bg-dark .lt-dashboard-map,
.lt-dashboard-wrapper.lt-bg-dark .lt-dashboard-loading {
    background: #2d2d2d;
    color: #e8e8e8;
}

.lt-dashboard-wrapper.lt-bg-dark .lt-chart-container h3,
.lt-dashboard-wrapper.lt-bg-dark .lt-dashboard-map h3,
.lt-dashboard-wrapper.lt-bg-dark .lt-dashboard-header h2 {
    color: #e8e8e8;
    border-bottom-color: #444;
}

.lt-dashboard-wrapper.lt-bg-dark .lt-dashboard-loading p {
    color: #b8b8b8;
}

/* Transparent Background Option */
.lt-dashboard-wrapper.lt-bg-transparent {
    background-color: transparent;
}

.lt-dashboard-wrapper.lt-bg-transparent .lt-chart-container,
.lt-dashboard-wrapper.lt-bg-transparent .lt-dashboard-map {
    background: transparent;
    box-shadow: none;
}

/* Chart.js Legend Styling Enhancement */
.lt-chart-container .chartjs-legend {
    padding-top: 15px;
}

.lt-chart-container .chartjs-legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lt-chart-container .chartjs-legend li {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 8px;
}

/* Accessibility Improvements */
.lt-chart-container:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Animation for chart containers on load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lt-chart-container {
    animation: fadeInUp 0.5s ease-out;
}

.lt-chart-container:nth-child(1) { animation-delay: 0.1s; }
.lt-chart-container:nth-child(2) { animation-delay: 0.2s; }
.lt-chart-container:nth-child(3) { animation-delay: 0.3s; }
.lt-chart-container:nth-child(4) { animation-delay: 0.4s; }
.lt-chart-container:nth-child(5) { animation-delay: 0.5s; }
.lt-chart-container:nth-child(6) { animation-delay: 0.6s; }