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

/* CSS Variables for theming */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --color-primary: #00ffff;
    --color-secondary: #00cccc;
    --color-text: #00ffff;
    --color-warning: #ff00ff;
    --color-critical: #ffffff;
    --border-color: #00ffff;
    --shadow-color: rgba(0, 255, 255, 0.3);
    --shadow-color-intense: rgba(0, 255, 255, 0.6);
    --panel-hover-gradient: linear-gradient(45deg, #00ffff, #ff00ff, #00ffff);
    --progress-gradient: linear-gradient(90deg, #00ffff, #00cccc);
    --progress-warning: linear-gradient(90deg, #ff00ff, #ff00cc);
    --progress-critical: linear-gradient(90deg, #ffffff, #cccccc);
    --scanline-color: #00ffff;
}

body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f5fa;
    --bg-tertiary: #d9e6f2;
    --color-primary: #0052a3;
    --color-secondary: #003d7a;
    --color-text: #002952;
    --color-warning: #d9534f;
    --color-critical: #c9302c;
    --border-color: #0066cc;
    --shadow-color: rgba(0, 82, 163, 0.2);
    --shadow-color-intense: rgba(0, 82, 163, 0.4);
    --panel-hover-gradient: linear-gradient(45deg, #0066cc, #d9534f, #0066cc);
    --progress-gradient: linear-gradient(90deg, #0066cc, #0052a3);
    --progress-warning: linear-gradient(90deg, #f0ad4e, #ec971f);
    --progress-critical: linear-gradient(90deg, #d9534f, #c9302c);
    --scanline-color: #0066cc;
}

@keyframes borderGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.3), 0 0 30px rgba(0, 255, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 255, 255, 0.6), 0 0 50px rgba(0, 255, 255, 0.3);
    }
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    }
    50% {
        text-shadow: 0 0 20px #00ffff, 0 0 30px #00ffff, 0 0 40px #00ffff, 0 0 50px #00ffff;
    }
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

body {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-primary);
    color: var(--color-text);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--scanline-color), transparent);
    animation: scanline 4s linear infinite;
    opacity: 0.3;
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.title {
    font-size: 2.5rem;
    letter-spacing: 4px;
    color: var(--color-primary);
    margin-bottom: 10px;
}

body:not(.light-mode) .title {
    text-shadow: 0 0 10px var(--color-primary), 0 0 20px var(--color-primary);
    animation: titleGlow 3s ease-in-out infinite;
}

.timestamp {
    font-size: 0.9rem;
    color: var(--color-secondary);
    letter-spacing: 2px;
}

.grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.grid-row-1 {
    grid-template-columns: 2fr 1fr;
}

.grid-row-2 {
    grid-template-columns: 1fr 1fr;
}

.panel {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    padding: 20px;
    box-shadow: 0 0 15px var(--shadow-color);
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body:not(.light-mode) .panel {
    animation: borderGlow 2s ease-in-out infinite;
}

.panel::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--panel-hover-gradient);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0px;
}

.panel:hover::before {
    opacity: 0.3;
}

.panel-wide {
    grid-column: 1 / -1;
}

.panel-title {
    font-size: 1.2rem;
    letter-spacing: 3px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--color-primary);
}

body:not(.light-mode) .panel-title {
    text-shadow: 0 0 5px var(--color-primary);
}

/* Resource Section */
.resources-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: center;
}

/* Disk Usage Layout */
.disk-usage-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
}

.disk-array-column {
    display: flex;
    flex-direction: column;
}

.ring-chart-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ring-chart-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ring-chart-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mini-ring-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-bars-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.resource-item {
    margin-bottom: 20px;
    padding: 10px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.light-mode .resource-item {
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    padding: 15px;
}

.resource-label {
    font-size: 0.9rem;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.ring-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.ring-chart {
    width: 180px;
    height: 180px;
}

.mini-ring-chart {
    width: 160px;
    height: 160px;
}

.ring-progress {
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
    filter: drop-shadow(0 0 8px currentColor);
}

.ring-text {
    font-size: 2rem;
    font-weight: bold;
    fill: var(--color-primary);
    font-family: 'Courier New', monospace;
}

.ring-text-small {
    font-size: 1.5rem;
    font-weight: bold;
    fill: var(--color-primary);
    font-family: 'Courier New', monospace;
}

.ring-fraction {
    font-size: 0.7rem;
    fill: var(--color-primary);
    font-family: 'Courier New', monospace;
    opacity: 1;
}

.ring-fraction-small {
    font-size: 0.5rem;
    fill: var(--color-primary);
    font-family: 'Courier New', monospace;
    opacity: 1;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 20px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.progress-fill {
    height: 100%;
    background: var(--progress-gradient);
    transition: width 0.3s ease, background 0.3s ease;
    box-shadow: 0 0 10px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.progress-fill.warning {
    background: var(--progress-warning);
    box-shadow: 0 0 10px var(--shadow-color-intense);
}

.progress-fill.critical {
    background: var(--progress-critical);
    box-shadow: 0 0 10px var(--shadow-color-intense);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 0.75rem;
    color: #ffffff;
}

body.light-mode .progress-text {
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

body:not(.light-mode) .progress-text {
    text-shadow: 1px 1px 2px #000000;
}

/* Parity Status */
.status-grid {
    display: grid;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: var(--bg-tertiary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body:not(.light-mode) .status-item {
    border-left: 3px solid var(--border-color);
}

body.light-mode .status-item {
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.status-label {
    font-weight: bold;
    letter-spacing: 1px;
}

.status-value {
    color: var(--color-primary);
}

.status-value.error {
    color: var(--color-critical);
}

body:not(.light-mode) .status-value.error {
    text-shadow: 0 0 5px var(--color-critical);
}

/* Disk Array */
.disk-item {
    margin-bottom: 8px;
    padding: 8px;
    background-color: var(--bg-tertiary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body:not(.light-mode) .disk-item {
    border-left: 3px solid var(--border-color);
}

body.light-mode .disk-item {
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.disk-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.disk-name {
    font-weight: bold;
    letter-spacing: 1px;
}

.disk-info {
    color: var(--color-secondary);
}

/* Docker Containers */
.docker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.docker-item {
    padding: 15px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.docker-name {
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 1px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.docker-status {
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.docker-status.running {
    background-color: #00ffff;
    color: #003d7a;
    box-shadow: 0 0 5px #00ffff;
    font-weight: bold;
}

body.light-mode .docker-status.running {
    background-color: #00cc99;
    color: #ffffff;
    box-shadow: 0 0 5px rgba(0, 204, 153, 0.5);
}

.docker-status.stopped,
.docker-status.offline {
    background-color: #666666;
    color: #ffffff;
    box-shadow: 0 0 5px #666666;
}

body.light-mode .docker-status.stopped,
body.light-mode .docker-status.offline {
    background-color: #6c757d;
    color: #ffffff;
    box-shadow: 0 0 5px rgba(108, 117, 125, 0.5);
}

.docker-status.paused {
    background-color: #ff00ff;
    color: #003d7a;
    box-shadow: 0 0 5px #ff00ff;
}

body.light-mode .docker-status.paused {
    background-color: #f0ad4e;
    color: #ffffff;
    box-shadow: 0 0 5px rgba(240, 173, 78, 0.5);
}

.webui-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 2px 6px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    transition: all 0.3s ease;
    display: inline-block;
}

.webui-link:hover {
    background-color: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 10px var(--shadow-color-intense);
    text-shadow: none;
    transform: scale(1.05);
}

/* Tooltips */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 0 20px var(--shadow-color-intense);
    min-width: 200px;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease;
    pointer-events: none;
    animation: fadeIn 0.3s ease;
}

.tooltip-container:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.tooltip-title {
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.tooltip-content {
    color: var(--color-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.tooltip-label {
    color: var(--color-primary);
}

.tooltip-value {
    color: var(--color-text);
    font-weight: bold;
}

/* Trend Indicators */
.trend-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8rem;
    animation: pulse 2s ease-in-out infinite;
}

.trend-up {
    color: var(--color-warning);
}

.trend-down {
    color: var(--color-primary);
}

.trend-stable {
    color: var(--color-secondary);
    opacity: 0.5;
}

/* Enhanced Ring Chart Container */
.mini-ring-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.mini-ring-chart-container:hover {
    transform: scale(1.05);
}

.mini-ring-chart-container .tooltip {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
}

/* Enhanced text transitions */
.ring-text, .ring-text-small {
    transition: fill 0.3s ease;
}

.ring-fraction, .ring-fraction-small {
    transition: fill 0.3s ease;
}

/* Disk item enhancements */
.disk-item {
    transition: background-color 0.3s ease, border-left-color 0.3s ease;
    cursor: pointer;
}

body:not(.light-mode) .disk-item:hover {
    background-color: #252525;
    border-left-color: #ff00ff;
}

body.light-mode .disk-item:hover {
    background-color: #d0d0d0;
    border-left-color: var(--color-warning);
}

/* Light mode text overrides to ensure no black text */
body.light-mode .disk-name,
body.light-mode .docker-name,
body.light-mode .status-label,
body.light-mode .resource-label {
    color: var(--color-text);
}

body.light-mode .disk-info {
    color: var(--color-secondary);
}

.disk-item .tooltip {
    top: 0;
    left: 100%;
    margin-left: 10px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--color-primary);
    padding: 10px 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--shadow-color);
    z-index: 1000;
}

.theme-toggle:hover {
    background-color: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 20px var(--shadow-color-intense);
    transform: scale(1.05);
}

body:not(.light-mode) .theme-toggle:hover {
    text-shadow: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

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

    .docker-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .tooltip {
        min-width: 150px;
        font-size: 0.75rem;
    }
}
