/* ========================================
   K8s Pod Visualizer — Midnight Aurora Theme
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #6C5CE7;
    --primary-glow: rgba(108, 92, 231, 0.2);
    --secondary: #A29BFE;
    --accent: #FD79A8;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #E17055;

    --bg-deep: #0D0B1E;
    --bg-base: #161432;
    --bg-surface: #1E1B3A;
    --bg-elevated: #2D2952;
    --text-primary: #F1F0FF;
    --text-secondary: #9B97C0;
    --text-muted: #6B6793;
    --border: rgba(108, 92, 231, 0.2);
    --border-hover: rgba(162, 155, 254, 0.3);

    --radius: 12px;
    --radius-sm: 8px;
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: 250ms ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.1rem;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.header-actions {
    display: flex;
    gap: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

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

.btn-primary:hover {
    background: #5A4BD6;
}

.btn-large {
    padding: 10px 24px;
    font-size: 0.85rem;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.72rem;
}

.card {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.section-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.section-hint code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--secondary);
    background: var(--bg-surface);
    padding: 1px 5px;
    border-radius: 4px;
}

.input-area {
    width: 100%;
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    resize: vertical;
    line-height: 1.6;
    margin-bottom: 12px;
}

.input-area:focus {
    border-color: var(--primary);
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-running .stat-value {
    color: var(--success);
}

.stat-pending .stat-value {
    color: var(--warning);
}

.stat-failed .stat-value {
    color: var(--danger);
}

/* Namespace Groups */
.namespace-group {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}

.namespace-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.namespace-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.pods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.pod-card {
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.pod-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pod-status-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-running {
    background: var(--success);
    box-shadow: 0 0 6px rgba(0, 184, 148, 0.5);
}

.status-pending {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(253, 203, 110, 0.4);
}

.status-failed {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(225, 112, 85, 0.4);
}

.status-succeeded {
    background: var(--secondary);
}

.status-unknown {
    background: var(--text-muted);
}

.pod-name {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 6px;
    line-height: 1.3;
}

.pod-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.pod-card.bg-running {
    background: rgba(0, 184, 148, 0.06);
}

.pod-card.bg-pending {
    background: rgba(253, 203, 110, 0.06);
}

.pod-card.bg-failed {
    background: rgba(225, 112, 85, 0.08);
}

/* Gauges */
.gauge-row {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.gauge {
    flex: 1;
}

.gauge-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.gauge-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 10px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.gauge-fill.low {
    background: var(--success);
}

.gauge-fill.mid {
    background: var(--warning);
}

.gauge-fill.high {
    background: var(--danger);
}

/* Detail Panel */
.detail-panel {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
    animation: fadeIn 0.3s ease-out;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.detail-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.detail-body {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(108, 92, 231, 0.1);
}

.detail-key {
    color: var(--text-muted);
}

.detail-val {
    color: var(--text-primary);
    text-align: right;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 14px;
    background: rgba(22, 20, 50, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-primary);
    animation: toast-in 0.3s ease-out;
}

.toast.success {
    border-left: 3px solid var(--success);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .logo span {
        display: none;
    }
}