/* Dashboard Viewer Styles — Dark Theme */

:root {
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #eaeaea;
    --text-muted: #8b8b8b;
    --primary: #0f4c75;
    --primary-hover: #1a6da3;
    --success: #00c853;
    --warning: #ffc107;
    --danger: #ff5252;
    --border-radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Error Banner */
.error-banner {
    background: var(--danger);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    animation: pulse-bg 2s ease-in-out infinite;
}

@keyframes pulse-bg {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.health-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.875rem;
}

.health-indicator .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.health-indicator.healthy .dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.health-indicator.degraded .dot {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.health-indicator.unhealthy .dot {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.status-item label,
.detail-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
}

.status-badge.live {
    background: var(--success);
    color: #000;
}

.status-badge.idle {
    background: rgba(255, 255, 255, 0.2);
}

.status-badge.printing {
    background: var(--primary);
}

.status-badge.error {
    background: var(--danger);
}

/* Progress Bar */
.progress-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.progress-header span:first-child {
    font-weight: 600;
    font-size: 1.2rem;
}

.progress-header span:last-child {
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 6px;
    transition: width 1s ease;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item span {
    font-size: 1rem;
    font-weight: 500;
}

/* Temperature colors */
.temp-value {
    font-variant-numeric: tabular-nums;
}

.temp-value.temp-hot {
    color: var(--success);
}

.temp-value.temp-heating {
    color: var(--warning);
}

/* Watchdog Status */
.watchdog-status {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.watchdog-status h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.watchdog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
}

.watchdog-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.watchdog-item label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

#stream-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#stream-links a {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--danger);
    color: #fff;
    text-decoration: none;
}

#stream-links a:hover {
    opacity: 0.85;
}

/* Timelapse */
.timelapse-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.timelapse-preview {
    flex: 0 0 auto;
    width: 180px;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.timelapse-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.timelapse-placeholder {
    width: 100%;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 12px;
}

.timelapse-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timelapse-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timelapse-stat label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.timelapse-stat span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Now Playing (read-only) */
.now-playing {
    display: flex;
    align-items: center;
}

.track-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.track-name {
    font-size: 1.1rem;
    font-weight: 500;
}

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

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.viewer-label {
    margin-top: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }

    header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .timelapse-container {
        flex-direction: column;
        align-items: stretch;
    }

    .timelapse-preview {
        width: 100%;
        max-width: 240px;
        margin: 0 auto;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
