/* ===== CSS Variables ===== */
/* Barevná paleta inspirovaná charakteristickým modrofialovým záření plynu argonu */
:root {
    --sidebar-width: 220px;
    --sidebar-bg: #100f28;
    --sidebar-text: #b4aee8;
    --sidebar-hover: #1c1a42;
    --sidebar-active: #7c6af7;
    --sidebar-brand: #ede9ff;

    --primary: #7c6af7;
    --primary-hover: #6b58e8;
    --danger: #e05a6e;
    --danger-hover: #c94d60;
    --secondary: #6b7298;
    --secondary-hover: #585e82;

    --body-bg: #f4f2ff;
    --card-bg: #ffffff;
    --border-color: #dbd6f8;
    --text-primary: #1a1838;
    --text-muted: #7b789e;
    --text-error: #e05a6e;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Courier New', Courier, monospace;

    --radius: 6px;
    --shadow: 0 1px 3px rgba(80,60,180,0.08), 0 1px 2px rgba(80,60,180,0.05);
    --shadow-md: 0 4px 12px rgba(80,60,180,0.10), 0 2px 4px rgba(80,60,180,0.07);
}

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

html {
    font-size: 15px;
    height: 100%;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: #eeebff;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    color: #6b58e8;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--sidebar-brand);
}

.sidebar-brand-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 7px rgba(240, 120, 32, 0.6));
}

.sidebar-brand-texts {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.03em;
    line-height: 1.2;
    color: var(--sidebar-brand);
}

.sidebar-brand-sub {
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(167, 139, 250, 0.6);
    line-height: 1;
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 0;
    flex: 1;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.25rem;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(124, 106, 247, 0.2);
    color: #ffffff;
    border-left-color: var(--sidebar-active);
}

.nav-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--sidebar-text);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.user-role-badge {
    background: rgba(255,255,255,0.15);
    padding: 0.1em 0.5em;
    border-radius: 3px;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logout-link {
    font-size: 0.85rem;
    padding: 0.4rem 0;
    color: rgba(200, 214, 229, 0.7);
}

.logout-link:hover {
    color: #ffffff;
    background: none;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

/* ===== Login Page ===== */
body.login-page {
    background: radial-gradient(ellipse at 50% 40%, #1c1850 0%, #100f28 70%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
}

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

.login-icon {
    font-size: 2rem;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.btn-block {
    width: 100%;
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

/* ===== Breadcrumbs ===== */
.breadcrumb-nav {
    margin-bottom: 1.25rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    list-style: none;
    flex-wrap: wrap;
    gap: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-item a {
    color: var(--primary);
}

.breadcrumb-sep {
    padding: 0 0.4rem;
    color: var(--border-color);
    font-size: 0.9rem;
}

/* ===== Alerts / Flash Messages ===== */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #eaf7f0;
    color: #1a7a4a;
    border-color: #9de0be;
}

.alert-error {
    background: #fdf0f2;
    color: var(--danger);
    border-color: #f4a3af;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ===== Sections ===== */
.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.subsection-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1rem 0 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
    line-height: 1.4;
    font-family: inherit;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.92;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
}

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

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

.btn-secondary {
    background: #eeebff;
    color: var(--secondary);
}

.btn-secondary:hover {
    background: #e2deff;
    color: var(--text-primary);
}

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

/* ===== Tables ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    font-size: 0.875rem;
}

.table th {
    background: #efeaff;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.table tbody tr:nth-child(even) {
    background: #faf8ff;
}

.table tbody tr:hover {
    background: #f0ecff;
}

.table-sm th, .table-sm td {
    padding: 0.45rem 0.85rem;
}

.actions {
    white-space: nowrap;
}

.actions form {
    display: inline;
}

/* ===== Status Badges ===== */
.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 0.78em;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-lg {
    padding: 0.3em 0.8em;
    font-size: 0.85em;
}

.badge-queued        { background: #e8e6f5; color: #6b6892; }
.badge-running       { background: #dcd7ff; color: #4b3fcc; }
.badge-completed     { background: #d4f4e8; color: #1a7a4a; }
.badge-failed        { background: #fde8ec; color: #c0392b; }
.badge-pending_commit { background: #fef0d8; color: #b85c00; }
.badge-committed     { background: #e8daff; color: #5e35b1; }
.badge-info          { background: #dcd7ff; color: #4b3fcc; }

/* ===== Forms ===== */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem 2rem;
    max-width: 900px;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    background: #ffffff;
    border: 1px solid #c8d0da;
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 106, 247, 0.18);
}

.form-control-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23636e72' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 14px 14px;
    padding-right: 2rem;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section-title:first-child {
    margin-top: 0;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 180px;
}

.form-col-small {
    flex: 0 0 130px;
    min-width: 120px;
}

.form-col-auto {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    padding-bottom: 1.1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.radio-group label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    cursor: pointer;
    font-size: 0.9rem;
}

.required {
    color: var(--danger);
}

.monospace {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Security string rows */
.security-string-row {
    background: #faf8ff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.security-string-row .form-row {
    margin-bottom: 0;
}

.security-string-row .form-group {
    margin-bottom: 0;
}

/* ===== Genome / Anonymizer ===== */
.btn-genome {
    background: #e8f5e9;
    color: #2e7d32;
}

.btn-genome:hover {
    background: #c8e6c9;
    color: #1b5e20;
}

.ss-parent {
    border-left: 3px solid var(--primary);
    padding-left: 0.5rem;
    margin-bottom: 1px;
}

.ss-genome {
    border-left: 3px solid #4caf50;
    padding-left: 0.5rem;
    margin-left: 1.5rem;
    background: rgba(76, 175, 80, 0.04);
    margin-bottom: 1px;
}

.ss-genome-spacer {
    /* matches Genome button width to keep columns aligned */
    min-width: 4rem;
}

.ss-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    margin-bottom: 2px;
    line-height: 1.4;
}

.ss-badge-parent {
    background: rgba(124, 106, 247, 0.15);
    color: var(--primary);
}

.ss-badge-genome {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
}

.ss-badge-placeholder {
    background: rgba(107, 114, 152, 0.12);
    color: var(--secondary);
}

/* Show view table rows */
.ss-row-parent td:first-child {
    font-weight: 500;
}

.ss-row-genome td {
    color: var(--text-muted);
}

.ss-genome-indent {
    color: #4caf50;
    margin-right: 0.25rem;
    font-style: normal;
}

/* ===== Stats Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    text-align: center;
    border-top: 3px solid var(--primary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.25rem;
}

.stat-link {
    display: block;
    font-size: 0.78rem;
    margin-top: 0.5rem;
    color: var(--primary);
}

a.stat-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

a.stat-card-link:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    transform: translateY(-2px);
}

.stat-rows {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

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

.stat-row-value {
    font-weight: 600;
    color: var(--text);
}

/* ===== Info Cards ===== */
.info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.info-item-full {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
}

.error-text {
    color: var(--text-error);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ===== Report Content ===== */
pre.report-content {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: #faf8ff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    max-height: 800px;
    overflow-y: auto;
}

/* AI Response block */
.ai-response-block {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.ai-response-row {
    background: #faf8ff !important;
}

.ai-response-row:hover {
    background: #faf8ff !important;
}

/* ===== Filter Bar ===== */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.filter-form {
    width: 100%;
}

.filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 130px;
}

.filter-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group-actions {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.5rem;
    min-width: auto;
}

.filter-group-actions label {
    display: none;
}

/* ===== Misc ===== */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

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

/* ===== Utility ===== */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

/* ===== Repository feature flags (Security Token / Auto Secret Detection) ===== */
.repo-flags-cell {
    text-align: center;
    white-space: nowrap;
}
.repo-flag {
    display: inline-flex;
    align-items: center;
    margin: 0 0.2rem;
    color: var(--text-muted);
    opacity: 0.25;
    vertical-align: middle;
    cursor: default;
    transition: opacity 0.15s, color 0.15s;
}
.repo-flag--on {
    color: #4ade80;
    opacity: 1;
}
