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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #e8e8e8;
    color: #1d1d1f;
}

.dashboard {
    min-height: 100vh;
    background: #e8e8e8;
}

/* Header Styles */
.header {
    background: white;
    border-bottom: 1px solid #e5e5e7;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-top {
    background: #f4d03f;
    height: 16px;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 24px;
    background: #f5f5f5;
    height: 52px;
}

.header-main h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.header-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    color: #666;
}

.header-actions button:hover {
    background: #e8f0ff;
    color: #667eea;
    transform: scale(1.1);
}

.header-actions svg {
    width: 24px;
    height: 24px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 68px;
    width: 180px;
    height: calc(100vh - 68px);
    background: #d8d8d8;
    border-right: none;
    padding: 0;
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar.collapsed {
    transform: translateX(-180px);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 0;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #333;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #c8c8c8;
}

.nav-item:hover {
    background: #f0f0f0;
    color: #000;
    transform: translateX(0);
}

.nav-item.active {
    background: #fff;
    color: #000;
    font-weight: 600;
    box-shadow: inset 4px 0 0 #00aaff;
    border-left: 4px solid #00aaff;
}

.nav-item.active:hover {
    transform: translateX(0);
}

/* Main Content */
.main-content {
    margin-left: 180px;
    padding: 16px;
    transition: margin-left 0.3s ease;
    background: #e8e8e8;
}

.main-content.expanded {
    margin-left: 0;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 16px;
    border: 1px solid #d8d8d8;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
    border-color: #00aaff;
}

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

.card-title {
    font-size: 22px;
    font-weight: 700;
    color: #000;
    margin-bottom: 4px;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-action-btn {
    background: #f0f0f0;
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

.card-action-btn:hover {
    background: #00aaff;
    color: white;
    border-color: #00aaff;
    transform: translateY(-2px);
}

.card-action-btn.active {
    background: #00aaff;
    color: white;
    font-weight: 600;
    border-color: #00aaff;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid #d8d8d8;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #00aaff;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.stat-card:hover::before {
    transform: scaleY(1);
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 170, 255, 0.2);
    border-color: #00aaff;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #000;
    margin-bottom: 8px;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.stat-change.positive {
    background: #d4f4dd;
    color: #10a37f;
}

.stat-change.negative {
    background: #ffe8e8;
    color: #dc3545;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
}

.chart-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    overflow-x: auto;
    display: block;
}

.data-table thead {
    background: linear-gradient(135deg, #e8f0ff 0%, #f5f0ff 100%);
    display: table;
    width: 100%;
    table-layout: fixed;
}

.data-table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.data-table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #667eea;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e5e7;
    transition: background 0.2s;
}

.data-table tbody tr {
    transition: all 0.2s;
}

.data-table tbody tr:hover {
    background: #f8f8f8;
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(0, 170, 255, 0.1);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.critical {
    background: #ffe8e8;
    color: #dc3545;
}

.status-badge.low {
    background: #fff4e5;
    color: #ff9800;
}

.status-badge.watch {
    background: #e3f2fd;
    color: #1976d2;
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 8px 16px;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.filter-select:hover {
    border-color: #00aaff;
}

.filter-select:focus {
    outline: none;
    border-color: #00aaff;
    box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1);
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #00aaff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-260px);
        z-index: 200;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .header-main h1 {
        font-size: 14px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .header-actions svg {
        width: 20px;
        height: 20px;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-select,
    .export-btn {
        width: 100%;
    }
    
    .card-actions {
        flex-wrap: wrap;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 4px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .header-main {
        padding: 8px 12px;
    }
    
    .header-main h1 {
        font-size: 12px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .card {
        padding: 12px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .card-action-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .export-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #00aaff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 170, 255, 0.4);
    cursor: pointer;
    z-index: 300;
    color: white;
    font-size: 24px;
    transition: all 0.3s;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Mobile Menu Backdrop */
.mobile-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-backdrop.show {
    opacity: 1;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-backdrop {
        display: block;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
    
    .sidebar.open {
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }
}

/* Tablet specific */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        margin-left: 260px;
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 350px;
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

.slide-in {
    animation: slideIn 0.5s ease-out;
}

.pulse-on-update {
    animation: pulse 0.5s ease-in-out;
}

/* Interactive Data Point Highlight */
.data-point-active {
    transform: scale(1.1);
    transition: transform 0.2s;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
}

/* Interactive Tooltips */
.custom-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.2s;
}

.custom-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* Real-time Update Indicator */
.update-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: #4ecdc4;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.4);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
    z-index: 1000;
}

.update-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

/* Interactive Card Expand */
.card.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    z-index: 500;
    overflow-y: auto;
}

.card-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 400;
    display: none;
}

.card-backdrop.show {
    display: block;
}

/* Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 80px;
    left: 260px;
    background: white;
    border: 1px solid #e5e5e7;
    border-radius: 0 8px 8px 0;
    padding: 12px 8px;
    cursor: pointer;
    z-index: 101;
    transition: all 0.3s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.sidebar-toggle:hover {
    background: #00aaff;
    color: white;
}

.sidebar-toggle.collapsed {
    left: 0;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* Export Button */
.export-btn {
    background: #00aaff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 13px;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 170, 255, 0.3);
    background: #0099ee;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

/* Dashboard Overview Layout */
.dashboard-top-section {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.financial-main-chart {
    min-height: 400px;
}

.summary-cards-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.summary-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(168, 192, 255, 0.15);
    border: 1px solid #e8f0ff;
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 192, 255, 0.25);
}

.mini-chart-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(168, 192, 255, 0.15);
    border: 1px solid #e8f0ff;
    flex: 1;
}

.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1400px) {
    .dashboard-top-section {
        grid-template-columns: 1fr;
    }
    
    .summary-cards-right {
        flex-direction: row;
    }
    
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-cards-right {
        flex-direction: column;
    }
}
