/* === GOOGLE FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* === BASE RESET === */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === LIGHT THEME VARIABLES === */
:root {
    --bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --text: #475569;
    --text-strong: #0f172a;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.08);
    --border-subtle: #e2e8f0;
    --card-bg: #ffffff;
    --muted: #94a3b8;
    --input-bg: #ffffff;
    --hover-bg: #f1f5f9;
}

/* === DARK THEME OVERRIDES === */
body.dark {
    --bg: #09090b;
    --sidebar-bg: #111115;
    --sidebar-border: #1f1f27;
    --text: #a1a1aa;
    --text-strong: #fafafa;
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.1);
    --border-subtle: #1f1f27;
    --card-bg: #111115;
    --muted: #52525b;
    --input-bg: #18181b;
    --hover-bg: #18181b;
}

/* ===============================
   SIDEBAR LAYOUT
   =============================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 220px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--text);
    padding: 20px 14px;
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand {
    padding: 6px 10px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.brand-icon {
    width: 26px;
    height: 26px;
    background: var(--accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    fill: none;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-strong);
}

.nav-client-logo {
    padding: 0 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-client-logo img {
    max-width: 148px;
    width: 50%;
    height: auto;
    display: block;
}

.nav-partner-logo {
    padding: 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 -14px -20px;
}

.nav-partner-logo img {
    max-width: 148px;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px 6px 0 0;
}

/* ─── nav section label ─── */
.nav-section {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 10px;
    margin: 4px 0 6px;
    list-style: none;
    pointer-events: none;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin-bottom: 1px;
}

.nav-links a {
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 7px;
    color: var(--text);
    transition: background 0.1s ease, color 0.1s ease;
    letter-spacing: -0.1px;
}

.nav-links a .nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.1s ease;
}

.nav-links a:hover {
    background: var(--hover-bg);
    color: var(--text-strong);
}

.nav-links a:hover .nav-icon {
    opacity: 0.8;
}

.nav-links li.active a {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-links li.active a .nav-icon {
    opacity: 1;
}

/* Thin separator */
.nav-sep {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 10px;
}

/* ── Live "scanning now" badge in sidebar ── */
.nav-live-badge {
    display: none;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.25);
    line-height: 1.4;
}
.nav-live-badge.show { display: inline-flex; }
body.dark .nav-live-badge {
    background: rgba(34, 197, 94, 0.14);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}
.nav-live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 currentColor;
    animation: nav-live-pulse 1.6s ease-in-out infinite;
}
@keyframes nav-live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
    50%      { box-shadow: 0 0 0 4px transparent; opacity: 0.55; }
}

/* ─── theme toggle ─── */
.theme-toggle {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--sidebar-border);
}

#themeBtn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text);
    width: 100%;
    padding: 8px 10px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: -0.1px;
    transition: background 0.1s ease, color 0.1s ease;
}

#themeBtn:hover {
    background: var(--hover-bg);
    color: var(--text-strong);
}

.icon-sun,
.icon-moon {
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
}

.icon-moon { display: none; }
body.dark .icon-sun { display: none; }
body.dark .icon-moon { display: flex; }

#themeBtn:hover .icon-sun,
#themeBtn:hover .icon-moon {
    opacity: 0.8;
}

/* ===============================
   MAIN CONTENT AREA
   =============================== */

.content {
    margin-left: 220px;
    padding: 36px 40px;
    min-height: 100vh;
    padding-bottom: 72px;
}

.page-title {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text-strong);
    margin: 0 0 4px 0;
}

.page-subtitle {
    font-size: 13.5px;
    color: var(--muted);
    margin: 0 0 28px 0;
    font-weight: 400;
}

/* ===============================
   CARDS / PANELS
   =============================== */

.card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px 24px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 20px;
}

.card-header {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-strong);
    margin-bottom: 12px;
}

.card-body {
    font-size: 13.5px;
    color: var(--text);
}

/* ── Inline table search (dashboard repos, jobs list, etc.) ── */
.table-search {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    background: var(--input-bg);
    color: var(--muted);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
    min-width: 240px;
    max-width: 340px;
    box-sizing: border-box;
}
.table-search:focus-within {
    border-color: var(--accent);
    color: var(--text);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.table-search > svg { flex-shrink: 0; opacity: 0.7; }
.table-search input[type="search"],
.table-search input[type="text"] {
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-strong);
    font-size: 13px;
    font-family: inherit;
    line-height: 1;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}
.table-search input::placeholder { color: var(--muted); opacity: 1; }
/* Strip the native search clear button (Chrome/Safari) so the layout stays clean */
.table-search input[type="search"]::-webkit-search-cancel-button,
.table-search input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}
.table-search-count {
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.table-search-empty {
    padding: 32px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ── Compliance badges (CWE + OWASP) — shared across results.php & compliance.php ── */
.compliance-badges {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    vertical-align: middle;
}
.compliance-badges .cwe-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-strong);
    background: var(--hover-bg);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.compliance-badges .owasp-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.compliance-badges .owasp-tag.tier-top     { background: #be123c; }
.compliance-badges .owasp-tag.tier-mid     { background: #d97706; }
.compliance-badges .owasp-tag.tier-low     { background: #2563eb; }
.compliance-badges .owasp-tag.tier-unknown { background: var(--muted); }
.compliance-badges .owasp-tag-name {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.compliance-badges-xs .cwe-tag,
.compliance-badges-xs .owasp-tag {
    padding: 0 5px;
    font-size: 9.5px;
    border-radius: 3px;
}
a.compliance-filter-link {
    text-decoration: none;
    display: inline-flex;
    transition: opacity 0.12s;
}
a.compliance-filter-link:hover { opacity: 0.75; }

/* ── Compliance active-filter banner (shown on results.php when ?cwe= or ?owasp= is set) ── */
.compliance-filter-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    background: var(--accent-soft);
    font-size: 12.5px;
    color: var(--text);
    flex-wrap: wrap;
}
.compliance-filter-banner strong { color: var(--text-strong); font-weight: 600; }
.compliance-filter-banner .spacer { flex: 1; }
.compliance-filter-banner a.clear-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}
.compliance-filter-banner a.clear-link:hover { text-decoration: underline; }

/* ===============================
   EMPTY STATES  (shared primitive — jobs, results, posture, etc.)
   .empty-state      → in-card, with optional SVG icon (e.g. jobs table)
   .empty-state-card → full-card centered message (e.g. picker pages)
   =============================== */

.empty-state {
    padding: 60px 20px;
    text-align: center;
}
.empty-state svg {
    color: var(--muted);
    opacity: 0.35;
    margin-bottom: 16px;
}

.empty-state-card {
    text-align: center;
    padding: 44px 20px;
}

.empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
    margin: 0 0 6px;
}
.empty-sub {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}
.empty-sub a { color: var(--accent); text-decoration: none; }
.empty-sub a:hover { text-decoration: underline; }

/* ===============================
   FILTER PILLS  (shared primitive — used by jobs, activity, etc.)
   =============================== */

.filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.filter-pill:hover {
    background: var(--hover-bg);
    color: var(--text-strong);
}
.filter-pill.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.pill-count {
    padding: 1px 6px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    background: var(--hover-bg);
    color: var(--muted);
}
.filter-pill.active .pill-count {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ===============================
   LIVE INDICATOR  (shared primitive — jobs, activity)
   =============================== */

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    margin-left: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}
.live-indicator.on { opacity: 1; color: #16a34a; }
body.dark .live-indicator.on { color: #4ade80; }

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.8); }
}

/* ===============================
   BUTTONS
   =============================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    padding: 7px 14px;
    margin-right: 6px;
    text-decoration: none;
    letter-spacing: -0.1px;
    line-height: 1.4;
    transition: filter 0.12s ease, box-shadow 0.12s ease, transform 0.06s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
}

.btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.16);
}

.btn-success {
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.btn-success:hover {
    filter: brightness(1.08);
}

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

.btn-ghost:hover {
    background: var(--hover-bg);
    color: var(--text-strong);
}

/* Disabled & loading states for all .btn variants */
.btn[disabled],
.btn:disabled,
.btn.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    pointer-events: none;
}

.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
    cursor: wait;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #ffffff;
    animation: spinner-turn 0.7s linear infinite;
}

/* Ghost buttons use accent color for the spinner ring */
.btn-ghost.is-loading::after {
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent);
}

/* Keyboard focus rings (only visible for keyboard users) */
.btn:focus-visible,
#themeBtn:focus-visible,
.nav-links a:focus-visible,
.link-back:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
}

/* ===============================
   FORM ELEMENTS
   =============================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    max-width: 500px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    font-size: 13.5px;
    font-family: inherit;
    margin-bottom: 10px;
    background: var(--input-bg);
    color: var(--text-strong);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
    -webkit-appearance: none;
    appearance: none;
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2394a3b8' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 30px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Disabled / readonly inputs & selects */
input[disabled],
input[readonly],
select[disabled],
textarea[disabled],
textarea[readonly] {
    background: var(--hover-bg);
    color: var(--muted);
    cursor: not-allowed;
    border-color: var(--border-subtle);
}

input[readonly]:focus,
textarea[readonly]:focus {
    border-color: var(--border-subtle);
    box-shadow: none;
}

/* Inline form validation */
.input-error,
input.input-error,
select.input-error,
textarea.input-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.form-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #dc2626;
    margin: -6px 0 10px;
    line-height: 1.4;
}

.form-error::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dc2626;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    margin-top: 1px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin: -6px 0 10px;
    line-height: 1.4;
}

/* ===============================
   TOASTS
   =============================== */

.toast {
    visibility: hidden;
    min-width: 220px;
    background-color: var(--text-strong);
    color: var(--card-bg);
    text-align: center;
    border-radius: 8px;
    padding: 11px 16px;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}

.toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.toast-info    { background-color: var(--accent);  color: #ffffff; }
.toast-success { background-color: #16a34a;        color: #ffffff; }
.toast-error   { background-color: #dc2626;        color: #ffffff; }
.toast-warning { background-color: #d97706;        color: #ffffff; }

/* Room for the close button on the right of a toast */
.toast.flash-message {
    padding-right: 38px;
    text-align: left;
    max-width: 420px;
}

.flash-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit;
    opacity: 0.75;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
}
.flash-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

/* Fade-out state set by js/theme.js auto-dismiss handler */
.toast.hiding {
    opacity: 0;
    transform: translateY(8px);
}

/* Stack multiple toasts vertically when they coexist */
.toast + .toast { margin-bottom: 8px; }

/* ===============================
   FEATURE GATE (upsell card)
   =============================== */

.feature-gate-card {
    padding: 40px 32px;
    text-align: center;
    max-width: 560px;
    margin: 40px auto;
}
.feature-gate-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}
.feature-gate-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 10px;
}
.feature-gate-desc {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 22px;
}
.feature-gate-plan {
    font-size: 12.5px;
    color: var(--muted);
    margin: 0 0 22px;
}
.feature-gate-plan strong {
    color: var(--text);
}
.feature-gate-cta {
    padding: 9px 18px;
}

/* ===============================
   ERROR PAGE (404 / 403 / generic)
   shares the feature-gate layout but uses a warm warning tone
   =============================== */

.error-page-card {
    padding: 44px 32px;
    text-align: center;
    max-width: 520px;
    margin: 40px auto;
}
.error-page-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}
.error-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0 0 10px;
    letter-spacing: -0.2px;
}
.error-page-body {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 22px;
}
.error-page-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.error-page-actions .btn { margin: 0; }

/* ===============================
   INDEX (REPO LIST)
   =============================== */

.repo-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 16px 20px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 8px;
    transition: border-color 0.15s ease;
}

.repo-card:hover {
    border-color: var(--accent);
}

.repo-url {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-strong);
    margin-bottom: 8px;
    word-break: break-all;
}

.status-text {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--muted);
}

.status-text.not-scanned {
    font-style: italic;
}

.add-repo-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px 24px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 22px;
}

.add-repo-row {
    display: flex;
    gap: 8px;
}

.add-repo-row input {
    flex: 1;
    margin-bottom: 0;
}

/* ===============================
   RESULTS PAGE
   =============================== */

.severity-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.sev-card {
    border-radius: 10px;
    padding: 16px 18px;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.sev-card.active {
    box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.65);
}

.severity-summary.has-active .sev-card:not(.active) {
    opacity: 0.45;
}

.sev-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
    margin-bottom: 8px;
}

.sev-count {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sev-critical { background: #be123c; }
.sev-high     { background: #dc2626; }
.sev-medium   { background: #d97706; }
.sev-low      { background: #16a34a; }
.sev-info     { background: #2563eb; }

.file-box {
    background: var(--card-bg);
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.file-header {
    color: var(--text-strong);
}

.vulnerability {
    font-size: 13px;
}

.badge {
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    color: white;
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-Critical { background: #be123c; }
.badge-High     { background: #dc2626; }
.badge-Medium   { background: #d97706; }
.badge-Low      { background: #16a34a; }
.badge-Info     { background: #2563eb; }

/* ===============================
   JOBS PAGE
   =============================== */

.job-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
}

.job-repo-url {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-strong);
    margin-bottom: 4px;
}

.job-filename {
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 8px;
}

.status-label {
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    color: white;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.status-running   { background: #2563eb; }
.status-pending   { background: #71717a; }
.status-queued    { background: #71717a; }
.status-completed { background: #16a34a; }
.status-failed    { background: #dc2626; }

.timestamps {
    font-size: 12px;
    color: var(--muted);
}

/* ===============================
   LINKS
   =============================== */

.link-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    text-decoration: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: color 0.12s ease;
}

.link-back:hover {
    color: var(--accent);
}

/* ===============================
   HAMBURGER MENU TOGGLE
   =============================== */

.hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 14px;
    z-index: 20;
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 7px;
    padding: 8px 9px;
    cursor: pointer;
    color: var(--text);
    line-height: 1;
}

.hamburger svg {
    display: block;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* ===============================
   RESPONSIVE
   =============================== */

@media (max-width: 900px) {
    .sidebar  { width: 200px; }
    .content  { margin-left: 200px; padding: 24px; }
    .footer   { left: 200px; width: calc(100% - 200px); }
}

@media (max-width: 768px) {
    /* Hamburger visible */
    .hamburger { display: block; }

    /* Sidebar becomes an overlay drawer */
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 240px;
        height: 100vh;
        transition: left 0.25s ease;
        z-index: 11;
        border-right: 1px solid var(--sidebar-border);
        flex-direction: column;
    }

    .sidebar.open {
        left: 0;
    }

    /* Content full width */
    .content {
        margin-left: 0;
        padding: 60px 16px 80px;
    }

    /* Footer full width */
    .footer {
        left: 0;
        width: 100%;
    }

    /* Nav links layout */
    .nav-links { display: flex; flex-direction: column; }
    .nav-section { display: none; }

    /* Data tables as cards on mobile */
    .dashboard-table thead,
    .audit-table thead {
        display: none;
    }

    .dashboard-table,
    .audit-table {
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .dashboard-table tbody tr,
    .audit-table tbody tr {
        display: block;
        background: var(--card-bg);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 14px 16px;
    }

    .dashboard-table td,
    .audit-table td {
        display: block;
        padding: 4px 0;
        border-bottom: none;
        text-align: left !important;
    }

    .dashboard-table td::before,
    .audit-table td::before {
        display: none;
    }

    /* Action menu in mobile */
    .action-menu {
        display: flex;
        justify-content: flex-start;
        padding-top: 8px;
    }

    .action-dropdown {
        right: auto;
        left: 0;
    }

    /* Filter bar stacks */
    .filter-bar {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        max-width: 100%;
    }

    /* Modals full-screen on mobile */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
    }

    /* Severity summary grid */
    .severity-summary {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Ensure tap targets >= 44px */
    .btn, .nav-links a, #themeBtn, .action-btn, .pagination-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Page header stacks */
    .page-header {
        flex-direction: column !important;
    }

    .quota-display {
        white-space: normal !important;
    }

    /* Profile stats single column */
    .profile-stats {
        grid-template-columns: 1fr !important;
    }

    /* Client/partner logos smaller on mobile */
    .nav-client-logo img,
    .nav-partner-logo img {
        max-width: 100px;
    }
}

@media (max-width: 480px) {
    .severity-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .content {
        padding: 60px 12px 80px;
    }

    .sev-count {
        font-size: 10px;
        min-width: 22px;
        padding: 3px 5px;
    }
}

/* ===============================
   FOOTER
   =============================== */

.footer {
    position: fixed;
    bottom: 0;
    left: 220px;
    width: calc(100% - 220px);
    padding: 11px 0;
    background: var(--card-bg);
    color: var(--muted);
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: 12px;
    z-index: 5;
}

/* ===============================
   REPO BADGES
   =============================== */

.repo-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 10.5px;
    margin-bottom: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-personal {
    background: #10b981;
    color: #ffffff;
}

.badge-shared {
    background: #2563eb;
    color: #ffffff;
}

/* ===============================
   SSH KEY FORM
   =============================== */

.ssh-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
}

textarea.ssh-key-input {
    width: 100%;
    min-height: 240px;
    resize: vertical;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    padding: 14px 16px;
    border-radius: 8px;
    background: rgba(8, 12, 20, 0.85) !important;
    color: #e5e7eb !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    white-space: pre;
    overflow-x: auto;
}

textarea.ssh-key-input:focus {
    outline: none;
    border-color: rgba(0, 255, 160, 0.45) !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 160, 0.08);
    background: rgba(8, 12, 20, 0.95) !important;
}

[data-theme="light"] textarea.ssh-key-input {
    background: #f7f9fc !important;
    color: #111 !important;
    border: 1px solid #e2e8f0 !important;
}

[data-theme="light"] textarea.ssh-key-input:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ── Page loading spinner ── */
#page-spinner {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    background: rgba(0, 0, 0, 0.18);
}
#page-spinner.visible {
    display: flex;
}
.spinner-ring {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    animation: spinner-turn 0.7s linear infinite;
}
@keyframes spinner-turn {
    to { transform: rotate(360deg); }
}

/* ── Skeleton loaders ─────────────────────────────────────────────── */
.skeleton {
    display: inline-block;
    background: linear-gradient(
        90deg,
        var(--hover-bg) 0%,
        var(--border-subtle) 50%,
        var(--hover-bg) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}
.skeleton-text   { height: 0.85em; width: 70%; vertical-align: middle; }
.skeleton-text-sm{ height: 0.7em;  width: 50%; }
.skeleton-text-lg{ height: 1.1em;  width: 60%; }
.skeleton-circle { display: inline-block; border-radius: 50%; }
.skeleton-block  { display: block; width: 100%; height: 100%; border-radius: 6px; }
.skeleton-row td { padding-top: 16px !important; padding-bottom: 16px !important; }
.skeleton-row .skeleton { display: block; height: 12px; width: 80%; }
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Soft pulse to highlight rows that just changed */
@keyframes row-flash {
    0%   { background-color: var(--accent-soft); }
    100% { background-color: transparent; }
}
.row-flash { animation: row-flash 1.6s ease-out 1; }


/* ===============================
   BRAND LOGO  (replaces .brand-icon shield)
   =============================== */
.brand-logo {
    max-width: 50px;
    width: auto;
    height: auto;
    display: block;
}

/* ===============================
   COLLAPSIBLE NAV GROUPS
   =============================== */
.nav-group {
    margin-bottom: 1px;
}

.nav-group-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 7px;
    letter-spacing: -0.1px;
    text-align: left;
    transition: background 0.1s ease, color 0.1s ease;
}

.nav-group-toggle .nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.1s ease;
}

.nav-group-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-strong);
}

.nav-group-toggle:hover .nav-icon {
    opacity: 0.8;
}

.nav-group-chevron {
    margin-left: auto;
    width: 12px;
    height: 12px;
    opacity: 0.45;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.nav-group.open > .nav-group-toggle .nav-group-chevron {
    transform: rotate(90deg);
}

/* Parent label highlighted when one of its children is the active page */
.nav-group.has-active > .nav-group-toggle {
    color: var(--accent);
}
.nav-group.has-active > .nav-group-toggle .nav-icon,
.nav-group.has-active > .nav-group-toggle .nav-group-chevron {
    opacity: 1;
}

/* Sub-menu — collapsed by default, expands when the group is .open */
.nav-sublinks {
    list-style: none;
    margin: 1px 0 3px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.nav-group.open > .nav-sublinks {
    max-height: 420px;
}

.nav-sublinks li {
    margin-bottom: 1px;
}

.nav-sublinks a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    padding: 7px 10px 7px 34px;
    border-radius: 7px;
    letter-spacing: -0.1px;
    transition: background 0.1s ease, color 0.1s ease;
}

.nav-sublinks a::before {
    content: "";
    position: absolute;
    left: 19px;
    top: 50%;
    width: 5px;
    height: 5px;
    margin-top: -2.5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.3;
    transition: opacity 0.1s ease;
}

.nav-sublinks a:hover {
    background: var(--hover-bg);
    color: var(--text-strong);
}

.nav-sublinks a:hover::before {
    opacity: 0.6;
}

.nav-sublinks li.active a {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-sublinks li.active a::before {
    opacity: 1;
}
