:root {
    --bg-color: #0c0e14;
    --card-bg: rgba(26, 30, 41, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f0f2f5;
    --text-muted: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

.dashboard-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: fadeInUp 0.5s ease-out forwards;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.machine-id {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.machine-id::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--accent-blue);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-blue);
}

.status-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.2);
}

.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.metric-item>div:first-of-type {
    display: flex;
    justify-content: space-between;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1rem;
    font-weight: 600;
    text-align: right;
    width: 100%;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s ease;
}

.card-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.uptime-value {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

/* Utils */
.pulse {
    animation: pulse 2s infinite;
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    background: #141824;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: #fff;
}

.modal-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
    height: 75vh;
}

.charts-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for charts container */
.charts-container::-webkit-scrollbar {
    width: 6px;
}

.charts-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.charts-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.time-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.time-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.time-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.time-btn.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
}

.chart-wrapper {
    height: 300px;
    min-height: 300px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
}

.chart-wrapper h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.chart-wrapper canvas {
    flex-grow: 1;
}

.details-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for details container */
.details-container::-webkit-scrollbar {
    width: 6px;
}

.details-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.details-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.cores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.core-item {
    font-size: 0.85rem;
}

.core-label {
    margin-bottom: 0.2rem;
}

.disks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.disk-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

.disk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.disk-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-align: right;
}

.smart-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.smart-ok {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.smart-na {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.smart-fail {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.advanced-btn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.3s;
}

.advanced-btn:hover {
    background: #2563eb;
}

.text-muted {
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    body {
        padding: 1rem;
    }
}