/*
 * opsdash — the one stylesheet. Taken from the redesign mock-up
 * (opsdash-redesign/style.css, October 2026) and extended by the pieces the
 * real pages need beyond the mock-up: alerts, checkboxes, the job flow of a
 * pipeline, empty states, the footer, the error page.
 *
 * Fonts come from WebJars (Fontsource), never from a CDN (decision 6).
 */
@import url('/webjars/fontsource__inter/5.2.5/latin-400-c95232f538146b47e6f420e15f9e0c35.css');
@import url('/webjars/fontsource__inter/5.2.5/latin-500-2b36f2be70551fbc3e88756becee8861.css');
@import url('/webjars/fontsource__inter/5.2.5/latin-600-2855d3dac45b4a01bb3597f238a10f72.css');
@import url('/webjars/fontsource__outfit/4.5.10/latin-300-19cc5882a5dd95df8964faff7e346ead.css');
@import url('/webjars/fontsource__outfit/4.5.10/latin-400-ba3042d9a7ade779739df9f5474154ed.css');
@import url('/webjars/fontsource__outfit/4.5.10/latin-600-9a4d2cb4fa854ecb7165aad06e6f43c4.css');
@import url('/webjars/fontsource__outfit/4.5.10/latin-800-a4b65c42fe49d34e5867a891c03fdca0.css');

:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(168, 85, 247, 0.5);
    /* Violet */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.4);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.1), transparent 25%),
        radial-gradient(circle at 60% 80%, rgba(168, 85, 247, 0.15), transparent 40%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

a {
    color: var(--accent);
}

code {
    font-family: 'Consolas', 'Courier New', monospace;
    color: #e879f9;
    font-size: 0.9em;
}

.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #e879f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.text-success {
    color: #34d399;
}

.text-danger {
    color: #f87171;
}

.text-warning {
    color: #fbbf24;
}

.text-nowrap {
    white-space: nowrap;
}

.small {
    font-size: 0.85rem;
}

svg.feather {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.icon-sm svg.feather,
svg.feather.icon-sm {
    width: 14px;
    height: 14px;
}

/* Layout - Full Width */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
}

/* Logout is a POST (CSRF), so the nav link is a button in a form. */
.nav-form {
    display: flex;
}

button.nav-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.page-wrapper {
    flex-grow: 1;
    padding: 2rem;
    width: 100%;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.page-subtitle {
    margin-top: 0.5rem;
    letter-spacing: 1px;
}

.page-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 0.5rem;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 2rem;
    border-top: 1px solid var(--card-border);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Glass Cards */
.glass-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.glass-panel.flush {
    padding: 0;
    overflow: hidden;
}

.glass-panel.highlight {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.1);
}

.panel-title {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.panel-title > span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.glass-panel.flush .panel-title {
    margin: 0;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.panel-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.panel-text {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.split-layout.wide-left {
    grid-template-columns: 7fr 5fr;
}

@media (max-width: 1024px) {
    .split-layout,
    .split-layout.wide-left {
        grid-template-columns: 1fr;
    }
}

/* Grids */
.grid-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.action-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
    pointer-events: none;
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--card-hover-border);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(168, 85, 247, 0.1);
}

.action-card:hover::before {
    opacity: 0.1;
}

.action-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #d8b4fe;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.action-card:hover .action-icon {
    background: rgba(168, 85, 247, 0.2);
    color: #fff;
    transform: scale(1.1);
}

.action-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    z-index: 1;
    position: relative;
}

.action-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    z-index: 1;
    position: relative;
}

/* Data Table */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.data-table th {
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--card-border);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr.clickable-row {
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

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

.cell-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
    text-decoration: none;
    display: inline-block;
}

.cell-muted {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cell-code {
    color: var(--accent);
    font-family: 'Consolas', 'Courier New', monospace;
}

.cell-long {
    max-width: 32rem;
}

.cell-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-actions {
    text-align: right;
    white-space: nowrap;
}

.empty-state {
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge svg.feather {
    width: 12px;
    height: 12px;
}

.badge-outline,
.badge-secondary {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-primary {
    background: rgba(168, 85, 247, 0.15);
    color: #e879f9;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
    background: #d8b4fe;
    color: #1e1b4b;
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--card-border);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

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

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
}

.form-select option {
    background-color: #1e293b;
    color: #fff;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.form-check input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

.form-check label {
    font-weight: 600;
    cursor: pointer;
}

.form-text {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* Pipeline Chevron Flow (the three steps of a run) */
.pipeline-flow {
    display: flex;
    flex-wrap: wrap;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
}

.pipeline-step {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.pipeline-step small {
    font-weight: 400;
    opacity: 0.8;
}

.pipeline-step:not(:last-child) {
    border-right: 1px solid var(--card-border);
}

.pipeline-step.active,
.pipeline-step.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.pipeline-step.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.pipeline-step.pending,
.pipeline-step.primary {
    background: rgba(168, 85, 247, 0.15);
    color: #e879f9;
}

.pipeline-step.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* The jobs of one pipeline: same look, smaller. */
.pipeline-flow.jobs .pipeline-step {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
}

a.pipeline-step:hover {
    filter: brightness(1.25);
}

.key-values {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Log output */
.terminal {
    background: #000;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    padding: 1.5rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.5;
    max-height: 32rem;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(168, 85, 247, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

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

/* Login (opsdash-redesign/login.html) */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 3rem;
    position: relative;
}

.login-header {
    text-align: center;
    margin-bottom: 3rem;
}

.login-header h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap svg.feather {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon-wrap .form-control {
    padding-left: 3rem;
}

.btn-login {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Error pages */
.error-card {
    max-width: 560px;
    text-align: center;
}

.error-card img {
    max-width: 100%;
    max-height: 16rem;
    margin-bottom: 1.5rem;
}

.error-card h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.error-card p {
    margin-bottom: 1rem;
}

@media (max-width: 640px) {
    .top-nav,
    .page-wrapper,
    .footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .page-title {
        font-size: 2rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }
}
