/* Global Reset & Box Sizing */
:root {
    /* Default Dark Theme Variables */
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --sidebar-bg: rgba(15, 23, 42, 0.95);
    --nav-bg: rgba(15, 23, 42, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #00f3ff;
    --accent-hover: #00c7d1;
    --border-color: rgba(148, 163, 184, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --input-bg: rgba(30, 41, 59, 0.5);
    --input-focus-bg: rgba(30, 41, 59, 0.8);
    --hover-bg: rgba(255, 255, 255, 0.05);
    /* Generic hover */
    --font-main: 'Outfit', sans-serif;

    /* Gradients */
    --body-gradient-1: rgba(99, 102, 241, 0.15);
    /* Purple/Indigo */
    --body-gradient-2: rgba(139, 92, 246, 0.15);
    /* Violet */
    --price-color: #34d399;
    /* emerald-400 */
}

/* Light Theme Overrides */
[data-theme="light"] {
    --bg-color: #f1f5f9;
    /* Slate 100 */
    --card-bg: rgba(255, 255, 255, 0.8);
    --sidebar-bg: rgba(255, 255, 255, 0.95);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --text-primary: #1e293b;
    /* Slate 800 */
    --text-secondary: #64748b;
    /* Slate 500 */
    --sea-blue: #006994;
    --accent-color: var(--sea-blue);
    /* Sea Blue for contrast on white */
    --accent-hover: #005b82;
    --border-color: rgba(148, 163, 184, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    /* Lighter shadow */
    --input-bg: rgba(255, 255, 255, 0.6);
    --input-focus-bg: rgba(255, 255, 255, 1);
    --hover-bg: rgba(0, 0, 0, 0.05);

    /* Lighter Gradients */
    --body-gradient-1: rgba(99, 102, 241, 0.08);
    --body-gradient-2: rgba(139, 92, 246, 0.08);
    --price-color: #059669;
    /* emerald-600 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: 90px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, var(--body-gradient-1) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, var(--body-gradient-2) 0%, transparent 25%);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Top Navbar */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 50;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.brand {
    display: flex;
    align-items: baseline;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    display: flex;
    align-items: center;
}

.brand h1 {
    font-size: 1.75rem;
    margin: 0;
}

.brand .subtitle {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.brand-logo {
    height: 70px; /* Matches the exact height of the top-nav */
    width: auto;
    object-fit: cover;
    padding: 0;
    margin: 0 0 0 -2rem; /* Pulls the logo to the absolute left edge of the screen */
    border: none;
    border-radius: 0; /* Removes curved edges so it sits perfectly flush */
}

/* Layout */
.app-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
    padding-top: 70px;
    /* Offset for fixed navbar */
}

/* Sidebar */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 10;
}

/* Admin / Dashboard Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    list-style: none;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border-color: rgba(99, 102, 241, 0.2);
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* Removed old brand styles inside sidebar as they are now global/in nav */

.filters-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.clear-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.search-input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.filter-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Form Elements */
input,
select {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-input-group input {
    padding-left: 2.75rem;
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    appearance: none;
}

input:focus,
select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    background: var(--input-focus-bg);
}

.filter-group-search {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    background: var(--input-bg);
    border-radius: 0.5rem;
}

.checkbox-label.unavailable {
    opacity: 0.3;
    pointer-events: none;
    order: 100;
    /* Optional: push to bottom */
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for checkboxes */
.checkbox-group::-webkit-scrollbar {
    width: 6px;
}

.checkbox-group::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.checkbox-group::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    cursor: pointer;
    display: grid;
    place-content: center;
    margin: 0;
    padding: 0;
    /* Reset input styles */
}

.checkbox-label input[type="checkbox"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.checkbox-label input[type="checkbox"]:checked::before {
    transform: scale(1);
}

/* Main Content */
.main-content {
    padding: 3rem;
    overflow-x: hidden;
}

/* Grid Layout */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

/* Company Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 1.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.3);
}

.card:hover::before {
    opacity: 1;
}

/* Gradient glow effect on hover */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.06), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 0;
}

.card-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.card-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-title p {
    font-size: 0.875rem;
    color: var(--accent-color);
    font-weight: 500;
}

.card-location {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.tag {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.price-tag {
    font-weight: 600;
    color: var(--price-color);
}

/* Loading/Empty States */
#loading,
#no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.hidden {
    display: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card.animate-in {
    animation: fadeScaleIn 0.5s ease-out forwards;
}

/* Button Styles - Reused */
.view-details-btn {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.8rem 0;
    width: 100%;
    text-align: center;
    /* Glossy Background */
    background: rgba(99, 102, 241, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border: 1px solid var(--border-color);
    border-top: 1px solid rgba(99, 102, 241, 0.3);
    /* Top highlight */
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 1px solid rgba(99, 102, 241, 0.2);
    /* Left highlight */
    color: #fff;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2), inset 0 0 10px rgba(99, 102, 241, 0.1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.view-details-btn:hover {
    background: rgba(99, 102, 241, 0.5);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4), inset 0 0 20px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.4);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    border-color: var(--accent-color);
    color: #fff;
}

/* Shine effect */
.view-details-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
    transform: skewX(-20deg);
    transition: 0.6s;
}

.view-details-btn:hover::after {
    left: 150%;
    transition: 0.7s ease-in-out;
}

/* Detail Page Styles (Preserved) */
.detail-page {
    background-image:
        radial-gradient(circle at 50% 10%, rgba(99, 102, 241, 0.1) 0%, transparent 40%);
}

.detail-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text-primary);
}

.detail-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 3rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--glass-shadow);
}

.detail-header {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 3rem;
}

.detail-logo {
    width: 100px;
    height: 100px;
    border-radius: 1.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.detail-title-block h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    background: none;
    -webkit-text-fill-color: initial;
    animation: none;
}

.detail-category {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.detail-location {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

.detail-main h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.detail-description {
    color: #cbd5e1;
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.detail-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.info-card {
    background: rgba(15, 23, 42, 0.4);
    background: var(--input-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.info-item {
    margin-bottom: 1.25rem;
}

.info-item .label {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-item .value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1.1rem;
}

.info-item .value.link {
    color: var(--accent-color);
    text-decoration: none;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    background: var(--hover-bg);
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: rotate(15deg);
}

/* Navbar Search */
.search-container-nav {
    position: relative;
    flex: 1 1 auto;
    max-width: 600px;
    margin: 0 2rem;
}

.input-icon-nav {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.search-container-nav input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.8rem;
    background: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    /* Pill shape for nav search */
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.search-container-nav input:focus {
    background: var(--input-focus-bg);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 768px) {
    .app-layout {
        display: block;
        /* Switch to column */
    }

    .sidebar {
        height: auto;
        position: relative;
        top: 0;
        padding: 2rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        gap: 1rem;
    }

    /* Make the admin navigation horizontally scrollable on mobile to save vertical space */
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .sidebar-link {
        white-space: nowrap;
    }

    .top-nav {
        padding: 0 1rem;
        height: auto;
        flex-wrap: wrap;
        gap: 1rem;
        padding-bottom: 1rem;
    }

    .brand {
        flex: 1 0 auto;
        width: 100%;
        margin-bottom: 0.5rem;
        justify-content: center;
    }

    .search-container-nav {
        flex: 1 0 100%;
        margin: 0;
        order: 3;
    }

    .app-layout {
        padding-top: 150px;
        /* Increase offset for taller mobile nav */
    }

    .main-content {
        padding: 2rem 1.5rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .detail-location {
        justify-content: center;
    }
}


/* Documentation Layout */
.doc-layout {
    display: flex;
    min-height: calc(100vh - 70px);
    margin-top: 70px;
}

.doc-sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    padding: 2rem;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.doc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.doc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

.doc-content {
    flex: 1;
    padding: 3rem 4rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

/* Back Link in Sidebar */
.doc-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.doc-back-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Sidebar Module List */
.sidebar-modules {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.module-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.module-item:hover {
    background: rgba(255, 255, 255, 0.03);
    background: var(--hover-bg);
    color: var(--text-primary);
}

.module-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border-color: rgba(99, 102, 241, 0.2);
    font-weight: 500;
}

.module-checkbox {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 4px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.module-item.completed .module-checkbox {
    background: #10b981;
    border-color: #10b981;
}

.module-item.completed .module-checkbox i {
    opacity: 1;
}

/* Main Content Typography */
.doc-header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.doc-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.doc-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    align-items: center;
}

.doc-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-body {
    color: #cbd5e1;
    line-height: 1.8;
    font-size: 1.05rem;
}

.doc-body h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.doc-body p {
    margin-bottom: 1.5rem;
}

/* Progress Sidebar Widget (Bottom of Sidebar) */
.sidebar-progress {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-progress h4 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.progress-track {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: #10b981;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Book-style Sidebar */
.sidebar-chapter {
    margin-bottom: 1rem;
}

.chapter-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}

.chapter-title:hover {
    color: var(--text-primary);
}

.chapter-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.sidebar-chapter.collapsed .chapter-icon {
    transform: rotate(-90deg);
}

.chapter-pages {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    /* Arbitrary large height */
    opacity: 1;
}

.sidebar-chapter.collapsed .chapter-pages {
    max-height: 0;
    opacity: 0;
}

.page-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem 0.6rem 1.5rem;
    font-size: 0.95rem;
    color: #cbd5e1;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.page-item:hover {
    background: rgba(255, 255, 255, 0.03);
    background: var(--hover-bg);
    color: var(--text-primary);
}

.page-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 500;
}

.page-item .status-icon {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    margin-right: 12px;
    opacity: 0.5;
}

.page-item.completed .status-icon {
    background: #10b981;
    opacity: 1;
}


.module-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.module-item-doc {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.module-item-doc:hover {
    background: rgba(255, 255, 255, 0.05);
    background: var(--hover-bg);
    color: var(--text-primary);
}

.module-item-doc.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
}

.module-item-doc i {
    width: 16px;
    height: 16px;
}

/* Mobile Responsive for Doc Layout */
@media (max-width: 768px) {
    .doc-layout {
        flex-direction: column;
    }

    .doc-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .doc-content {
        padding: 2rem;
    }
}

/* Fluid Layout Enforcements */
.doc-layout.three-col-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 240px;
    gap: 2rem;
    width: 100%;
    max-width: none !important;
    padding: 0;
    /* Offset for fixed navbar */
    align-items: start;
    min-height: 100vh;
    /* Match home page full height strategy */
}

@media (max-width: 1024px) {
    .doc-layout.three-col-layout {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

.doc-content {
    max-width: none !important;
    width: 100%;
    margin: 0;
}

/* Table of Contents (Right Sidebar) */
.doc-toc {
    padding: 2rem 1rem 2rem 0;
    position: sticky;
    top: 90px;
    /* 70px Navbar + 20px gap */
    height: calc(100vh - 90px);
    overflow-y: auto;
    font-size: 0.9rem;
}

.toc-container {
    position: relative;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.toc-link {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
    line-height: 1.4;
}

.toc-link:hover {
    color: var(--accent-color);
}

.toc-link.active {
    color: var(--accent-color);
    font-weight: 500;
}

/* Scrollbar for TOC */
.doc-toc::-webkit-scrollbar {
    width: 0px;
    /* Hidden but scrollable */
}

@media (max-width: 1024px) {
    .doc-toc {
        display: none;
        /* Hide on smaller screens as defined in grid layout */
    }
}

/* Navbar Link Items */
.nav-link-item {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-link-item:hover,
.nav-link-item.active {
    color: var(--accent-color) !important;
}

.nav-admin-btn {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.nav-admin-btn:hover,
.nav-admin-btn.active {
    color: var(--accent-color) !important;
}

/* Navbar Auth Buttons */
.nav-login-btn {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-login-btn:hover,
.nav-login-btn.active {
    color: var(--accent-color) !important;
}
.nav-register-btn {
    text-decoration: none;
    background: var(--accent-color);
    color: var(--bg-color) !important; /* Ensures contrast in both light and dark mode */
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.nav-register-btn:hover,
.nav-register-btn.active {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nav-register-btn.active {
    box-shadow: 0 0 0 2px var(--nav-bg), 0 0 0 4px var(--accent-color) !important;
}