/**
 * Common CSS Styles for OctoPeople Dashboard
 * Material Design 3 inspired theme
 */

:root {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;
    --md-sys-color-error: #BA1A1A;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #FFDAD6;
    --md-sys-color-on-error-container: #410002;
    --md-sys-color-background: #FEF7FF;
    --md-sys-color-on-background: #1D1B20;
    --md-sys-color-surface: #FEF7FF;
    --md-sys-color-on-surface: #1D1B20;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
    --md-sys-color-shadow: #000000;
    --md-sys-color-scrim: #000000;
    --md-sys-color-inverse-surface: #322F35;
    --md-sys-color-inverse-on-surface: #F5EFF7;
    --md-sys-color-inverse-primary: #D0BCFF;
    --md-sys-color-surface-dim: #DED8E1;
    --md-sys-color-surface-bright: #FEF7FF;
    --md-sys-color-surface-container-lowest: #FFFFFF;
    --md-sys-color-surface-container-low: #F7F2FA;
    --md-sys-color-surface-container: #F3EDF7;
    --md-sys-color-surface-container-high: #ECE6F0;
    --md-sys-color-surface-container-highest: #E6E0E9;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
}

/* Navigation Drawer */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.navigation-drawer {
    position: fixed;
    top: 0;
    left: -360px;
    width: 360px;
    height: 100%;
    background-color: var(--md-sys-color-surface-container-low);
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2), 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12);
}

.navigation-drawer.active {
    left: 0;
}

.drawer-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.drawer-title {
    font-size: 22px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
}

.drawer-subtitle {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

.drawer-content {
    padding: 12px 0;
}

.drawer-item {
    display: flex;
    align-items: center;
    padding: 12px 28px 12px 16px;
    text-decoration: none;
    color: var(--md-sys-color-on-surface);
    transition: background-color 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
}

.drawer-item:hover {
    background-color: var(--md-sys-color-secondary-container);
}

.drawer-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.drawer-item .material-icons {
    margin-right: 12px;
    font-size: 24px;
}

/* Top App Bar */
.top-app-bar {
    position: sticky;
    top: 0;
    height: 64px;
    background-color: var(--md-sys-color-surface);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12);
    z-index: 997;
}

.menu-button {
    background: none;
    border: none;
    padding: 12px;
    margin-right: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--md-sys-color-on-surface);
}

.menu-button:hover {
    background-color: var(--md-sys-color-surface-variant);
}

.app-title {
    font-size: 22px;
    font-weight: 400;
    color: var(--md-sys-color-on-surface);
    flex: 1;
}

/* Main Content */
.main-content {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Store Selector */
.store-selector {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
}

.store-selector-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
}

.store-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

/* Stats Container */
.stats-container {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
    margin-bottom: 24px;
}

/* Stats Table */
.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

.stats-table td {
    padding: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    font-size: 14px;
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.stats-table tr:hover {
    background-color: var(--md-sys-color-surface-variant);
}

/* Loading and Error States */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 16px;
}

.error {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    padding: 16px;
    border-radius: 12px;
    margin: 16px 0;
    display: flex;
    align-items: center;
}

.error .material-icons {
    margin-right: 12px;
}

/* Last Updated */
.last-updated {
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 12px;
    margin-top: 24px;
    padding: 16px;
    background-color: var(--md-sys-color-surface-container-low);
    border-radius: 8px;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.fab .material-icons {
    font-size: 24px;
}

/* Chart Container */
.chart-container {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
}

.chart-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.chart-title .material-icons {
    margin-right: 8px;
    color: var(--md-sys-color-primary);
}

/* Heatmap Container */
.heatmap-container {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.heatmap-canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 12px 8px;
        font-size: 12px;
    }
    
    .navigation-drawer {
        width: 280px;
        left: -280px;
    }
    
    .chart-container {
        padding: 16px;
    }
    
    .heatmap-container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }
    
    .stats-table th,
    .stats-table td {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
    
    .fab .material-icons {
        font-size: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.rotating {
    animation: rotate 2s linear infinite;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.p-8 { padding: 8px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }