/* ═══════════════════════════════════════════════════════
   Flikk Wiki — Knowledge Base Styles v2
   Modern, vibrant, professional
   ═══════════════════════════════════════════════════════ */

:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-code: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-light: #f5f3ff;
    --accent-border: #ddd6fe;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --green: #059669;
    --green-bg: #ecfdf5;
    --green-border: #6ee7b7;
    --yellow-bg: #fffbeb;
    --yellow-border: #fde68a;
    --yellow-text: #92400e;
    --blue-bg: #eff6ff;
    --blue-border: #93c5fd;
    --blue-text: #1e40af;
    --nav-bg: #0f172a;
    --nav-text: #cbd5e1;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --max-w: 720px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Top Navigation ─────────────────────────────────── */

.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    border-radius: 6px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
    color: var(--nav-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* ── Search ─────────────────────────────────────────── */

.search-box {
    position: relative;
    min-width: 200px;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 7px 12px 7px 36px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xs);
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}
.search-box input::placeholder { color: rgba(255,255,255,0.35); }
.search-box input:focus {
    background: rgba(255,255,255,0.14);
    border-color: rgba(124,58,237,0.6);
    box-shadow: 0 0 0 2px rgba(124,58,237,0.15);
}
.search-box::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    pointer-events: none;
}
.search-box::after {
    content: '';
    position: absolute;
    left: 23px;
    top: calc(50% + 5px);
    width: 2px;
    height: 6px;
    background: rgba(255,255,255,0.35);
    border-radius: 1px;
    transform: rotate(-45deg);
    pointer-events: none;
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 420px;
    overflow-y: auto;
    z-index: 200;
}
.search-results.visible { display: block; }

.search-result-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item.selected { background: var(--bg); }
.search-result-item .sr-title { font-weight: 600; font-size: 14px; }
.search-result-item .sr-section { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.search-result-item .sr-snippet {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-generate {
    padding: 12px 16px;
    text-align: center;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid var(--border);
    transition: background 0.15s;
}
.search-generate:hover { background: var(--accent-light); }
.search-generate .sg-icon { margin-right: 4px; }

/* ── Main Content ───────────────────────────────────── */

.content {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 28px 16px 64px;
}

/* Wide content for homepage */
.content-wide {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px 64px;
}

/* ── Breadcrumbs ────────────────────────────────────── */

.breadcrumbs {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .sep { margin: 0 6px; opacity: 0.5; }

/* ── Cards (main content blocks) ────────────────────── */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.step-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 12px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* ── Article (page content) ─────────────────────────── */

article { }

article h1 {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

article .subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.5;
}

article h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
}

article h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 8px;
}

article p {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0 0 12px;
}
article p:last-child { margin-bottom: 0; }

article a { color: var(--accent); text-decoration: none; }
article a:hover { text-decoration: underline; }

article ul, article ol {
    margin: 0 0 12px;
    padding-left: 22px;
    color: var(--text-secondary);
}
article li { margin-bottom: 6px; }

article code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--bg-code);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text);
}

article pre {
    background: var(--bg-code);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 12px 0;
    line-height: 1.5;
}
article pre code {
    background: none;
    padding: 0;
    font-size: 13px;
    color: var(--text);
}

article blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 18px;
    margin: 12px 0;
    background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-size: 14px;
}

article table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}
article th, article td {
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--border);
}
article th { background: var(--bg); font-weight: 600; }
article tr:hover td { background: var(--bg); }

/* ── Special blocks ─────────────────────────────────── */

.path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--bg-code);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 14px;
}
.path span { color: var(--text-muted); }
.path strong { color: var(--text); font-weight: 600; }
.path .arrow { color: #d1d5db; font-size: 12px; }

.highlight {
    background: var(--accent-light);
    border: 1.5px solid var(--accent-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 12px 0;
    font-size: 14px;
    color: #5b21b6;
}
.highlight strong {
    display: block;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    opacity: 0.7;
}

.tip {
    background: var(--green-bg);
    border: 1.5px solid var(--green-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 12px 0;
    font-size: 14px;
    color: #065f46;
}

.warning {
    background: var(--yellow-bg);
    border: 1.5px solid var(--yellow-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 12px 0;
    font-size: 14px;
    color: var(--yellow-text);
    display: flex;
    gap: 10px;
}
.warning .icon { font-size: 18px; flex-shrink: 0; }

.info {
    background: var(--blue-bg);
    border: 1.5px solid var(--blue-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 12px 0;
    font-size: 14px;
    color: var(--blue-text);
}

.result-box {
    background: var(--green-bg);
    border: 1.5px solid var(--green-border);
    border-radius: 12px;
    padding: 20px;
    margin: 12px 0;
}
.result-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 14px;
}

.screen {
    background: #f9fafb;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 14px 0;
    font-size: 13px;
    color: var(--text-muted);
}
.screen .mock {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 12px 16px;
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════════
   HOME PAGE — Hero + Sections
   ═══════════════════════════════════════════════════════ */

.hero {
    position: relative;
    text-align: center;
    padding: 56px 24px 48px;
    margin: 0 -16px 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 25%, #4c1d95 50%, #5b21b6 75%, #7c3aed 100%);
    overflow: hidden;
}

/* Subtle decorative orbs */
.hero::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -40px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(6,182,212,0.25) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -60px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(236,72,153,0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 100px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
    backdrop-filter: blur(4px);
}
.hero-badge .pulse {
    width: 6px;
    height: 6px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52,211,153,0.5); }
    50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(52,211,153,0); }
}

.hero h1 {
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    max-width: 520px;
    margin: 0 auto 32px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.hero-search {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.hero-search input {
    width: 100%;
    padding: 15px 20px 15px 48px;
    font-size: 15px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    outline: none;
    background: rgba(255,255,255,0.1);
    color: #fff;
    backdrop-filter: blur(8px);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.hero-search input::placeholder { color: rgba(255,255,255,0.45); }
.hero-search input:focus {
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 4px rgba(124,58,237,0.2);
}
.hero-search::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255,255,255,0.45);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}
.hero-search::after {
    content: '';
    position: absolute;
    left: 31px;
    top: calc(50% + 6px);
    width: 2.5px;
    height: 7px;
    background: rgba(255,255,255,0.45);
    border-radius: 2px;
    transform: rotate(-45deg);
    pointer-events: none;
    z-index: 2;
}

.hero-hint {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin-top: 12px;
    position: relative;
    z-index: 1;
}

/* Stats row under hero */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 32px;
    position: relative;
    z-index: 1;
}
.hero-stat {
    text-align: center;
}
.hero-stat-num {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
}
.hero-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Sections Grid ─────────────────────────────────── */

.sections-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 36px 0 20px;
    padding: 0 4px;
}
.sections-heading h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.sections-heading .section-count {
    font-size: 13px;
    color: var(--text-faint);
    font-weight: 500;
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.section-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px;
    background: var(--bg-card);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
    border: 1px solid transparent;
}
.section-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--border);
}

.sc-icon-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sc-icon-wrap svg {
    width: 22px;
    height: 22px;
}

.sc-body { flex: 1; min-width: 0; }
.sc-body .sc-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--text);
}
.sc-body .sc-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sc-body .sc-count {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 8px;
    font-weight: 500;
}

/* Section card color themes */
.sc-color-violet  { background: #ede9fe; color: #7c3aed; }
.sc-color-blue    { background: #dbeafe; color: #2563eb; }
.sc-color-cyan    { background: #cffafe; color: #0891b2; }
.sc-color-emerald { background: #d1fae5; color: #059669; }
.sc-color-amber   { background: #fef3c7; color: #d97706; }
.sc-color-rose    { background: #ffe4e6; color: #e11d48; }
.sc-color-orange  { background: #ffedd5; color: #ea580c; }
.sc-color-teal    { background: #ccfbf1; color: #0d9488; }
.sc-color-indigo  { background: #e0e7ff; color: #4f46e5; }
.sc-color-pink    { background: #fce7f3; color: #db2777; }
.sc-color-lime    { background: #ecfccb; color: #65a30d; }
.sc-color-slate   { background: #e2e8f0; color: #475569; }
.sc-color-sky     { background: #e0f2fe; color: #0284c7; }
.sc-color-fuchsia { background: #fae8ff; color: #a21caf; }
.sc-color-red     { background: #fee2e2; color: #dc2626; }

/* ── Section index page ─────────────────────────────── */

.page-list { list-style: none; padding: 0; }
.page-list li { border-bottom: 1px solid var(--border-light); }
.page-list li:last-child { border-bottom: none; }
.page-list a {
    display: block;
    padding: 14px 0;
    text-decoration: none;
    color: var(--text);
    transition: color 0.1s;
}
.page-list a:hover { color: var(--accent); }
.page-list .pl-title { font-weight: 600; font-size: 15px; }
.page-list .pl-snippet { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Loading page ───────────────────────────────────── */

.loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.loading-sub { font-size: 14px; color: var(--text-muted); }

/* ── Footer ─────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 28px 16px;
    font-size: 13px;
    color: var(--text-faint);
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 768px) {
    .nav-inner { padding: 0 12px; gap: 10px; }
    .nav-links { display: none; }
    .search-box { min-width: 140px; max-width: none; flex: 1; }
    .content { padding: 20px 12px 48px; }
    .content-wide { padding: 0 12px 48px; }
    .card { padding: 20px; border-radius: 12px; }
    article h1 { font-size: 22px; }
    .hero { padding: 36px 16px 32px; margin: 0 -12px; }
    .hero h1 { font-size: 26px; }
    .hero p { font-size: 14px; margin-bottom: 24px; }
    .hero-search input { padding: 13px 16px 13px 44px; font-size: 14px; }
    .hero-stats { gap: 24px; margin-top: 24px; }
    .hero-stat-num { font-size: 20px; }
    .sections-grid { grid-template-columns: 1fr; gap: 12px; }
    .section-card { padding: 18px; }
    .sc-icon-wrap { width: 40px; height: 40px; border-radius: 10px; }
    .sc-icon-wrap svg { width: 20px; height: 20px; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 22px; }
    .hero-stats { gap: 20px; flex-wrap: wrap; }
}
