/* Claude Code Terminal — Design tokens (inspired by Elena/arbetsmiljo) */
:root {
    --av-bg: #f4f6f8;
    --av-bg-card: #ffffff;
    --av-bg-input: #ffffff;
    --av-text: #1a1a2e;
    --av-text-muted: #5a6070;
    --av-primary: #005293;
    --av-primary-hover: #003d6e;
    --av-primary-text: #ffffff;
    --av-border: #d0d5dd;
    --av-border-focus: #005293;
    --av-error: #c0392b;
    --av-error-bg: #fdf0ef;
    --av-success: #27ae60;
    --av-success-bg: #edf9f0;
    --av-radius: 8px;
    --av-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --av-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --av-header-bg: #005293;
    --av-header-text: #ffffff;
}

[data-theme="dark"] {
    --av-bg: #0f111a;
    --av-bg-card: #1a1d2e;
    --av-bg-input: #252838;
    --av-text: #e4e6eb;
    --av-text-muted: #9ca3b0;
    --av-primary: #4a9eff;
    --av-primary-hover: #6bb3ff;
    --av-primary-text: #0f111a;
    --av-border: #2d3040;
    --av-border-focus: #4a9eff;
    --av-error: #e74c3c;
    --av-error-bg: #2d1a1a;
    --av-success: #2ecc71;
    --av-success-bg: #1a2d1a;
    --av-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --av-header-bg: #141728;
    --av-header-text: #e4e6eb;
}

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

html, body {
    height: 100%;
    font-family: var(--av-font);
    background: var(--av-bg);
    color: var(--av-text);
    line-height: 1.5;
}

/* ── Auth card layout ──────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--av-bg-card);
    border-radius: var(--av-radius);
    box-shadow: var(--av-shadow);
    padding: 2rem;
    border: 1px solid var(--av-border);
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-card .subtitle {
    color: var(--av-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--av-text);
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--av-border);
    border-radius: var(--av-radius);
    background: var(--av-bg-input);
    color: var(--av-text);
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--av-border-focus);
    box-shadow: 0 0 0 3px rgba(0, 82, 147, 0.15);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--av-radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--av-primary);
    color: var(--av-primary-text);
    width: 100%;
}

.btn-primary:hover { background: var(--av-primary-hover); }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    width: auto;
}

.btn-danger {
    background: var(--av-error);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--av-border);
    color: var(--av-text);
}

.btn-outline:hover { background: var(--av-bg); }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--av-radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: var(--av-error-bg);
    color: var(--av-error);
    border: 1px solid var(--av-error);
}

.alert-success {
    background: var(--av-success-bg);
    color: var(--av-success);
    border: 1px solid var(--av-success);
}

/* ── Header bar ────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 48px;
    background: var(--av-header-bg);
    color: var(--av-header-text);
    font-size: 0.9rem;
}

.topbar a {
    color: var(--av-header-text);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.topbar a:hover { opacity: 1; }

.topbar-links { display: flex; gap: 1rem; align-items: center; }

/* ── Terminal page ─────────────────────────────────────────────────────── */
.terminal-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#terminal-container {
    flex: 1;
    background: #1e1e2e;
    overflow: hidden;
}

/* ── Admin page ────────────────────────────────────────────────────────── */
.admin-page {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.admin-page h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-section {
    background: var(--av-bg-card);
    border: 1px solid var(--av-border);
    border-radius: var(--av-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--av-shadow);
}

.admin-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--av-border);
}

/* ── Tables ────────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--av-border);
}

.data-table th {
    font-weight: 600;
    color: var(--av-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tr:last-child td { border-bottom: none; }

/* ── Invite code display ───────────────────────────────────────────────── */
.invite-code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    background: var(--av-bg-input);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--av-border);
    font-size: 0.85rem;
    user-select: all;
}

/* ── Theme toggle ──────────────────────────────────────────────────────── */
.theme-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--av-border);
    background: var(--av-bg-card);
    color: var(--av-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--av-shadow);
    transition: background 0.15s;
    z-index: 100;
}

.theme-toggle:hover { background: var(--av-bg); }

/* ── Utility ───────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--av-text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ── Dashboard / App cards ────────────────────────────────────────────── */
.app-card { position: relative; }

.app-actions { display: flex; gap: 0.5rem; }

.app-url {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.85rem;
    color: var(--av-primary);
    text-decoration: none;
}

.app-url:hover { text-decoration: underline; }

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.status-active { background: var(--av-success); }
.status-stopped { background: var(--av-error); }

.resource-display, .peak-display {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal .auth-card {
    max-width: 360px;
    animation: fadeIn 0.15s ease;
}

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

.modal input[type="range"] {
    width: 100%;
    margin-top: 0.25rem;
}
