/* ============================================
   Dashboard Raspberry Pi - Glassmorphism Style
   ============================================ */

/* Variables CSS */
:root {
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-hover: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.4);

    --color-primary: #8b5cf6;
    --color-secondary: #ec4899;
    --color-accent: #06b6d4;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 40px;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Fixed Gradient Background
   ============================================ */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg,
        #1a1a2e 0%,
        #16213e 25%,
        #0f3460 50%,
        #533483 75%,
        #e94560 100%
    );
    background-attachment: fixed;
}

/* ============================================
   Glass Components
   ============================================ */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-normal);
}

.glass-panel:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.glass-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
    transform: translateY(-4px);
}

.glass-badge {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 span {
    color: var(--color-accent);
    font-weight: 700;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-indicator .pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse 2s ease infinite;
}

.status-indicator.inactive .pulse {
    background: var(--color-danger);
    animation: none;
}

.status-indicator.inactive .status-text {
    color: var(--color-danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.card-wide {
    grid-column: span 2;
}

/* ============================================
   Card Components
   ============================================ */
.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon svg {
    width: 22px;
    height: 22px;
}

.cpu-icon {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.ram-icon {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.temp-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.disk-icon {
    background: rgba(6, 182, 212, 0.2);
    color: #22d3ee;
}

.network-icon {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.process-icon {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* ============================================
   Circular Progress
   ============================================ */
.circular-progress {
    position: relative;
    width: 140px;
    height: 140px;
}

.circular-progress svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
    stroke-linecap: round;
}

.progress-fill {
    fill: none;
    stroke: url(#gradient-cpu);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset var(--transition-normal);
}

#ram-circle {
    stroke: url(#gradient-ram);
}

.progress-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-value span {
    font-size: 2rem;
    font-weight: 700;
}

.progress-value small {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Metrics Detail */
.metrics-detail {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-row span:first-child {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.metric-row span:last-child {
    font-weight: 500;
    font-size: 0.9375rem;
}

/* ============================================
   Temperature Display
   ============================================ */
.temp-display {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.temp-display #temp-value {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
}

.temp-unit {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.temp-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.temp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-success), var(--color-warning), var(--color-danger));
    border-radius: 20px;
    transition: width var(--transition-normal);
}

.temp-labels {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.temp-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   Disk Progress
   ============================================ */
.disk-progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.linear-progress {
    flex: 1;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
}

.linear-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #06b6d4, #3b82f6);
    border-radius: 20px;
    transition: width var(--transition-normal);
}

.disk-percentage {
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
}

.disk-percentage small {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============================================
   Network Stats
   ============================================ */
.network-stats {
    width: 100%;
    display: flex;
    justify-content: space-around;
    gap: 2rem;
}

.network-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.network-icon-small {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.network-icon-small.down {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.network-icon-small.up {
    background: rgba(236, 72, 153, 0.15);
    color: var(--color-secondary);
}

.network-info {
    display: flex;
    flex-direction: column;
}

.network-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.network-speed {
    font-size: 1.5rem;
    font-weight: 700;
}

.network-total {
    width: 100%;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ============================================
   Process List
   ============================================ */
.process-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 220px;
    overflow-y: auto;
}

.process-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    min-height: 48px;
    flex-shrink: 0;
}

.process-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.process-item.placeholder {
    justify-content: center;
    color: var(--text-muted);
}

.process-item.placeholder-empty {
    background: rgba(255, 255, 255, 0.02);
    opacity: 0.5;
}

.process-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.process-name {
    font-weight: 500;
    font-size: 0.9375rem;
}

.process-pid {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.process-stats {
    display: flex;
    gap: 1.5rem;
}

.process-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.process-stat-value {
    font-weight: 600;
    font-size: 0.9375rem;
}

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

/* ============================================
   Footer
   ============================================ */
.footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.update-time {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
}

/* ============================================
   SVG Gradients (inline styles for dynamic)
   ============================================ */
/* Gradients pour les cercles de progression */
#cpu-circle {
    stroke: #8b5cf6;
}

#ram-circle {
    stroke: #ec4899;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-left {
        flex-direction: column;
    }

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

    .card-wide {
        grid-column: span 1;
    }

    .circular-progress {
        width: 120px;
        height: 120px;
    }

    .progress-value span {
        font-size: 1.75rem;
    }

    .temp-display #temp-value {
        font-size: 2.5rem;
    }

    .network-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .network-stat {
        justify-content: center;
    }

    .process-stats {
        gap: 0.75rem;
    }

    .process-stat {
        align-items: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.25rem;
    }

    .glass-card {
        padding: 1rem;
    }

    .process-item {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .process-stats {
        width: 100%;
        justify-content: space-between;
    }

    .process-stat {
        align-items: flex-start;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass-card {
    animation: fadeIn 0.5s ease forwards;
}

.glass-card:nth-child(1) { animation-delay: 0.1s; }
.glass-card:nth-child(2) { animation-delay: 0.2s; }
.glass-card:nth-child(3) { animation-delay: 0.3s; }
.glass-card:nth-child(4) { animation-delay: 0.4s; }
.glass-card:nth-child(5) { animation-delay: 0.5s; }
.glass-card:nth-child(6) { animation-delay: 0.6s; }

/* Warning states */
.warning {
    color: var(--color-warning) !important;
}

.danger {
    color: var(--color-danger) !important;
}

.temp-bar.warning {
    background: linear-gradient(90deg, var(--color-success), var(--color-warning));
}

.temp-bar.danger {
    background: linear-gradient(90deg, var(--color-warning), var(--color-danger));
}
