/* ============================================================
   Ubuntu Server Info Dashboard — Premium Glassmorphism Theme
   ============================================================ */

/* === CSS Custom Properties === */
:root {
    /* Background */
    --bg-primary: hsl(220, 25%, 6%);
    --bg-secondary: hsl(220, 20%, 10%);
    --bg-tertiary: hsl(220, 18%, 14%);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --glass-blur: 20px;

    /* Text */
    --text-primary: hsl(210, 20%, 92%);
    --text-secondary: hsl(215, 15%, 62%);
    --text-muted: hsl(215, 12%, 42%);
    --text-accent: hsl(187, 80%, 56%);

    /* Accents */
    --accent-cyan: hsl(187, 80%, 56%);
    --accent-emerald: hsl(160, 70%, 48%);
    --accent-violet: hsl(260, 60%, 60%);
    --accent-amber: hsl(38, 90%, 56%);
    --accent-rose: hsl(350, 70%, 56%);
    --accent-blue: hsl(217, 80%, 58%);

    /* Gradients */
    --gradient-accent: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
    --gradient-warm: linear-gradient(135deg, var(--accent-amber), var(--accent-rose));
    --gradient-cool: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));

    /* Status */
    --status-ok: hsl(145, 65%, 48%);
    --status-warn: hsl(38, 90%, 56%);
    --status-critical: hsl(0, 72%, 56%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.15);
    --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.15);

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === App Container === */
.app {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Ambient Background === */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2), transparent 70%);
    top: -10%;
    right: -5%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent 70%);
    bottom: -5%;
    left: -5%;
    animation-delay: -7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent 70%);
    top: 40%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 30px) scale(1.02); }
}

/* === Header === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: rgba(10, 14, 23, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
}

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

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.logo-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 400;
}

/* Status indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.75rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--status-warn);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.online {
    background: var(--status-ok);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.error {
    background: var(--status-critical);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.status-text {
    color: var(--text-secondary);
}

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

/* Last updated */
.last-updated {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Refresh button */
.btn-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-refresh:hover {
    background: var(--glass-hover);
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: var(--shadow-glow-cyan);
}

.btn-refresh.spinning svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Countdown ring */
.countdown-ring {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-text {
    position: absolute;
    font-size: 0.6rem;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-muted);
}

/* === Main Content === */
.main {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Loading state */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1.5rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Error state */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1rem;
    color: var(--text-secondary);
}

.error-state svg {
    color: var(--status-critical);
    opacity: 0.7;
}

.error-state h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-retry {
    margin-top: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: var(--gradient-accent);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-retry:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow-cyan);
}

/* === Dashboard Grid === */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.25rem;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Info Card === */
.info-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    overflow: hidden;
    transition: all var(--transition-base);
    animation: cardFadeIn 0.4s ease-out both;
}

.info-card:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card header */
.card-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.2rem 0.6rem;
}

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

.card-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.card-icon.system    { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.card-icon.os        { background: rgba(139, 92, 246, 0.12); color: var(--accent-violet); }
.card-icon.kernel    { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.card-icon.cpu       { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }
.card-icon.memory    { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.card-icon.disk      { background: rgba(244, 63, 94, 0.12); color: var(--accent-rose); }
.card-icon.network   { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.card-icon.uptime    { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.card-icon.load      { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }
.card-icon.php       { background: rgba(139, 92, 246, 0.12); color: var(--accent-violet); }
.card-icon.apache    { background: rgba(244, 63, 94, 0.12); color: var(--accent-rose); }
.card-icon.processes { background: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
}

/* Card body */
.card-body {
    padding: 0.4rem 1.2rem 1rem;
}

/* Key-value rows */
.kv-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    gap: 1rem;
}

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

.kv-key {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.kv-value {
    font-size: 0.78rem;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    max-width: 60%;
}

.kv-value.highlight {
    color: var(--accent-cyan);
}

/* === Progress Bars === */
.progress-container {
    padding: 0.35rem 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

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

.progress-label-value {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-fill.ok       { background: var(--gradient-accent); }
.progress-fill.warn     { background: linear-gradient(90deg, var(--accent-amber), hsl(25, 90%, 52%)); }
.progress-fill.critical { background: linear-gradient(90deg, var(--accent-rose), hsl(0, 80%, 48%)); }

/* === Process Table === */
.process-table {
    width: 100%;
    font-size: 0.72rem;
    border-collapse: collapse;
}

.process-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--glass-border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
}

.process-table td {
    padding: 0.25rem 0.4rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.process-table tr:hover td {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

/* Process section title */
.process-section-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0.6rem 0 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid var(--glass-border);
}

/* === Extensions List === */
.extensions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding-top: 0.3rem;
}

.ext-tag {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    padding: 0.15rem 0.45rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    color: var(--text-secondary);
}

/* === Disk Section === */
.disk-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.disk-item:last-child {
    border-bottom: none;
}

.disk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.disk-mount {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent-cyan);
}

.disk-device {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
}

.disk-details {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* === Network Interface === */
.net-iface {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.net-iface:last-child {
    border-bottom: none;
}

.net-iface-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.net-iface-name {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.net-state {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.net-state.up {
    background: rgba(34, 197, 94, 0.12);
    color: var(--status-ok);
}

.net-state.down {
    background: rgba(239, 68, 68, 0.12);
    color: var(--status-critical);
}

.net-state.unknown {
    background: rgba(245, 158, 11, 0.12);
    color: var(--status-warn);
}

/* === Footer === */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
}

.footer-sep {
    margin: 0 0.3rem;
    opacity: 0.4;
}

/* === Data update pulse === */
.data-updated {
    animation: dataFlash 0.6s ease-out;
}

@keyframes dataFlash {
    0% { background-color: rgba(6, 182, 212, 0.08); }
    100% { background-color: transparent; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .main {
        padding: 1rem;
    }

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

    .kv-value {
        max-width: 55%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .header {
        padding: 0.6rem 0.8rem;
    }

    .status-indicator {
        display: none;
    }

    .last-updated {
        display: none;
    }

    .dashboard-grid {
        gap: 0.8rem;
    }
}

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

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

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

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

/* === Selection === */
::selection {
    background: rgba(6, 182, 212, 0.3);
    color: var(--text-primary);
}
