/* PassMedicine Theme Variables (White/Clean Theme) */
:root {
    --pm-sidebar-bg: #ffffff;
    --pm-sidebar-text: #64748b;
    --pm-sidebar-active-bg: #eff6ff;
    --pm-sidebar-active-text: #2563eb;
    --pm-sidebar-hover: #f1f5f9;
    --pm-accent: #2563eb;
    --pm-bg-content: #ffffff;
    --pm-text-main: #334155;
    --pm-heading: #0f172a;
    --pm-highlight: #fef08a;
    --pm-border: #e2e8f0;
}

/* Sidebar Styling - Tree View Optimized */
.pm-sidebar-container {
    width: 280px;
    background-color: var(--pm-sidebar-bg);
    color: var(--pm-sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--pm-border);
    transition: width 0.3s ease;
    height: 100%;
}

.pm-sidebar-header {
    padding: 1rem;
    background-color: var(--pm-sidebar-bg);
    border-bottom: 1px solid var(--pm-border);
}

.pm-search-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 2.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.pm-search-box::placeholder {
    color: #94a3b8;
}

/* Tree View Specifics (Replacing old flat nav) */
.tree-sidebar {
    background: #ffffff;
}

.folder-name {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

.tree-file {
    color: #64748b;
    font-weight: 400;
}

.tree-file:hover {
    background: #f1f5f9;
    color: var(--pm-accent);
}

.tree-file.active {
    background: #eff6ff;
    color: var(--pm-accent);
    border-left-color: var(--pm-accent);
    font-weight: 600;
}

/* Main Content Area - Typography Refresh */
.pm-book-content {
    background-color: white;
    padding: 3rem 4rem;
    font-family: 'Open Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
    color: var(--pm-text-main);
    line-height: 1.8;
    /* Increased for better reading */
    font-size: 16px;
    max-width: 900px;
    /* Optimal reading width */
    margin: 0 auto;
}

.pm-book-content h1 {
    font-size: 2.2rem;
    color: var(--pm-heading);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.pm-book-content h2 {
    font-size: 1.5rem;
    color: var(--pm-heading);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.pm-book-content h3 {
    font-size: 1.25rem;
    color: var(--pm-heading);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.pm-book-content p {
    margin-bottom: 1.25rem;
}

/* List Styling - clean bullets */
.pm-book-content ul {
    margin-bottom: 1.25rem;
    padding-left: 1.25rem;
    list-style-type: disc;
}

.pm-book-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.pm-book-content li::marker {
    color: #94a3b8;
}

.pm-book-content mark,
.highlight {
    background-color: #fef9c3;
    padding: 0.1em 0.3em;
    border-radius: 2px;
}

.pm-book-content img {
    max-width: 100%;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin: 2rem 0;
    border: 1px solid #f1f5f9;
}

.pm-navbar {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: none;
    height: 64px;
}

/* Mobile Responsiveness for Sidebar */
@media (max-width: 768px) {
    .pm-sidebar-container {
        position: fixed;
        top: 64px;
        /* Below navbar */
        left: -280px;
        /* Hide off-screen */
        bottom: 0;
        z-index: 1000;
        width: 280px;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    }

    .pm-sidebar-container.open {
        left: 0;
        /* Slide in */
    }

    /* Overlay when sidebar matches */
    .pm-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 999;
        display: none;
    }

    .pm-sidebar-overlay.active {
        display: block;
    }
}

/* Sidebar Padding Fix */
.tree-content {
    padding-left: 1rem !important;
    /* Ensure text doesn't touch edge */
}

/* Profile Dropdown Styles */
.profile-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0.5rem;
    min-width: 200px;
    z-index: 50;
    border: 1px solid #e2e8f0;
    margin-top: 0.5rem;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-item {
    width: 100%;
    text-align: left;
    padding: 0.75rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pm-text-main);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f1f5f9;
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
}

.btn-icon:hover {
    background-color: #f1f5f9;
}