/* X78 Chat Docs - Custom Styles */

/* ===== ROOT VARIABLES ===== */
:root {
    --sidebar-width: 260px;
    --header-height: 60px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg-sidebar: #ffffff;
    --bg-content: #f8fafc;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

/* ===== GLOBAL ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-dark);
}

/* ===== TOP HEADER ===== */
.docs-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    z-index: 50;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.docs-header .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-header .logo span {
    background: var(--primary);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.docs-header .header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.docs-header .header-right a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.docs-header .header-right a:hover {
    color: var(--primary);
}

/* ===== HAMBURGER MENU ===== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-dark);
}

.hamburger-btn svg {
    width: 24px;
    height: 24px;
}

/* ===== SIDEBAR ===== */
.docs-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1.5rem 0;
    z-index: 40;
    transition: transform 0.3s ease;
}

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

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.sidebar-section {
    margin-bottom: 0.25rem;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.sidebar-section-title svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

.sidebar-link {
    display: block;
    padding: 0.4rem 1.25rem 0.4rem 2.5rem;
    font-size: 0.835rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    line-height: 1.5;
}

.sidebar-link:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.sidebar-link.active {
    color: var(--primary);
    background: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.docs-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 2rem 2.5rem 4rem;
}

.docs-content-inner {
    max-width: 800px;
    margin: 0 auto;
}

/* ===== TYPOGRAPHY ===== */
.docs-content h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.docs-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.docs-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.docs-content p {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #475569;
    margin-bottom: 1rem;
}

.docs-content ul, .docs-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.docs-content li {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #475569;
    margin-bottom: 0.25rem;
}

.docs-content strong {
    color: var(--text-dark);
    font-weight: 600;
}

.docs-content a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.docs-content a:hover {
    text-decoration: underline;
}

/* ===== CODE BLOCKS ===== */
.docs-content code {
    background: #f1f5f9;
    color: #e11d48;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.docs-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.7;
    position: relative;
}

.docs-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.code-label {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 600;
}

/* ===== ALERT BOXES ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ===== STEP BLOCKS ===== */
.steps {
    counter-reset: step-counter;
    margin-bottom: 1.5rem;
}

.step {
    counter-increment: step-counter;
    padding: 1rem 1.25rem 1rem 3.5rem;
    position: relative;
    margin-bottom: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.step::before {
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 1rem;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.step h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.step p {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ===== TABLE ===== */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.docs-content table th {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border);
}

.docs-content table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: #475569;
}

.docs-content table tr:hover td {
    background: #f8fafc;
}

/* ===== CARDS (Landing Page) ===== */
.feature-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.2s;
}

.feature-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.feature-card .icon {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--primary-light);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary);
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* ===== HERO (Landing) ===== */
.docs-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 1rem;
    margin-bottom: 2.5rem;
}

.docs-hero h1 {
    font-size: 2.25rem;
    margin-bottom: 0.75rem;
}

.docs-hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 540px;
    margin: 0 auto 1.5rem;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    color: #cbd5e1;
}

/* ===== FOOTER ===== */
.docs-footer {
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
    border-top: 1px solid var(--border);
    background: #ffffff;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== PREV/NEXT NAV ===== */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
}

.page-nav a {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 0;
    flex: 1;
}

.page-nav a:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    text-decoration: none;
}

.page-nav a .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.page-nav a .title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.page-nav a.next {
    text-align: right;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
    z-index: 30;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.back-to-top.visible {
    display: flex;
}

/* ===== OVERLAY (MOBILE) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 35;
}

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

/* ===== SEARCH BOX IN SIDEBAR ===== */
.sidebar-search {
    padding: 0 1rem 0.75rem;
    margin-bottom: 0.5rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.835rem;
    outline: none;
    background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 0.65rem center;
    transition: border-color 0.15s;
}

.sidebar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hamburger-btn {
        display: block;
    }

    .docs-sidebar {
        transform: translateX(-100%);
        z-index: 45;
    }

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

    .docs-content {
        margin-left: 0;
        padding: 1.5rem 1rem 3rem;
    }

    .docs-footer {
        margin-left: 0;
    }

    .docs-hero h1 {
        font-size: 1.75rem;
    }

    .page-nav {
        flex-direction: column;
    }

    .page-nav a.next {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .docs-content h1 {
        font-size: 1.5rem;
    }

    .docs-content h2 {
        font-size: 1.25rem;
    }

    .docs-hero {
        padding: 2rem 0.75rem 1.5rem;
    }
}

/* ===== BADGE ===== */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ===== IMAGE STYLING ===== */
.docs-content img {
    max-width: 100%;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    margin: 1rem 0;
}

/* ===== KBD ===== */
.docs-content kbd {
    background: #f1f5f9;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 0.25rem;
    padding: 0.1rem 0.4rem;
    font-size: 0.8rem;
    font-family: inherit;
}
