/* ===================================
   HealthAPI.fit - Documentation Theme
   Clean, readable, GitBook-inspired
   =================================== */

/* CSS Variables - Light Mode (Default) */
:root {
    --sidebar-width: 280px;
    --header-height: 60px;

    /* Typography */
    --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
    --line-height: 1.7;
}

/* Light Mode Colors (Default) */
:root,
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-sidebar: #fafbfc;
    --text-primary: #24292f;
    --text-secondary: #57606a;
    --text-muted: #6e7781;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --border-light: #d0d7de;
    --border-medium: #8c959f;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.08);
}

/* Dark Mode Colors */
:root[data-theme="dark"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-sidebar: #010409;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --border-light: #30363d;
    --border-medium: #484f58;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.5);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-system);
    font-size: 16px;
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-primary);
}

/* Layout */
.docs-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.docs-sidebar {
    width: var(--sidebar-width);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    transform: scale(1.05);
}

.theme-icon {
    display: inline-block;
}

.sidebar-nav {
    padding: 1.5rem 0;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    display: block;
    padding: 0.5rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
}

.nav-links a:hover {
    color: var(--accent);
    background: rgba(9, 105, 218, 0.05);
}

.nav-links a.active {
    color: var(--accent);
    background: rgba(9, 105, 218, 0.05);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Collapsible sections */
.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-group-title:hover {
    color: var(--accent);
    background: rgba(9, 105, 218, 0.05);
}

.nav-group-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.nav-group.open .nav-group-icon {
    transform: rotate(90deg);
}

.nav-group-links {
    display: none;
    padding-left: 0;
}

.nav-group.open .nav-group-links {
    display: block;
}

.nav-group-links a {
    padding-left: 2.5rem;
    font-size: 0.875rem;
}

/* Main Content */
.docs-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.docs-header {
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

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

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--border-medium);
}

.docs-content {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 {
    font-size: 2rem;
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

h2 {
    font-size: 1.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-light);
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.1rem;
}

.lead {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

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

/* Links */
a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
}

thead {
    background: var(--bg-secondary);
}

th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-light);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tbody tr:hover {
    background: var(--bg-secondary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.35rem;
}

.badge-green {
    background: #dafbe1;
    color: #1a7f37;
}

.badge-blue {
    background: #ddf4ff;
    color: #0969da;
}

.badge-yellow {
    background: #fff8c5;
    color: #9a6700;
}

.badge-gray {
    background: #f6f8fa;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* Callouts */
.callout {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border-left: 3px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: 4px;
}

.callout h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.callout p:last-child {
    margin-bottom: 0;
}

.callout-info {
    border-left-color: #0969da;
    background: #ddf4ff;
    color: #0d1117;
}

.callout-warning {
    border-left-color: #9a6700;
    background: #fff8c5;
    color: #0d1117;
}

.callout-success {
    border-left-color: #1a7f37;
    background: #dafbe1;
    color: #0d1117;
}

/* Dark mode callouts */
:root[data-theme="dark"] .callout-info {
    border-left-color: #58a6ff;
    background: #0d419d;
    color: #e6edf3;
}

:root[data-theme="dark"] .callout-warning {
    border-left-color: #d29922;
    background: #4d3800;
    color: #e6edf3;
}

:root[data-theme="dark"] .callout-success {
    border-left-color: #3fb950;
    background: #033a16;
    color: #e6edf3;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-primary);
    transition: all 0.2s ease;
}

.card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.card h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.btn-secondary:hover {
    background: rgba(9, 105, 218, 0.05);
    text-decoration: none;
}

/* Stat Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    text-align: center;
    background: var(--bg-secondary);
}

.stat-num {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Footer */
.docs-footer {
    border-top: 1px solid var(--border-light);
    padding: 2rem;
    background: var(--bg-secondary);
    text-align: center;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 0;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 110;
    background: var(--accent);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.sidebar-toggle:hover {
    background: var(--accent-hover);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .docs-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

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

    .sidebar-toggle {
        display: block;
    }

    .docs-content {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

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

    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .docs-content {
        padding: 1.5rem 1rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }
}
