:root {
    /* Light Mode Colors */
    --bg-primary: #e0e5ec;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --card-bg: rgba(255, 255, 255, 0.25);

    /* Red Accent */
    --accent-color: #ef4444;
    --accent-glow: rgba(239, 68, 68, 0.3);

    /* Volume Orange */
    --volume-color: #f97316;

    /* Text Gradient (Force Orange) */
    --brand-gradient: linear-gradient(135deg, #2d3748 0%, #f97316 100%);

    --success-color: #38a169;
    --warning-color: #dd6b20;
    --error-color: #e53e3e;
    --cpu-color: #3b82f6;
    /* Blue for CPU */
    --sidebar-bg: rgba(255, 255, 255, 0.3);

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme='dark'] {
    /* Dark Mode Colors - Neutral/Darker */
    --bg-primary: #0a0a0a;
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #000000 100%);
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --glass-bg: rgba(0, 0, 0, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --card-bg: rgba(30, 30, 30, 0.4);

    /* Red Accent in Dark */
    --accent-color: #f87171;
    --accent-glow: rgba(248, 113, 113, 0.3);

    --volume-color: #fb923c;

    /* Force Light Mode Gradient in Dark Mode as requested (Orange-ish) */
    --brand-gradient: linear-gradient(135deg, #2d3748 0%, #f97316 100%);

    --sidebar-bg: rgba(10, 10, 10, 0.5);
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

#root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Logo/Brand Styles - STRONG GRADIENT */
.logo-text {
    background: linear-gradient(135deg, #dc2626 0%, #ff8c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

/* Model name within system-info-card - STRONG GRADIENT */
.sys-details h3 {
    background: linear-gradient(135deg, #dc2626 0%, #ff8c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.sys-icon svg {
    background: linear-gradient(135deg, #dc2626 0%, #ff8c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Light mode icon background */
.sys-icon {
    background: rgba(240, 240, 240, 0.95);
    border-radius: 8px;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Dark mode icon background */
[data-theme='dark'] .sys-icon {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sys-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.sys-meta {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 0.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-primary);
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(125, 125, 125, 0.1);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.7);
}

/* Page Containers - Standardized Layout */
.page-container,
.dashboard-container,
.settings-container,
.history-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem !important;
    /* Force consistent gap */
}

@media (max-width: 768px) {

    /* Container 설정 */
    .page-container,
    .dashboard-container,
    .settings-container,
    .history-container {
        padding: 0 !important;
        gap: 1rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 모든 카드를 동일하게 - CLASS 통일 */
    .glass-card,
    .stat-card,
    .settings-card,
    .chart-section,
    .system-info-card,
    .glass-panel,
    .full-width,
    .resource-card,
    .widget-grid>*,
    .stats-grid>*,
    .settings-grid>* {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 1.5rem !important;
        box-sizing: border-box !important;
    }

    /* Container children - no margins */
    .page-container>*,
    .dashboard-container>*,
    .settings-container>*,
    .history-container>* {
        margin: 0 !important;
    }

    /* settings-container 위 여백 제거 */
    .settings-container {
        padding-top: 0 !important;
    }

    /* Charts container */
    .charts-container {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Widget grids - single column with exact gap */
    .widget-grid,
    .stats-grid,
    .settings-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* mobile-header: 높이 40px, 간격 최소화 */
    .mobile-header {
        height: 40px !important;
        padding: 0.75rem 1.5rem !important;
        margin-bottom: 0.5rem !important;
        /* 간격 더 줄임 */
    }
}

/* Loading Spinner Animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-animation {
  animation: spin 1s linear infinite;
}

.loading-container-center {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  color: var(--text-secondary);
  width: 100%;
}