/* ============================================
   FlexiCheckoutRules Documentation Styles
   ============================================ */

:root {
    --fcr-primary: #3b8ae6;
    --fcr-primary-dark: #2c6cb8;
    --fcr-primary-light: #e8f1fc;
    --fcr-text: #2c3e50;
    --fcr-text-muted: #6c757d;
    --fcr-bg: #ffffff;
    --fcr-bg-soft: #f8f9fa;
    --fcr-border: #e3e6ea;
    --fcr-code-bg: #f6f8fa;
    --fcr-shadow: 0 2px 4px rgba(0,0,0,0.04);
    --fcr-shadow-lg: 0 8px 24px rgba(59,138,230,0.12);
}

/* ====== Base ====== */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--fcr-text);
    background: var(--fcr-bg);
    line-height: 1.65;
    font-size: 16px;
}

/* ====== Navbar ====== */
.fcr-navbar {
    background: #fff;
    border-bottom: 1px solid var(--fcr-border);
    box-shadow: var(--fcr-shadow);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.fcr-navbar .navbar-brand {
    font-weight: 600;
    color: var(--fcr-text);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.fcr-navbar .navbar-brand i {
    color: var(--fcr-primary);
    font-size: 1.4rem;
}
.fcr-navbar .version-badge {
    background: var(--fcr-primary-light);
    color: var(--fcr-primary-dark);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-left: 8px;
}

/* ====== Layout ====== */
.fcr-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ====== Sidebar ====== */
.fcr-sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 30px 20px 30px 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    border-right: 1px solid var(--fcr-border);
}
.fcr-sidebar h6 {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--fcr-text-muted);
    margin: 18px 12px 8px;
    font-weight: 600;
}
.fcr-sidebar a {
    display: block;
    padding: 7px 12px;
    color: var(--fcr-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.92rem;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}
.fcr-sidebar a:hover {
    background: var(--fcr-bg-soft);
    color: var(--fcr-primary);
}
.fcr-sidebar a.active {
    background: var(--fcr-primary-light);
    color: var(--fcr-primary-dark);
    font-weight: 600;
}
.fcr-sidebar a .num {
    display: inline-block;
    width: 22px;
    color: var(--fcr-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
}
.fcr-sidebar a.active .num { color: var(--fcr-primary); }

/* Mobile sidebar toggle */
.fcr-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--fcr-primary);
    color: #fff;
    border: none;
    box-shadow: var(--fcr-shadow-lg);
    font-size: 1.3rem;
    cursor: pointer;
}

/* ====== Content ====== */
.fcr-content {
    flex: 1;
    min-width: 0;
    padding: 30px 0 60px 40px;
    max-width: 920px;
}
.fcr-content section {
    margin-bottom: 50px;
    scroll-margin-top: 80px;
}
.fcr-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--fcr-text);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--fcr-border);
}
.fcr-content h1 .section-num {
    color: var(--fcr-primary);
    font-weight: 500;
    margin-right: 10px;
}
.fcr-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--fcr-text);
    margin-top: 35px;
    margin-bottom: 15px;
}
.fcr-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--fcr-text);
    margin-top: 25px;
    margin-bottom: 12px;
}
.fcr-content p { margin-bottom: 14px; }
.fcr-content ul, .fcr-content ol { margin-bottom: 16px; padding-left: 24px; }
.fcr-content li { margin-bottom: 6px; }
.fcr-content strong { color: var(--fcr-text); font-weight: 600; }
.fcr-content a { color: var(--fcr-primary); text-decoration: none; }
.fcr-content a:hover { text-decoration: underline; }

/* Anchor links on headings */
.fcr-content h2, .fcr-content h3 { position: relative; }
.fcr-content h2 .anchor, .fcr-content h3 .anchor {
    opacity: 0;
    color: var(--fcr-text-muted);
    text-decoration: none;
    margin-left: 8px;
    font-size: 0.85em;
    transition: opacity 0.15s;
}
.fcr-content h2:hover .anchor, .fcr-content h3:hover .anchor { opacity: 1; }

/* ====== Callouts ====== */
.callout {
    border-left: 4px solid;
    padding: 14px 18px;
    margin: 18px 0;
    border-radius: 4px;
    background: var(--fcr-bg-soft);
}
.callout-title {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.callout p:last-child { margin-bottom: 0; }
.callout-info { border-color: var(--fcr-primary); background: #eff6ff; }
.callout-info .callout-title { color: var(--fcr-primary-dark); }
.callout-warn { border-color: #f59e0b; background: #fffbeb; }
.callout-warn .callout-title { color: #b45309; }
.callout-danger { border-color: #ef4444; background: #fef2f2; }
.callout-danger .callout-title { color: #b91c1c; }
.callout-tip { border-color: #10b981; background: #ecfdf5; }
.callout-tip .callout-title { color: #047857; }
.callout-example { border-color: #8b5cf6; background: #f5f3ff; }
.callout-example .callout-title { color: #6d28d9; }

/* ====== Code blocks ====== */
.fcr-content pre {
    background: var(--fcr-code-bg);
    border: 1px solid var(--fcr-border);
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 14px 0;
    font-size: 0.88rem;
    position: relative;
}
.fcr-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.fcr-content code {
    background: var(--fcr-code-bg);
    color: #d63384;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: "SFMono-Regular", Consolas, monospace;
}
.fcr-content pre code.hljs {
    padding: 0;
    background: transparent;
}
.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid var(--fcr-border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--fcr-text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.fcr-content pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--fcr-primary); border-color: var(--fcr-primary); }
.copy-btn.copied { color: #10b981; border-color: #10b981; }

/* ====== Tables ====== */
.fcr-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.92rem;
}
.fcr-content th, .fcr-content td {
    padding: 10px 14px;
    border: 1px solid var(--fcr-border);
    text-align: left;
    vertical-align: top;
}
.fcr-content th {
    background: var(--fcr-bg-soft);
    font-weight: 600;
}
.fcr-content tr:hover td { background: #fafbfc; }

/* ====== Screenshots ====== */
.screenshot {
    margin: 18px 0;
    padding: 8px;
    background: var(--fcr-bg-soft);
    border: 1px solid var(--fcr-border);
    border-radius: 6px;
}
.screenshot img {
    max-width: 100%;
    border-radius: 4px;
    display: block;
}
.screenshot-placeholder {
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: 4px;
    padding: 40px;
    text-align: center;
    color: var(--fcr-text-muted);
    font-size: 0.9rem;
}
.screenshot-placeholder i { font-size: 2.5rem; opacity: 0.4; display: block; margin-bottom: 10px; }
.screenshot-caption {
    font-size: 0.85rem;
    color: var(--fcr-text-muted);
    margin-top: 8px;
    text-align: center;
    font-style: italic;
}

/* ====== Hero ====== */
.fcr-hero {
    background: linear-gradient(135deg, #3b8ae6 0%, #5b9ee9 100%);
    color: #fff;
    padding: 50px 40px;
    border-radius: 12px;
    margin-bottom: 35px;
    box-shadow: var(--fcr-shadow-lg);
}
.fcr-hero h1 {
    color: #fff;
    border: none;
    padding: 0;
    margin-bottom: 12px;
    font-size: 2.4rem;
}
.fcr-hero p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0;
}
.fcr-hero .badges {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.fcr-hero .badges span {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

/* ====== Footer ====== */
.fcr-footer {
    border-top: 1px solid var(--fcr-border);
    padding: 30px 20px;
    text-align: center;
    color: var(--fcr-text-muted);
    font-size: 0.88rem;
    margin-top: 60px;
}
.fcr-footer a { color: var(--fcr-primary); }

/* ====== Responsive ====== */
@media (max-width: 992px) {
    .fcr-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: #fff;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding: 70px 20px 20px;
        border-right: 1px solid var(--fcr-border);
        box-shadow: 4px 0 16px rgba(0,0,0,0.08);
    }
    .fcr-sidebar.show { transform: translateX(0); }
    .fcr-sidebar-toggle { display: flex; align-items: center; justify-content: center; }
    .fcr-content {
        padding: 20px 0 60px 0;
        max-width: 100%;
    }
    .fcr-sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1045;
    }
    .fcr-sidebar-backdrop.show { display: block; }
    .fcr-hero { padding: 35px 25px; }
    .fcr-hero h1 { font-size: 1.8rem; }
}

@media (max-width: 576px) {
    .fcr-content h1 { font-size: 1.7rem; }
    .fcr-content h2 { font-size: 1.3rem; }
    .fcr-navbar .version-badge { display: none; }
}

/* ====== Utilities ====== */
.text-primary { color: var(--fcr-primary) !important; }
.bg-primary-light { background: var(--fcr-primary-light) !important; }
.kbd {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 2px 7px;
    font-family: monospace;
    font-size: 0.85em;
    color: #475569;
}
.fcr-tag {
    display: inline-block;
    background: var(--fcr-primary-light);
    color: var(--fcr-primary-dark);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 500;
    margin-right: 4px;
}
