/* ===========================================
   CPU/RAM Monitor Dashboard - Octacer Theme
   =========================================== */

/* CSS Variables - Dark Theme (Default) */
:root {
    /* Brand Colors */
    --primary: #a3dc2f;
    --primary-light: #b8e85c;
    --primary-gradient: linear-gradient(135deg, #a3dc2f 0%, #b8e85c 100%);

    /* Background Colors */
    --bg-main: #0a0a0a;
    --bg-card: #1a1a1e;
    --bg-card-hover: #242428;
    --bg-elevated: #2a2a2f;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0a0;

    /* Border Colors */
    --border-subtle: #3a3a40;
    --border-emphasis: #4a4a50;

    /* Status Colors */
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --info: #2196f3;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --header-height: 64px;
    --footer-height: 40px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-main: #f5f5f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f0;
    --bg-elevated: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #2d2d2d;
    --text-muted: #666666;
    --border-subtle: #e0e0e0;
    --border-emphasis: #c0c0c0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 1.75rem;
}

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

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--bg-elevated);
    border-radius: 9999px;
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background-color: var(--success);
    animation: none;
}

.status-dot.disconnected {
    background-color: var(--error);
    animation: none;
}

.status-dot.polling {
    background-color: var(--info);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: #000000;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(163, 220, 47, 0.3);
}

.btn-secondary {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-emphasis);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--primary);
}

.theme-icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 24px) 24px calc(var(--footer-height) + 24px);
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Section Titles */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Summary Cards */
.summary-section {
    margin-bottom: 32px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    padding: 20px;
}

.summary-card:hover {
    transform: translateY(-4px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.card-icon {
    font-size: 1.25rem;
}

.card-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
    margin-top: 8px;
}

.summary-card.clickable {
    cursor: pointer;
}

.summary-card.clickable:hover .card-hint {
    opacity: 1;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width var(--transition-normal);
}

.progress-fill.warning {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

.progress-fill.danger {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

/* Charts Section */
.charts-section {
    margin-bottom: 32px;
}

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

.time-range-selector {
    display: flex;
    gap: 8px;
}

.range-btn {
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.range-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.range-btn.active {
    background: var(--primary-gradient);
    color: #000000;
    border-color: transparent;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

.chart-card {
    padding: 24px;
    overflow: hidden;
    min-width: 0;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Table Section */
.table-section {
    margin-bottom: 32px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 16px;
}

.table-controls {
    display: flex;
    gap: 12px;
}

.search-input {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.875rem;
    width: 250px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(163, 220, 47, 0.2);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.table-card {
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table td:first-child {
    white-space: normal;
    word-break: break-word;
    min-width: 120px;
    max-width: 200px;
}

.data-table th {
    background-color: var(--bg-elevated);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.data-table th.sortable:hover {
    color: var(--primary);
}

.data-table th.sortable.active {
    color: var(--primary);
}

.sort-icon {
    margin-left: 4px;
    opacity: 0.5;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.data-table td {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.data-table td:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.loading-cell {
    text-align: center !important;
    color: var(--text-muted) !important;
    padding: 40px !important;
}

/* CPU/Memory level badges */
.level-low {
    color: var(--success);
}

.level-medium {
    color: var(--warning);
}

.level-high {
    color: var(--error);
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-elevated);
}

::-webkit-scrollbar-thumb {
    background: var(--border-emphasis);
    border-radius: 4px;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

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

.modal {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    width: calc(100% - 40px);
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(-20px);
    transition: transform var(--transition-normal);
    margin: 20px;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-elevated);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--error);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 480px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-item {
    background-color: var(--bg-elevated);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.detail-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-value.small {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Core usage bars */
.core-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.core-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.core-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 60px;
}

.core-bar {
    flex: 1;
    height: 8px;
    background-color: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.core-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width var(--transition-normal);
}

.core-fill.warning {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

.core-fill.danger {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

.core-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: right;
}

/* Modal Table Styles */
.modal-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 4px;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.modal-table th,
.modal-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.modal-table th:first-child,
.modal-table td:first-child {
    white-space: normal;
    word-break: break-word;
    min-width: 100px;
}

.modal-table th {
    background-color: var(--bg-elevated);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-table tbody tr {
    transition: background-color var(--transition-fast);
}

.modal-table tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.modal-table td {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-table td:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.modal-table .highlight-row {
    background-color: var(--bg-elevated);
}

.modal-table .highlight-row td {
    font-weight: 600;
}

.modal-table .section-divider {
    background-color: var(--bg-elevated);
}

.modal-table .section-divider td {
    padding: 10px 16px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Modal Progress Bar */
.modal-progress-bar {
    width: 100%;
    min-width: 60px;
    max-width: 150px;
    height: 8px;
    background-color: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
}

.modal-progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width var(--transition-normal);
}

.modal-progress-fill.warning {
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
}

.modal-progress-fill.danger {
    background: linear-gradient(135deg, #f44336 0%, #ef5350 100%);
}

/* Modal Summary */
.modal-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-elevated);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.modal-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Clickable Table Rows */
.clickable-row {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.clickable-row:hover {
    background-color: var(--bg-card-hover);
}

.clickable-row:active {
    background-color: var(--bg-elevated);
}

/* Process Live Chart Modal */
.process-live-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.process-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.process-name-large {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.process-id-badge {
    background-color: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.process-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.process-stat-box {
    background-color: var(--bg-elevated);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.process-stat-box .stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.process-stat-box .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.process-charts-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.process-chart-box {
    background-color: var(--bg-elevated);
    border-radius: 10px;
    padding: 14px;
}

.process-chart-box .chart-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
}

.process-chart-wrapper {
    height: 120px;
    position: relative;
}

.process-live-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.update-info {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-up {
    background-color: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.status-badge.status-down {
    background-color: rgba(244, 67, 54, 0.15);
    color: var(--error);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* ===========================================
   Responsive Design
   =========================================== */

/* Large Tablets / Small Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
    .header-content {
        padding: 0 20px;
    }

    .main-content {
        padding: calc(var(--header-height) + 20px) 20px calc(var(--footer-height) + 20px);
    }

    .footer-content {
        padding: 0 20px;
    }
}

/* Tablets (max-width: 768px) */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .header-title {
        font-size: 1.25rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .connection-status {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .btn-secondary {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .charts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-card {
        padding: 20px;
    }

    .chart-title {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }

    .time-range-selector {
        width: 100%;
        justify-content: flex-start;
    }

    .range-btn {
        flex: 1;
        text-align: center;
    }

    .chart-container {
        height: 220px;
    }

    .modal {
        width: calc(100% - 40px);
        max-height: 85vh;
        margin: 20px;
    }

    .modal-body {
        padding: 20px;
        max-height: calc(85vh - 70px);
    }

    .modal-table th,
    .modal-table td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .data-table {
        min-width: 450px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 14px;
        font-size: 0.85rem;
    }

    .data-table th {
        font-size: 0.7rem;
    }
}

/* Small Tablets / Large Phones (max-width: 640px) */
@media (max-width: 640px) {
    :root {
        --header-height: 56px;
        --footer-height: 36px;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .header-title span:not(.logo-icon) {
        display: none;
    }

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

    .header-controls {
        gap: 8px;
    }

    .connection-status .status-text {
        display: none;
    }

    .connection-status {
        padding: 8px;
        min-width: auto;
    }

    .main-content {
        padding: calc(var(--header-height) + 12px) 12px calc(var(--footer-height) + 12px);
    }

    .summary-section {
        margin-bottom: 20px;
    }

    .summary-cards {
        gap: 12px;
    }

    .summary-card {
        padding: 16px;
    }

    .card-value {
        font-size: 1.75rem;
    }

    .card-icon {
        font-size: 1.1rem;
    }

    .card-label {
        font-size: 0.8rem;
    }

    .charts-section {
        margin-bottom: 16px;
    }

    .section-title {
        font-size: 1rem;
    }

    .chart-card {
        padding: 14px;
    }

    .chart-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .chart-container {
        height: 200px;
    }

    .table-section {
        margin-bottom: 16px;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .table-controls {
        width: 100%;
    }

    .search-input {
        width: 100%;
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .data-table {
        min-width: 420px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .data-table th {
        font-size: 0.65rem;
    }

    .data-table td:first-child {
        min-width: 100px;
        max-width: 150px;
    }

    .footer-content {
        padding: 0 12px;
        font-size: 0.65rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .footer-content > div:first-child {
        display: none;
    }

    /* Modal adjustments */
    .modal {
        width: calc(100% - 32px);
        max-width: none;
        max-height: 85vh;
        border-radius: 12px;
        margin: 16px;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 20px;
        max-height: calc(85vh - 60px);
    }

    .modal-table th,
    .modal-table td {
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .modal-progress-bar {
        min-width: 60px;
        max-width: 100px;
    }

    .modal-summary {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

/* Mobile Phones (max-width: 480px) */
@media (max-width: 480px) {
    .header-title {
        font-size: 1rem;
        gap: 8px;
    }

    .logo-icon {
        font-size: 1.25rem;
    }

    .btn-secondary {
        padding: 6px 10px;
    }

    .theme-icon {
        font-size: 1.1rem;
    }

    .summary-card {
        padding: 14px;
    }

    .card-header {
        margin-bottom: 8px;
    }

    .card-value {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }

    .progress-bar {
        height: 6px;
        margin-bottom: 6px;
    }

    .time-range-selector {
        flex-wrap: wrap;
    }

    /* Modal styles for 480px */
    .modal {
        width: calc(100% - 24px);
        margin: 12px;
        border-radius: 12px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-table-wrapper {
        width: 100%;
        padding: 0;
    }

    .modal-table {
        width: 100%;
    }

    .modal-table th,
    .modal-table td {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .modal-table th {
        font-size: 0.65rem;
    }

    .modal-table td:first-child {
        min-width: 70px;
        max-width: 100px;
    }

    .modal-progress-bar {
        min-width: 40px;
        max-width: 70px;
        height: 6px;
    }

    .modal-subtitle {
        font-size: 0.8rem;
        margin: 16px 0 10px 0;
    }

    .modal-summary {
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .modal-hint {
        font-size: 0.65rem;
    }

    .status-badge {
        padding: 3px 6px;
        font-size: 0.6rem;
    }

    .range-btn {
        padding: 6px 10px;
        font-size: 0.65rem;
    }

    .chart-card {
        padding: 12px;
    }

    .chart-title {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }

    .chart-container {
        height: 180px;
    }

    .data-table {
        min-width: 380px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
        font-size: 0.7rem;
    }

    .data-table th {
        font-size: 0.6rem;
    }

    .data-table td:first-child {
        min-width: 80px;
        max-width: 120px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Extra Small Phones (max-width: 360px) */
@media (max-width: 360px) {
    .header-content {
        padding: 0 8px;
    }

    .main-content {
        padding: calc(var(--header-height) + 8px) 8px calc(var(--footer-height) + 8px);
    }

    .summary-cards {
        gap: 8px;
    }

    .summary-card {
        padding: 12px;
    }

    .card-value {
        font-size: 1.35rem;
    }

    .charts-grid {
        gap: 10px;
    }

    .chart-card {
        padding: 10px;
    }

    .chart-title {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .chart-container {
        height: 160px;
    }

    .section-title {
        font-size: 0.9rem;
    }

    .data-table {
        min-width: 350px;
    }

    .data-table th,
    .data-table td {
        padding: 6px 8px;
        font-size: 0.65rem;
    }

    .data-table th {
        font-size: 0.55rem;
    }

    .data-table td:first-child {
        min-width: 70px;
        max-width: 100px;
    }

    /* Modal styles for 360px */
    .modal {
        width: calc(100% - 16px);
        margin: 8px;
        border-radius: 10px;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-body {
        padding: 14px;
    }

    .modal-table th,
    .modal-table td {
        padding: 6px 8px;
        font-size: 0.65rem;
    }

    .modal-table th {
        font-size: 0.6rem;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --header-height: 48px;
        --footer-height: 32px;
    }

    .modal {
        max-height: 95vh;
    }

    .modal-body {
        max-height: calc(95vh - 50px);
    }

    .chart-container {
        height: 150px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .summary-card:hover {
        transform: none;
    }

    .summary-card:active {
        transform: scale(0.98);
    }

    .card-hint {
        opacity: 1;
    }

    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }

    .data-table tbody tr:hover {
        background-color: transparent;
    }

    .data-table tbody tr:active {
        background-color: var(--bg-card-hover);
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .card {
        break-inside: avoid;
    }
}
