:root {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196f3;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

h1 {
    font-size: 2rem;
    font-weight: 300;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.report-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.report-btn:hover {
    background-color: #43a047;
}

.report-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

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

.fan-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
}
.status-badge.connecting { background-color: var(--warning); color: #000; }
.status-badge.connected { background-color: var(--accent); color: #fff; }
.status-badge.disconnected { background-color: var(--danger); color: #fff; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}
.card:hover {
    transform: translateY(-2px);
}

.clickable {
    cursor: pointer;
}

.clickable:active {
    transform: translateY(0);
}

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

.card-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

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

.model-line {
    margin-top: -6px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-container {
    height: 120px;
    width: 100%;
}

.mini-stat {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.vnc-card .metric-value {
    font-size: 1.4rem;
}

.vnc-state-up {
    color: var(--accent);
}

.vnc-state-down {
    color: var(--danger);
}

.vnc-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.vnc-actions .report-btn {
    padding: 6px 12px;
}

.vnc-log-preview {
    margin: 12px 0 0;
    padding: 10px;
    min-height: 74px;
    max-height: 160px;
    overflow: auto;
    border-radius: 8px;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.progress-bar-container {
    background-color: #444;
    border-radius: 10px;
    height: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--info);
    height: 100%;
    transition: width 0.5s ease-out;
}

.storage-details, .io-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}
.io-stats {
    font-size: 0.8rem;
    opacity: 0.8;
}

.history-section {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.disk-wide-card {
    margin-bottom: 20px;
    padding: 16px 24px;
}

.disk-wide-card .card-header {
    margin-bottom: 10px;
}

.disk-wide-card .metric-value {
    font-size: 1.8rem;
}

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

.time-btn {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.time-btn:hover, .time-btn.active {
    background-color: var(--info);
    color: #fff;
    border-color: var(--info);
}

.history-chart-container {
    height: 300px;
    width: 100%;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.hidden {
    display: none;
}

.modal-content {
    width: min(680px, 92vw);
    background: var(--card-bg);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.core-list {
    max-height: 50vh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.core-item {
    background: #383838;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

@media (max-width: 900px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
}
