/* ================================================================
   Huntarr.io Documentation — Design System
   Matches the Huntarr app's dark glassmorphism theme.
   GitHub Pages: .nojekyll in docs/ = no Jekyll; static files served as-is.
   ================================================================ */

/* --- Critical layout (pixel values so layout works even if vars fail) --- */
.docs-layout {
    display: flex !important;
    min-height: 100vh !important;
}

.docs-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 260px !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 200 !important;
}

.docs-main {
    margin-left: 260px !important;
    flex: 1 !important;
    min-height: 100vh !important;
}

nav.docs-sidebar .sidebar-brand img,
.sidebar-brand img {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    min-width: 36px !important;
}

.docs-mobile-topbar {
    display: none !important;
}

.docs-mobile-topbar .mob-logo {
    width: 26px !important;
    height: 26px !important;
    max-width: 26px !important;
}

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

/* --- Variables --- */
:root {
    --bg-deep: #080c14;
    --bg-base: #0b1120;
    --bg-surface: #111827;
    --bg-card: rgba(15, 23, 42, 0.45);
    --bg-card-hover: rgba(15, 23, 42, 0.65);
    --border-subtle: rgba(148, 163, 184, 0.06);
    --border-medium: rgba(148, 163, 184, 0.12);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);

    --gold: #f59e0b;
    --green: #22c55e;
    --red: #ef4444;
    --purple: #a855f7;
    --cyan: #06b6d4;

    /* App colours */
    --sonarr: #3b82f6;
    --radarr: #f59e0b;
    --lidarr: #22c55e;
    --readarr: #ef4444;
    --whisparr: #a855f7;
    --prowlarr: #f97316;
    --swaparr: #06b6d4;

    --sidebar-w: 260px;
    --topbar-h: 0px;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: .25s cubic-bezier(.4, 0, .2, 1);
}

/* --- Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-deep);
    -webkit-font-smoothing: antialiased;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

/* ================================================================
   LAYOUT
   ================================================================ */
.docs-layout {
    display: flex;
    min-height: 100vh;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(168deg,
            rgba(16, 22, 36, 0.97) 0%,
            rgba(12, 17, 30, 0.98) 50%,
            rgba(10, 14, 26, 0.99) 100%);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
}

/* Accent line on right edge */
.docs-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg,
            rgba(99, 102, 241, 0.1),
            rgba(99, 102, 241, 0.5) 30%,
            rgba(129, 140, 248, 0.7) 50%,
            rgba(99, 102, 241, 0.5) 70%,
            rgba(99, 102, 241, 0.1));
    opacity: .7;
}

/* Logo / brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    text-decoration: none;
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.3));
}

.sidebar-brand span {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: .4px;
}

/* Donate link at top of sidebar — red look, same size as other nav items */
nav.docs-sidebar .sidebar-donate-link,
.docs-sidebar .sidebar-donate-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    margin: 4px 10px 6px 10px;
    color: #e74c3c !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    border: 1px solid rgba(231, 76, 60, 0.5);
    border-left: 3px solid #e74c3c;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(231, 76, 60, 0.08);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.12);
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

nav.docs-sidebar .sidebar-donate-link:hover,
.docs-sidebar .sidebar-donate-link:hover {
    color: #ff6b6b !important;
    background: rgba(231, 76, 60, 0.18);
    border-color: rgba(231, 76, 60, 0.7);
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.2);
}

nav.docs-sidebar .sidebar-donate-link i,
.docs-sidebar .sidebar-donate-link i {
    font-size: 13px;
    width: 16px;
    text-align: center;
    color: #e74c3c !important;
}

nav.docs-sidebar .sidebar-donate-link:hover i,
.docs-sidebar .sidebar-donate-link:hover i {
    color: #ff6b6b !important;
}

/* Scrollable nav */
.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

/* Nav groups */
.nav-group {
    margin-bottom: 4px;
}

.nav-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.3px;
    color: var(--text-muted);
    padding: 14px 20px 6px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-group-title::after {
    content: '\f078';
    /* chevron-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 8px;
    transition: transform var(--transition);
}

.nav-group.collapsed .nav-group-title::after {
    transform: rotate(-90deg);
}

.nav-group-items {
    overflow: hidden;
    transition: max-height .3s ease;
}

.nav-group.collapsed .nav-group-items {
    max-height: 0 !important;
}

/* Nav links */
.nav-group-items a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}

.nav-group-items a i,
.nav-group-items a svg {
    width: 16px;
    text-align: center;
    font-size: 13px;
    opacity: .6;
    flex-shrink: 0;
}

.nav-group-items a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-group-items a:hover i,
.nav-group-items a:hover svg {
    opacity: 1;
}

.nav-group-items a.active {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.nav-group-items a.active i,
.nav-group-items a.active svg {
    opacity: 1;
    color: var(--accent);
}

/* Badge (Beta, New, etc.) */
.nav-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.nav-badge-beta {
    background: rgba(245, 158, 11, .15);
    color: var(--gold);
}

.nav-badge-new {
    background: rgba(34, 197, 94, .15);
    color: var(--green);
}

/* Sidebar footer */
.sidebar-footer {
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
    justify-content: center;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 15px;
    transition: all var(--transition);
}

.sidebar-footer a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}


.sidebar-footer .sf-github:hover {
    color: var(--text-primary);
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.docs-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-base);
}

.docs-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 32px 80px;
}

/* ================================================================
   MOBILE TOPBAR (visible <= 768px only)
   ================================================================ */
.docs-mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 190;
    height: 48px;
    background: linear-gradient(135deg, rgba(22, 30, 44, .98), rgba(15, 22, 35, .98));
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .3);
    align-items: center;
    padding: 0 12px;
    gap: 12px;
}

.docs-mobile-topbar .mob-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.docs-mobile-topbar .mob-hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #c8d0dc;
    border-radius: 1px;
}

.docs-mobile-topbar .mob-logo {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}

.docs-mobile-topbar .mob-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

/* Accent line */
.docs-mobile-topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #1a5276, #2980b9, #5dade2, #2980b9, #1a5276);
    opacity: .8;
}

/* Mobile backdrop */
.docs-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0, 0, 0, .55);
    opacity: 0;
    transition: opacity .25s;
}

.docs-sidebar-backdrop.open {
    opacity: 1;
}

/* ================================================================
   TYPOGRAPHY
   ================================================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    line-height: 1.3;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -.02em;
}

.page-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0 0 32px;
    line-height: 1.5;
}

h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 48px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 32px 0 12px;
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 8px;
}

p {
    margin: 0 0 16px;
    color: var(--text-secondary);
}

ul,
ol {
    color: var(--text-secondary);
    padding-left: 24px;
    margin: 0 0 16px;
}

li {
    margin-bottom: 6px;
}

strong {
    color: var(--text-primary);
    font-weight: 600;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: #93c5fd;
}

hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 32px 0;
}

/* ================================================================
   CODE BLOCKS
   ================================================================ */
pre {
    position: relative;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 0 0 20px;
    overflow-x: auto;
    line-height: 1.55;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Copy button */
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.copy-btn.copied {
    color: var(--green);
    border-color: rgba(34, 197, 94, .3);
}

/* ================================================================
   ALERTS / CALLOUTS
   ================================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin: 0 0 20px;
    border-left: 4px solid;
    font-size: 14px;
}

.alert strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.alert p {
    margin: 0;
}

.alert-info {
    background: rgba(6, 182, 212, .08);
    border-color: var(--cyan);
}

.alert-info strong {
    color: var(--cyan);
}

.alert-warning {
    background: rgba(245, 158, 11, .08);
    border-color: var(--gold);
}

.alert-warning strong {
    color: var(--gold);
}

.alert-success {
    background: rgba(34, 197, 94, .08);
    border-color: var(--green);
}

.alert-success strong {
    color: var(--green);
}

.alert-danger {
    background: rgba(239, 68, 68, .08);
    border-color: var(--red);
}

.alert-danger strong {
    color: var(--red);
}

/* ================================================================
   CARDS
   ================================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 0 0 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) inset;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateY(-3px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08) inset,
        0 8px 30px rgba(0, 0, 0, .2),
        0 0 20px rgba(99, 102, 241, 0.04);
}

a.card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.card h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--text-primary);
}

.card p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Icon colour helpers */
.icon-green {
    background: rgba(34, 197, 94, .12);
    color: var(--green);
}

.icon-purple {
    background: rgba(168, 85, 247, .12);
    color: var(--purple);
}

/* ================================================================
   TABLES
   ================================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px;
    font-size: 14px;
}

th,
td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

th {
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

td {
    color: var(--text-secondary);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ================================================================
   HERO (landing page)
   ================================================================ */
.hero {
    text-align: center;
    padding: 48px 0 40px;
}

.hero-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    filter: drop-shadow(0 4px 16px rgba(59, 130, 246, 0.3));
    margin-bottom: 20px;
}

.hero h1 {
    font-size: 2.4rem;
    margin-bottom: 12px;
}

.hero .page-subtitle {
    max-width: 540px;
    margin: 0 auto 28px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ================================================================
   FEATURE GRID (landing page)
   ================================================================ */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin: 24px 0 40px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 24px;
    transition: all var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) inset;
}

.feature-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.12);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.08) inset,
        0 0 16px rgba(99, 102, 241, 0.04);
}

.feature-card .fc-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.feature-card h3 {
    margin: 0 0 6px;
    font-size: 15px;
}

.feature-card p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ================================================================
   STEPS
   ================================================================ */
.steps {
    counter-reset: step-counter;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.steps li {
    counter-increment: step-counter;
    position: relative;
    padding: 0 0 24px 48px;
    border-left: 2px solid var(--border-subtle);
    margin-left: 16px;
}

.steps li:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: -15px;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.steps li h4 {
    margin: 0 0 4px;
}

.steps li p {
    margin: 0;
}

/* ================================================================
   SETTINGS TABLE
   ================================================================ */
.settings-table {
    margin: 0 0 24px;
}

.settings-table th:first-child {
    min-width: 160px;
}

.settings-table code {
    font-size: 12px;
}

/* ================================================================
   APP HEADER (used on app-specific pages)
   ================================================================ */
.app-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.app-header img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
}

.app-header h1 {
    margin: 0;
}

.app-header .app-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    margin-left: 8px;
}

/* ================================================================
   BACK TO TOP
   ================================================================ */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ================================================================
   FOOTER
   ================================================================ */
.docs-footer {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 48px;
}

.docs-footer a {
    color: var(--text-secondary);
}

.docs-footer a:hover {
    color: var(--accent);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .docs-sidebar {
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.4, 0, .2, 1);
        width: 270px !important;
        max-width: 80vw;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .4);
    }

    .docs-sidebar.open {
        transform: translateX(0);
    }

    .docs-sidebar-backdrop {
        display: block;
        pointer-events: none;
    }

    .docs-sidebar-backdrop.open {
        pointer-events: auto;
    }

    .docs-mobile-topbar {
        display: flex !important;
    }

    .docs-main {
        margin-left: 0 !important;
    }

    .docs-content {
        padding: 24px 16px 60px;
    }

    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero-logo {
        width: 64px;
        height: 64px;
    }

    .card-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .docs-content {
        padding: 16px 12px 48px;
    }

    .hero {
        padding: 32px 0 24px;
    }
}

/* ================================================================
   UTILITY CLASSES
   ================================================================ */
.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

.text-center {
    text-align: center;
}

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

.flex {
    display: flex;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}