/* ======== Doc Generator — Shared Styles ======== */

:root {
    --bg: #1e1e2e;
    --surface: #282840;
    --surface2: #313150;
    --border: #3e3e5e;
    --text: #cdd6f4;
    --text-muted: #8888aa;
    --accent: #89b4fa;
    --accent-dim: #45577d;
    --green: #a6e3a1;
    --red: #f38ba8;
    --yellow: #f9e2af;
    --peach: #fab387;
    --pink: #f5c2e7;
    --teal: #94e2d5;
    --lavender: #b4befe;
    --mauve: #cba6f7;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
}

/* ======== Buttons ======== */
.btn {
    background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); padding: 8px 16px; cursor: pointer; font-size: 14px;
    transition: background .15s; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--accent-dim); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-accent {
    background: var(--accent-dim); border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent); color: var(--bg); }
.btn-accent:disabled { background: var(--accent-dim); color: var(--text-muted); }
.btn-sm { font-size: 13px; padding: 6px 14px; }
.btn-danger { border-color: var(--peach); color: var(--peach); }
.btn-danger:hover { background: #3a2a1a; }

/* ======== Navigation ======== */
.nav-links {
    display: flex; gap: 8px;
}
.nav-links a {
    text-decoration: none; color: var(--text-muted);
    padding: 6px 14px; border-radius: 6px; font-size: 14px;
    border: 1px solid transparent;
    transition: all .15s;
}
.nav-links a:hover { color: var(--text); border-color: var(--border); }
.nav-links a.active { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-dim); }

/* ======== Status Badges ======== */
.status-badge {
    font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
    display: inline-flex; align-items: center; gap: 5px;
}
.status-badge::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    display: inline-block;
}
.status-success { background: #1a3a2a; color: var(--green); }
.status-success::before { background: var(--green); }
.status-failed { background: #3a1a2a; color: var(--red); }
.status-failed::before { background: var(--red); }
.status-running { background: #2a2a3a; color: var(--lavender); }
.status-running::before { background: var(--lavender); animation: pulse 1.5s infinite; }
.status-partial { background: #3a2a1a; color: var(--yellow); }
.status-partial::before { background: var(--yellow); }
.status-unknown { background: var(--surface2); color: var(--text-muted); }
.status-unknown::before { background: var(--text-muted); }

/* ======== Provider Badges ======== */
.provider-badge {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 12px;
    text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
.provider-github { background: #2d333b; color: #e6edf3; }
.provider-gitlab { background: #3b2d4a; color: #e0c6f5; }
.provider-unknown { background: var(--surface2); color: var(--text-muted); }

/* ======== Toast ======== */
.toast-container {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 9999; display: flex; flex-direction: column-reverse; gap: 8px;
    max-width: 400px;
}
.toast {
    border-radius: var(--radius-md); padding: 12px 36px 12px 20px; font-size: 14px;
    max-width: 400px; position: relative;
    animation: slideUp 0.3s ease;
}
.toast-dismiss {
    position: absolute; top: 8px; right: 8px;
    background: none; border: none; color: inherit; cursor: pointer;
    font-size: 16px; line-height: 1; padding: 2px 4px; opacity: 0.7;
}
.toast-dismiss:hover { opacity: 1; }
.toast-error { background: #3a1a2a; border: 1px solid var(--red); color: var(--red); }
.toast-success { background: #1a3a2a; border: 1px solid var(--green); color: var(--green); }

/* ======== Spinner ======== */
.spinner {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.inline-spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* ======== Animations ======== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ======== Focus Ring ======== */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ======== Common Header ======== */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky; top: 0; z-index: 100;
}
.header h1 {
    font-size: 22px; font-weight: 700;
    display: flex; align-items: center; gap: 10px;
}
.header h1 .logo { font-size: 28px; }
.header-right {
    display: flex; align-items: center; gap: 16px;
    font-size: 13px; color: var(--text-muted);
}

/* ======== Loading / Empty ======== */
.loading-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 80px 0; flex-direction: column; gap: 16px;
}
.empty-state {
    text-align: center; padding: 40px 32px;
    color: var(--text-muted); font-size: 15px;
}

/* ======== Error tooltip ======== */
.error-hint {
    position: relative; cursor: help;
}
.error-hint .error-tooltip {
    display: none; position: absolute; bottom: 100%; left: 0;
    background: #2a1a1a; border: 1px solid var(--red); border-radius: 6px;
    padding: 8px 12px; font-size: 12px; color: var(--red);
    width: 300px; max-height: 120px; overflow-y: auto;
    z-index: 100; word-break: break-word; margin-bottom: 6px;
}
.error-hint:hover .error-tooltip { display: block; }

/* ======== Light Theme (Catppuccin Latte) ======== */
[data-theme="light"] {
    --bg: #eff1f5;
    --surface: #e6e9ef;
    --surface2: #dce0e8;
    --border: #bcc0cc;
    --text: #4c4f69;
    --text-muted: #7c7f93;
    --accent: #1e66f5;
    --accent-dim: #bcc8e8;
    --green: #40a02b;
    --red: #d20f39;
    --yellow: #df8e1d;
    --peach: #fe640b;
    --pink: #ea76cb;
    --teal: #179299;
    --lavender: #7287fd;
    --mauve: #8839ef;
}
[data-theme="light"] .status-success { background: #d5f0d0; color: #2a7a1a; }
[data-theme="light"] .status-success::before { background: #40a02b; }
[data-theme="light"] .status-failed { background: #f5d0d8; color: #b00f2e; }
[data-theme="light"] .status-failed::before { background: #d20f39; }
[data-theme="light"] .status-running { background: #dde0f5; color: #5560b0; }
[data-theme="light"] .status-running::before { background: #7287fd; }
[data-theme="light"] .status-partial { background: #f5e6c8; color: #a06a10; }
[data-theme="light"] .status-partial::before { background: #df8e1d; }
[data-theme="light"] .provider-github { background: #dce0e8; color: #4c4f69; }
[data-theme="light"] .provider-gitlab { background: #e8daf5; color: #6b3aaf; }

/* ======== Theme Toggle ======== */
.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background .15s;
}
.theme-toggle:hover { background: var(--accent-dim); }

/* ======== Breadcrumbs ======== */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumbs a {
    color: var(--accent);
    text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep {
    color: var(--text-muted);
    opacity: 0.5;
}
.breadcrumbs .current {
    color: var(--text-muted);
}

/* ======== Page Transition ======== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
body { animation: fadeIn 0.25s ease; }

/* ======== Skip to Content (Accessibility) ======== */
.skip-link {
    position: absolute; top: -100px; left: 16px;
    background: var(--accent); color: var(--bg);
    padding: 8px 16px; border-radius: 0 0 6px 6px;
    z-index: 10000; text-decoration: none; font-weight: 600;
    transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ======== Scroll-to-Top Button ======== */
.scroll-top-btn {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
    width: 42px; height: 42px; font-size: 20px; line-height: 1;
    color: var(--text); cursor: pointer; z-index: 90;
    display: none; align-items: center; justify-content: center;
    transition: background .15s, opacity .2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.scroll-top-btn:hover { background: var(--accent-dim); }
.scroll-top-btn.visible { display: flex; }

/* ======== Mobile Hamburger Menu ======== */
.hamburger-btn {
    display: none; background: var(--surface2); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); padding: 6px 10px;
    cursor: pointer; font-size: 20px; line-height: 1;
}
@media (max-width: 900px) {
    .hamburger-btn { display: block; }
    .header .nav-links { display: none; }
    .header .nav-links.mobile-open {
        display: flex; flex-direction: column;
        position: absolute; top: 100%; right: 16px;
        background: var(--surface); border: 1px solid var(--border);
        border-radius: 8px; padding: 8px; z-index: 200;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
}

/* ======== Code block syntax highlight tokens ======== */
.hljs { color: var(--text); background: var(--bg); }

/* ======== Graph detail syntax HL override ======== */
.detail-block pre code.hljs { background: none; padding: 0; }
