/* 
 * RestBI API Documentation - Modern Theme
 * Uses CSS Variables for easy customization and dark/light mode support
 */

:root {
    /* Primary Colors - Corporate Blue & Slate */
    --primary-color: #2563eb;       /* Modern Blue */
    --primary-hover: #1d4ed8;
    --secondary-color: #475569;     /* Slate */
    
    /* Sidebar Colors */
    --sidebar-bg: #0f172a;          /* Dark Slate */
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #1e293b;

    /* Content Colors */
    --body-bg: #f8fafc;             /* Very light blue-gray */
    --card-bg: #ffffff;
    --text-main: #1e293b;           /* Dark Slate */
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    /* Code Blocks */
    --code-bg: #1e1e1e;             /* VS Code Dark */
    --code-header-bg: #2d2d2d;
    
    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Layout */
    --sidebar-width: 280px;
    --header-height: 60px;
}

/* Base Refresh */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--body-bg);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 0.75rem;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; margin-top: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }
h3 { font-size: 1.5rem; margin-top: 1.5rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Layout Container */
.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Modern Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Sidebar Branding */
.sidebar-header {
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-title {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    display: block;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-label {
    padding: 0.75rem 1.5rem 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-text);
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar-menu li a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-menu li.active a {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--primary-color);
}

.sidebar-menu li a i {
    margin-right: 0.75rem;
    font-size: 1.1em;
    opacity: 0.8;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem 5rem;
    max-width: 100%; /* Changed from 1200px to avoid fixed constraints */
    box-sizing: border-box;
    transition: margin-left 0.3s ease;
    overflow-x: hidden; /* Prevent horizontal scroll on main container */
}

/* Card & Sections */
.content-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    overflow-wrap: break-word; /* Ensure long words don't break layout */
}

/* Code Blocks & Pre */
div.code-toolbar {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

pre[class*="language-"] {
    margin: 0 !important;
    border-radius: 0 0 8px 8px !important;
    padding: 1.5rem !important;
    background: var(--code-bg) !important;
    overflow-x: auto !important; /* Ensure horizontal scroll for code */
    -webkit-overflow-scrolling: touch;
}

.code-header {
    background: var(--code-header-bg);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3e3e3e;
}

.lang-badge {
    font-size: 0.75rem;
    color: #aaa;
    text-transform: uppercase;
    font-weight: bold;
}

.btn-copy {
    background: transparent;
    border: 1px solid #555;
    color: #ccc;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #444;
    color: #fff;
}

/* Alerts / Callouts */
.alert-modern {
    border-left: 4px solid;
    padding: 1.25rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    background: #fff;
    display: flex;
    align-items: start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.alert-modern i {
    font-size: 1.5rem;
    margin-right: 1rem;
    margin-top: 0.1rem;
}

.alert-modern-content h5 {
    margin-top: 0;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.alert-info {
    border-color: var(--info);
    background: #eff6ff;
    color: #1e40af;
}

.alert-warning {
    border-color: var(--warning);
    background: #fffbeb;
    color: #92400e;
}

.alert-danger {
    border-color: var(--danger);
    background: #fef2f2;
    color: #b91c1c;
}

.alert-success {
    border-color: var(--success);
    background: #ecfdf5;
    color: #065f46;
}

/* Tables */
.table-modern {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
    font-size: 0.95rem;
    display: block; /* Make table scrollable on small screens */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-modern th {
    background: #f1f5f9;
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
}

.table-modern td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.table-modern tr:hover td {
    background-color: #f8fafc;
}

/* Badges */
.badge-soft {
    padding: 0.25em 0.6em;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-method {
    display: inline-block;
    min-width: 60px;
    text-align: center;
    margin-right: 0.5rem;
}

/* Language Switcher Buttons */
.lang-selector-container {
    padding: 0 1rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.lang-selector-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #475569;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.btn-group-lang {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.2);
    padding: 4px;
    border-radius: 6px;
}

.btn-lang {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 0.75rem;
    padding: 6px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-lang:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.btn-lang.active {
    background: var(--primary-color);
    color: #fff;
}

/* Migration Guide Enhancements */
.table-migration th {
    background-color: #f1f5f9;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.checklist-item i {
    color: var(--success);
    font-size: 1.1rem;
}

/* Version Toggle Enhancements */
.btn-version {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-version.active {
    background: var(--primary-color);
    color: #fff;
}

.btn-version:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Utility to hide elements */
.d-none {
    display: none !important;
}

/* Responsive */
@media (max-width: 992px) {
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.active {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    }
    
    .main-content {
        margin-left: 0;
        padding: 4rem 1rem 3rem; /* Adjusted for mobile button */
    }

    .content-section {
        padding: 1.5rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    
    .sidebar-toggle-btn {
        display: block !important; /* Force show on mobile */
    }
}

.sidebar-toggle-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    padding: 0.5rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}