/* ═══════════════════════════════════════════════════════════════════════
   ScriptRunner Light — Terminal Dark Theme
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #141414;
    --bg-input: #1e1e1e;
    --border: #333;
    --border-light: #444;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-muted: #666;
    --accent-green: #39ff14;
    --accent-amber: #ffb700;
    --accent-red: #ff3333;
    --accent-blue: #569cd6;
    --accent-purple: #c586c0;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --font-sans: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

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

/* ── Layout ───────────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.nav-brand { font-size: 1.2em; font-weight: 700; }
.nav-actions { display: flex; gap: 8px; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-sans);
    transition: all 0.15s;
}
.btn:hover { border-color: var(--accent-green); color: var(--accent-green); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { border-color: var(--accent-blue); color: var(--accent-blue); }
.btn-primary:hover { background: rgba(86,156,214,0.15); border-color: var(--accent-blue); }
.btn-success { border-color: var(--accent-green); color: var(--accent-green); }
.btn-success:hover { background: rgba(57,255,20,0.1); }
.btn-danger { border-color: var(--accent-red); color: var(--accent-red); }
.btn-danger:hover { background: rgba(255,51,51,0.1); }
.btn-secondary { border-color: var(--border-light); }
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-secondary); }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.card-header:hover { background: var(--bg-secondary); }
.card-title { font-weight: 600; font-size: 15px; }
.card-subtitle { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.card-actions { display: flex; gap: 6px; align-items: center; }
.card-body { padding: 12px 16px; border-top: 1px solid var(--border); }

/* Group headers */
.group-header {
    font-size: 1.1em;
    font-weight: 700;
    padding: 16px 0 8px;
    color: var(--accent-amber);
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.group-header:hover { color: var(--accent-green); }
.group-header .collapse-icon { font-size: 10px; transition: transform 0.2s; }
.group-header.collapsed .collapse-icon { transform: rotate(-90deg); }

/* ── Status Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-idle { background: #333; color: #999; }
.badge-running { background: rgba(255,183,0,0.2); color: var(--accent-amber); }
.badge-success { background: rgba(57,255,20,0.15); color: var(--accent-green); }
.badge-failure { background: rgba(255,51,51,0.15); color: var(--accent-red); }

/* ── Log Panel ─────────────────────────────────────────────────────── */
.log-panel {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
}
.log-panel .stdout { color: #ccc; }
.log-panel .stderr { color: var(--accent-red); }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--accent-blue); }
.form-control.code-editor {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    tab-size: 4;
}
.hint { color: var(--text-muted); font-size: 11px; margin-top: 2px; display: block; }

.error-message {
    background: rgba(255,51,51,0.1);
    border: 1px solid var(--accent-red);
    border-radius: 4px;
    padding: 8px 12px;
    color: var(--accent-red);
    font-size: 13px;
    margin-bottom: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 400 !important;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; }

/* ── Login / Wizard ────────────────────────────────────────────────── */
.login-bg, .setup-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at center, #1a1a1a 0%, #0d0d0d 100%);
}

.login-container, .wizard-container {
    width: 420px;
    max-width: 90vw;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
}

.wizard-container { width: 520px; }
.login-header, .wizard-header { text-align: center; margin-bottom: 28px; }
.login-header h1, .wizard-header h1 { font-size: 1.6em; margin-bottom: 4px; }
.subtitle { color: var(--text-muted); font-size: 14px; }

.wizard-step { animation: fadeIn 0.3s ease; }

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

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}
.btn-row .btn { flex: 1; justify-content: center; }

.summary-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #222;
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text-muted); font-weight: 600; font-size: 13px; }
.summary-value { color: var(--text-primary); font-family: var(--font-mono); font-size: 13px; }

.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(13,13,13,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Step indicators */
.step-indicators {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    gap: 0;
}
.step {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s;
}
.step.active { border-color: var(--accent-blue); color: var(--accent-blue); background: rgba(86,156,214,0.15); }
.step.completed { border-color: var(--accent-green); color: var(--accent-green); background: rgba(57,255,20,0.1); }
.step-line { width: 30px; height: 2px; background: var(--border); }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}
.modal-wide { width: 700px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1em; }
.modal-body { padding: 20px; overflow-y: auto; }

/* Action table */
.action-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}
.action-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.action-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #222;
}
.action-table tr:hover td { background: var(--bg-secondary); }
.action-table .actions-cell { display: flex; gap: 4px; }

/* ── Empty state ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 1.1em; }

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.mt-8 { margin-top: 8px; }
.text-mono { font-family: var(--font-mono); font-size: 12px; }
.text-muted { color: var(--text-muted); }
