/* Customer Dashboard — Fireclaw */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&family=Space+Mono:wght@400;700&display=swap');

/* --- Color System --- */

/* Light mode (default) */
:root {
    --bg: #fafafa;
    --surface: #fff;
    --surface-hover: #f5f5f5;
    --border: #e5e5e5;
    --text: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --fire: #ea580c;
    --fire-dim: rgba(234,88,12,0.08);
    --green: #16a34a;
    --green-dim: rgba(22,163,74,0.08);
    --yellow: #ca8a04;
    --yellow-dim: rgba(202,138,4,0.08);
    --red: #dc2626;
    --red-dim: rgba(220,38,38,0.08);
    --gray: #6b7280;
}

/* Dark mode via system preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000;
        --surface: #0a0a0a;
        --surface-hover: #111;
        --border: #1a1a1a;
        --text: #fafafa;
        --text-secondary: #a3a3a3;
        --text-muted: #525252;
        --fire: #f97316;
        --fire-dim: rgba(249,115,22,0.12);
        --green: #22c55e;
        --green-dim: rgba(34,197,94,0.12);
        --yellow: #eab308;
        --yellow-dim: rgba(234,179,8,0.12);
        --red: #ef4444;
        --red-dim: rgba(239,68,68,0.12);
        --gray: #9ca3af;
    }
}

/* Explicit overrides */
[data-theme="light"] {
    --bg: #fafafa;
    --surface: #fff;
    --surface-hover: #f5f5f5;
    --border: #e5e5e5;
    --text: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --fire: #ea580c;
    --fire-dim: rgba(234,88,12,0.08);
    --green: #16a34a;
    --green-dim: rgba(22,163,74,0.08);
    --yellow: #ca8a04;
    --yellow-dim: rgba(202,138,4,0.08);
    --red: #dc2626;
    --red-dim: rgba(220,38,38,0.08);
    --gray: #6b7280;
}

[data-theme="dark"] {
    --bg: #000;
    --surface: #0a0a0a;
    --surface-hover: #111;
    --border: #1a1a1a;
    --text: #fafafa;
    --text-secondary: #a3a3a3;
    --text-muted: #525252;
    --fire: #f97316;
    --fire-dim: rgba(249,115,22,0.12);
    --green: #22c55e;
    --green-dim: rgba(34,197,94,0.12);
    --yellow: #eab308;
    --yellow-dim: rgba(234,179,8,0.12);
    --red: #ef4444;
    --red-dim: rgba(239,68,68,0.12);
    --gray: #9ca3af;
}

/* --- Reset --- */

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--fire); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Navigation --- */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-brand {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: -0.02em;
    margin-right: 8px;
}

.nav-brand .brand-highlight {
    color: var(--text);
}

.nav a {
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    padding: 16px 0;
    border-bottom: 2px solid transparent;
    text-decoration: none;
}

.nav a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav a.active {
    color: var(--fire);
    border-bottom-color: var(--fire);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
    border-color: var(--fire);
    color: var(--fire);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* Show sun in dark mode, moon in light mode */
.icon-sun { display: none; }
.icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
    .icon-sun { display: block; }
    .icon-moon { display: none; }
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* --- Layout --- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px 48px;
}

/* --- Cards --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.card-title {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.card-value {
    font-family: 'Manrope', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Tables --- */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th {
    text-align: left;
    padding: 10px 16px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

tr:hover td {
    background: var(--fire-dim);
}

/* --- Status Badges --- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
}

.badge-running, .badge-healthy { background: var(--green-dim); color: var(--green); }
.badge-booting, .badge-provisioning, .badge-resetting, .badge-degraded { background: var(--yellow-dim); color: var(--yellow); }
.badge-failed, .badge-unhealthy, .badge-unreachable { background: var(--red-dim); color: var(--red); }
.badge-pending, .badge-stopped, .badge-destroyed, .badge-stopping { background: var(--surface-hover); color: var(--gray); }

/* --- Buttons --- */

.btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    text-decoration: none;
}

.btn:hover {
    border-color: var(--fire);
    text-decoration: none;
}

.btn-primary {
    background: var(--fire);
    border-color: var(--fire);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-danger {
    border-color: var(--red);
    color: var(--red);
}

.btn-danger:hover {
    background: var(--red-dim);
}

.btn-warning {
    border-color: var(--yellow);
    color: var(--yellow);
}

.btn-warning:hover {
    background: var(--yellow-dim);
}

.actions {
    display: flex;
    gap: 8px;
}

/* --- Forms --- */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--fire);
}

.form-hint {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Console --- */

.console {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--green);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 16px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* --- Events --- */

.event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-item {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    align-items: center;
}

.event-time {
    color: var(--text-muted);
    white-space: nowrap;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
}

.event-type {
    font-weight: 700;
    white-space: nowrap;
    color: var(--text);
}

/* --- Section Header --- */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h2 {
    font-family: 'Manrope', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

/* --- Subtitle --- */

.subtitle {
    color: var(--text-muted);
    font-size: 13px;
}

/* --- Detail Grid --- */

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    padding: 16px;
}

.detail-label {
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
}

/* --- Alerts --- */

.alert-error {
    background: var(--red-dim);
    border: 1px solid var(--red);
    color: var(--red);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-warning {
    background: var(--yellow-dim);
    border: 1px solid var(--yellow);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--yellow);
    font-size: 13px;
}

/* --- Empty State --- */

.empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
}

/* --- Utilities --- */

.mt-1 { margin-top: 16px; }
.mb-1 { margin-bottom: 16px; }

/* --- Responsive --- */

@media (max-width: 640px) {
    .nav-left {
        gap: 12px;
    }

    .nav a {
        font-size: 11px;
    }

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

    .container {
        padding: 72px 16px 32px;
    }

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

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
