:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338ca;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --background: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --sidebar-bg: #0F172A;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 88px;
    --header-height: 64px;
    --border-radius-card: 16px;
    --border-radius-btn: 10px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --transition-speed: 0.2s;
}

/* Reset & Base */
body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5em;
    letter-spacing: -0.025em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed);
}

/* Layout Wrapper */
.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #94a3b8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Allow scrolling within sidebar if needed */
    overflow-x: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar.collapsed {
    min-width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
}

.brand-icon {
    min-width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), #818cf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.brand-logo-img {
    height: 28px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

.brand-logo-img-sm {
    height: 24px;
}

.brand-logo-img-lg {
    height: 40px;
}

.brand-logo-img-dark {
    filter: brightness(0) invert(1);
}

.sidebar-menu {
    padding: 24px 12px;
    flex-grow: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #94a3b8;
    border-radius: var(--border-radius-btn);
    margin-bottom: 4px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: all var(--transition-speed);
}

.nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #fff;
    background-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-icon {
    min-width: 24px;
    text-align: center;
    font-size: 1.1rem;
    margin-right: 12px;
    transition: margin var(--transition-speed);
}

#sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    display: none;
}

#sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

#sidebar.collapsed .nav-icon {
    margin-right: 0;
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar */
.topbar {
    height: var(--header-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.toggle-btn:hover {
    background-color: var(--background);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #E0E7FF;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border-color);
}

/* Page Content */
.content-wrapper {
    padding: 40px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-card);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    /* height: 100%; */
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #d1d5db;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #4338ca);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-btn);
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #3730a3);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--border-radius-btn);
    font-weight: 500;
    transition: all var(--transition-speed);
}

.btn-outline:hover {
    background-color: var(--background);
    color: var(--text-primary);
    border-color: #d1d5db;
}

/* Login Page */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--background);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.form-control {
    padding: 12px 16px;
    border-radius: var(--border-radius-btn);
    border: 1px solid var(--border-color);
    background-color: #fff;
    transition: all var(--transition-speed);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Dashboard Stats */
.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 8px;
    letter-spacing: -0.05em;
}

.stat-trend {
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

/* Documentation Layout */
.docs-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.docs-sidebar {
    width: 300px;
    min-width: 300px;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
    z-index: 100;
}

.docs-content {
    flex-grow: 1;
    padding: 48px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Docs Sidebar Styling */
.docs-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.docs-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 8px 24px;
    margin-top: 16px;
    letter-spacing: 0.05em;
}

.docs-menu-item {
    display: block;
    padding: 8px 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
}

.docs-menu-item:hover {
    color: var(--primary-color);
    background-color: #F3F4F6;
}

.docs-menu-item.active {
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    background-color: #EEF2FF;
    font-weight: 600;
}

/* Mac-style Code Editor */
.code-editor {
    background-color: #0F172A;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-top: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-header {
    background-color: #0F172A;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background-color: #FF5F56;
}

.dot-yellow {
    background-color: #FFBD2E;
}

.dot-green {
    background-color: #27C93F;
}

.editor-tabs {
    display: flex;
    gap: 24px;
}

.editor-tab {
    color: #64748B;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.editor-tab:hover {
    color: #CBD5E1;
}

.editor-tab.active {
    color: #38BDF8;
    /* Sky blue for active state */
}

.copy-link-btn {
    color: #64748B;
    font-size: 0.85rem;
    cursor: pointer;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.copy-link-btn:hover {
    color: #fff;
}

.editor-content {
    background-color: #0F172A;
    /* Dark blue background */
    padding: 24px;
    color: #E2E8F0;
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    /* Increased font size */
    line-height: 1.6;
    overflow-x: auto;
}

.syntax-purple {
    color: #C084FC;
}

.syntax-blue {
    color: #38BDF8;
}

.syntax-green {
    color: #4ADE80;
}

.syntax-yellow {
    color: #FACC15;
}

.syntax-string {
    color: #A5F3FC;
}

/* Submenu */
.docs-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #F9FAFB;
}

.docs-menu-toggle {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.docs-menu-toggle .docs-toggle-icon {
    transition: transform .2s ease;
}

.docs-menu-toggle[aria-expanded="true"] .docs-toggle-icon {
    transform: rotate(180deg);
}

.docs-submenu-wrap {
    display: none;
}

.docs-submenu-wrap.expanded {
    display: block;
}

.docs-submenu-item {
    display: block;
    padding: 8px 24px 8px 48px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.docs-submenu-item:hover {
    color: var(--primary-color);
}

.docs-submenu-item.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* Code Tabs */
.code-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #0F172A;
    border-radius: 12px 12px 0 0;
    padding: 0 16px;
    margin-top: 16px;
}

.code-tab {
    padding: 12px 16px;
    color: #94A3B8;
    background: transparent;
    border: none;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.code-tab:hover {
    color: #fff;
}

.code-tab.active {
    color: #fff;
    border-bottom-color: var(--primary-color);
}

.code-block-tabbed {
    background-color: #1E293B;
    border-radius: 0 0 12px 12px;
    padding: 24px;
    color: #E2E8F0;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    position: relative;
    overflow-x: auto;
    margin-top: 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Docs Content Styling */
.docs-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.docs-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.docs-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.endpoint-block {
    margin-bottom: 60px;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.endpoint-url {
    font-family: 'Fira Code', monospace;
    background-color: #F3F4F6;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.param-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    padding-bottom: 12px;
}

.param-table td {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.param-name {
    font-family: 'Fira Code', monospace;
    color: var(--primary-color);
    font-weight: 500;
}

.param-type {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 4px;
}

@media (max-width: 991px) {
    .docs-wrapper {
        flex-direction: column;
    }

    .docs-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 300px;
        /* limit height on mobile */
    }

    .docs-content {
        padding: 24px;
    }
}


.method-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-right: 12px;
}

.badge-get {
    background-color: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.badge-post {
    background-color: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
}

.badge-put {
    background-color: #FFFBEB;
    color: #D97706;
    border: 1px solid #FDE68A;
}

.badge-delete {
    background-color: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
}

.code-block {
    background-color: #1E293B;
    border-radius: 12px;
    padding: 20px;
    color: #E2E8F0;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    position: relative;
    margin-top: 16px;
    overflow-x: auto;
}

.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-code-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.response-viewer {
    background: #0f172a;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .24);
    overflow: hidden;
}

.response-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #111827;
    color: #e5e7eb;
    border-bottom: 1px solid rgba(148, 163, 184, .24);
}

.response-status-badge {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
}

.response-status-success {
    background: rgba(16, 185, 129, .15);
    color: #6ee7b7;
}

.response-status-error {
    background: rgba(239, 68, 68, .15);
    color: #fca5a5;
}

.response-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: .8rem;
    color: #9ca3af;
}

.response-body {
    max-height: 520px;
    overflow: auto;
    padding: 14px;
    font-family: 'Fira Code', monospace;
    font-size: .82rem;
    color: #e2e8f0;
}

.json-tree details {
    margin-left: 12px;
}

.json-tree summary {
    cursor: pointer;
    color: #93c5fd;
}

.json-key {
    color: #93c5fd;
}

.json-string {
    color: #86efac;
}

.json-number {
    color: #fcd34d;
}

.json-bool {
    color: #c4b5fd;
}

/* Profile API Key */
.api-key-box {
    background-color: #F8FAFC;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: monospace;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.masked-key {
    letter-spacing: 2px;
}

/* Docs User Profile */
.docs-user-profile {
    margin-top: auto;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.docs-user-profile:hover {
    background-color: #F9FAFB;
}

.docs-user-info {
    flex-grow: 1;
    overflow: hidden;
}

.docs-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.docs-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.docs-sidebar {
    display: flex;
    flex-direction: column;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Responsive */
@media (max-width: 991px) {
    #sidebar {
        position: fixed;
        transform: translateX(-100%);
    }

    #sidebar.active {
        transform: translateX(0);
    }

    .topbar {
        padding: 0 24px;
    }

    .content-wrapper {
        padding: 24px;
    }

    .api-layout {
        grid-template-columns: 1fr;
    }

    .api-sidebar {
        display: none;
        /* Can implement mobile dropdown later */
    }
}