/* ==========================================================================
   Better Piano Practice - User Documentation Custom Styles
   Aligned with the core Better Piano Practice dark theme, typography & aesthetics
   ========================================================================== */

/* --- Import Inter & Roboto Mono Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto+Mono:wght@400;500;600&display=swap');

:root {
    --bpp-bg-primary: #0f131a;
    --bpp-bg-secondary: #1e1e1e;
    --bpp-bg-tertiary: #2c2c2c;
    --bpp-text-primary: #ffffff;
    --bpp-text-secondary: #b0b0b0;
    --bpp-accent-color: #bb86fc;
    --bpp-accent-hover: #9b65de;
    --bpp-danger-color: #cf6679;
    --bpp-success-color: #03dac6;
    --bpp-border-color: rgba(255, 255, 255, 0.08);
}

/* --- Root Font Size Normalization (Override MkDocs Material's 125%-150% scaling) --- */
html,
html[data-md-color-scheme] {
    font-size: 16px !important;
}

@media screen and (min-width: 60em) {
    html,
    html[data-md-color-scheme] {
        font-size: 16px !important;
    }
}

@media screen and (min-width: 100em) {
    html,
    html[data-md-color-scheme] {
        font-size: 16px !important;
    }
}

@media screen and (min-width: 125em) {
    html,
    html[data-md-color-scheme] {
        font-size: 16px !important;
    }
}

/* Material for MkDocs Theme Overrides (Dark / Slate Mode) */
[data-md-color-scheme="slate"] {
    --md-hue: 260;
    
    /* Backgrounds */
    --md-default-bg-color: #0f131a;
    --md-default-bg-color--light: #161b24;
    --md-default-bg-color--lighter: #1e2430;
    --md-default-bg-color--lightest: rgba(255, 255, 255, 0.05);
    
    /* Foreground / Text */
    --md-default-fg-color: #e2e8f0;
    --md-default-fg-color--light: #b0b0b0;
    --md-default-fg-color--lighter: #808080;
    --md-default-fg-color--lightest: rgba(255, 255, 255, 0.12);
    
    /* Primary & Accent */
    --md-primary-fg-color: #0f131a;
    --md-primary-bg-color: #ffffff;
    --md-accent-fg-color: #bb86fc;
    --md-accent-fg-color--transparent: rgba(187, 134, 252, 0.1);
    
    /* Typeset colors */
    --md-typeset-color: #e2e8f0;
    --md-typeset-a-color: #bb86fc;
    
    /* Code blocks */
    --md-code-fg-color: #f8f8f2;
    --md-code-bg-color: #161b24;
    --md-code-hl-color: rgba(187, 134, 252, 0.15);
    
    /* Footer */
    --md-footer-bg-color: #0c0f15;
    --md-footer-bg-color--dark: #080a0e;
    
    /* Shadows */
    --md-shadow-z1: 0 4px 14px rgba(0, 0, 0, 0.35);
    --md-shadow-z2: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* --- Base Body & Background --- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 15px !important;
    background-color: var(--bpp-bg-primary) !important;
    background-image: 
        radial-gradient(at 0% 0%, rgba(187, 134, 252, 0.08) 0%, rgba(187, 134, 252, 0) 80%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.06) 0%, rgba(139, 92, 246, 0) 80%) !important;
    background-attachment: fixed !important;
    color: var(--bpp-text-primary);
}

/* Make layout layers transparent to let background gradients shine through */
.md-container,
.md-main,
.md-main__inner {
    background-color: transparent !important;
}

/* --- Top Bar / Header Styling --- */
.md-header {
    background-color: rgba(15, 19, 26, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bpp-border-color) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
    height: 60px;
}

.md-header__inner {
    height: 60px;
    align-items: center;
}

/* Logo styling */
.md-header__button.md-logo {
    margin-right: 0.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.md-header__button.md-logo:hover {
    transform: scale(1.05);
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
    height: 32px;
    width: 32px;
    filter: drop-shadow(0 0 6px rgba(187, 134, 252, 0.4));
}

/* Header Title - Keep single site title permanently and hide page title */
.md-header__title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.2rem !important;
}

.md-header__topic:first-child {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
    transition: none !important;
    pointer-events: auto !important;
}

.md-header__topic:first-child .md-ellipsis {
    color: var(--bpp-accent-color);
    font-weight: 700;
    font-size: 1.2rem !important;
    letter-spacing: -0.5px;
}

.md-header__topic:not(:first-child),
.md-header__topic[data-md-component="header-topic"] {
    display: none !important;
}

/* Search Bar in Header */
.md-search__input {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.85rem !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.md-search__input::placeholder {
    color: var(--bpp-text-secondary) !important;
}

.md-search__input:focus {
    background-color: rgba(255, 255, 255, 0.09) !important;
    border-color: var(--bpp-accent-color) !important;
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.25) !important;
}

.md-search__output {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid var(--bpp-border-color);
    background-color: #161b24 !important;
}

/* --- Layout & Viewport Centering --- */
.md-grid {
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.md-main__inner {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    position: relative !important;
    gap: 2.5rem !important;
    margin-top: 1.2rem !important;
}

/* --- Sidebar Navigation & Table of Contents --- */
@media screen and (min-width: 76.25em) {
    /* Widen sidebar slightly for comfortable breathing room and padding */
    .md-sidebar--primary {
        width: 15.5rem !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        top: 60px !important;
    }
    
    /* Raised Glassmorphic Panel on desktop */
    .md-sidebar--primary .md-sidebar__inner {
        background-color: rgba(20, 25, 34, 0.65) !important;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.07) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.2) !important;
        padding: 0.85rem 0.65rem !important;
        margin-top: 0 !important;
        margin-bottom: 1.5rem !important;
    }

    /* Reset default margin - spacing is managed by flexbox gap */
    [dir=ltr] .md-sidebar--primary:not([hidden]) ~ .md-content > .md-content__inner {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Main content column */
    .md-content {
        flex: 0 1 820px !important;
        max-width: 820px !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .md-content__inner {
        max-width: 820px !important;
        margin: 0 !important;
    }
    
    /* Hide redundant root site title in sidebar */
    .md-sidebar--primary .md-nav--primary > .md-nav__title {
        display: none !important;
    }
}

/* On wide viewports, mirror sidebar width on the right to keep content centered on screen */
@media screen and (min-width: 88em) {
    .md-main__inner::after {
        content: "";
        display: block;
        width: 15.5rem;
        flex-shrink: 0;
    }
}

.md-nav__title {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    color: var(--bpp-text-secondary);
    text-transform: uppercase;
}

.md-nav__link {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem !important; /* 14px */
    color: var(--bpp-text-secondary);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    transition: all 0.15s ease;
    line-height: 1.45;
}

.md-nav__link:hover {
    color: var(--bpp-text-primary) !important;
    background-color: rgba(255, 255, 255, 0.05);
}

.md-nav__item--active > .md-nav__link,
.md-nav__link--active {
    color: var(--bpp-accent-color) !important;
    font-weight: 600;
    background-color: rgba(187, 134, 252, 0.12) !important;
}

/* Integrated Table of Contents / Sub-headings in navigation */
.md-nav--secondary {
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    margin-left: 0.75rem;
    padding-left: 0.4rem;
    margin-top: 0.25rem;
    margin-bottom: 0.35rem;
}

.md-nav--secondary .md-nav__link {
    font-size: 0.82rem !important; /* ~13px */
    color: var(--bpp-text-secondary) !important;
    background-color: transparent !important;
    padding: 0.22rem 0.5rem;
    font-weight: 400 !important;
    opacity: 0.8;
    border-radius: 4px;
}

.md-nav--secondary .md-nav__link:hover,
.md-nav--secondary .md-nav__link--active:hover {
    opacity: 1;
    color: var(--bpp-text-primary) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.md-nav--secondary .md-nav__link--active {
    color: var(--bpp-text-secondary) !important;
    background-color: transparent !important;
    font-weight: 400 !important;
    opacity: 0.8;
}

/* --- Main Content & Typography (Normalized Scale) --- */
.md-content {
    background-color: transparent !important;
}

.md-content__inner {
    margin-top: 1.2rem;
    max-width: 820px;
}

.md-typeset {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 0.9375rem !important; /* 15px */
    line-height: 1.65 !important;
    font-weight: 400 !important;
    color: var(--bpp-text-secondary) !important; /* #b0b0b0 */
}

.md-typeset p,
.md-typeset ul,
.md-typeset ol,
.md-typeset li {
    font-size: 0.9375rem !important; /* 15px */
    line-height: 1.65;
    font-weight: 400;
    color: var(--bpp-text-secondary);
}

.md-typeset strong,
.md-typeset b {
    font-weight: 600;
    color: #ffffff;
}

/* Headings */
.md-typeset h1 {
    font-size: 1.65rem !important; /* ~26px */
    font-weight: 700 !important;
    letter-spacing: -0.4px;
    color: #ffffff !important;
    line-height: 1.3 !important;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.md-typeset h2 {
    font-size: 1.25rem !important; /* 20px */
    font-weight: 600 !important;
    letter-spacing: -0.2px;
    color: #ffffff !important;
    line-height: 1.35 !important;
    border-bottom: 1px solid var(--bpp-border-color);
    padding-bottom: 0.4rem;
    margin-top: 1.8rem;
    margin-bottom: 0.8rem;
}

.md-typeset h3 {
    font-size: 1.05rem !important; /* ~17px */
    font-weight: 600 !important;
    color: #f1f5f9 !important;
    line-height: 1.4 !important;
    margin-top: 1.4rem;
    margin-bottom: 0.5rem;
}

.md-typeset h4, .md-typeset h5, .md-typeset h6 {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #cbd5e1 !important;
}

.md-typeset hr {
    border-bottom: 1px solid var(--bpp-border-color);
    margin: 1.5rem 0;
}

/* Links */
.md-typeset a {
    color: var(--bpp-accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

.md-typeset a:hover {
    color: #d7b7fd;
    text-decoration: underline;
    text-shadow: 0 0 8px rgba(187, 134, 252, 0.3);
}

/* Lists */
.md-typeset ul li, 
.md-typeset ol li {
    margin-bottom: 0.3rem;
}

/* Code & Syntax Highlighting */
.md-typeset code {
    font-family: 'Roboto Mono', monospace !important;
    background-color: #1e2430 !important;
    color: var(--bpp-success-color) !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 0.12em 0.4em;
    font-size: 0.85em !important;
}

.md-typeset pre {
    border: 1px solid var(--bpp-border-color);
    border-radius: 8px;
    background-color: #161b24 !important;
    margin: 1rem 0;
}

.md-typeset pre > code {
    font-family: 'Roboto Mono', monospace !important;
    font-size: 0.85rem !important;
    line-height: 1.5;
    color: #f8f8f2 !important;
    background-color: transparent !important;
    border: none;
    padding: 0;
}

.highlight, .highlighttable {
    background-color: #161b24 !important;
    border: 1px solid var(--bpp-border-color);
    border-radius: 8px;
    overflow: hidden;
}

/* Admonitions (Callouts / Notes / Tips / Warnings) */
.md-typeset .admonition,
.md-typeset details {
    border-radius: 8px;
    border: 1px solid var(--bpp-border-color);
    background-color: rgba(22, 27, 36, 0.75);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    margin: 1.2rem 0;
    font-size: 0.9rem !important;
}

.md-typeset .admonition__title,
.md-typeset summary {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem !important;
    font-weight: 600;
    border-bottom: 1px solid var(--bpp-border-color);
}

.md-typeset .admonition p {
    font-size: 0.875rem !important;
}

.md-typeset .admonition.note,
.md-typeset .admonition.info {
    border-left: 4px solid var(--bpp-accent-color);
}

.md-typeset .admonition.tip,
.md-typeset .admonition.success {
    border-left: 4px solid var(--bpp-success-color);
}

.md-typeset .admonition.warning {
    border-left: 4px solid #ffb74d;
}

.md-typeset .admonition.danger,
.md-typeset .admonition.failure {
    border-left: 4px solid var(--bpp-danger-color);
}

/* Tables */
.md-typeset table:not([class]) {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--bpp-border-color);
    border-radius: 8px;
    overflow: hidden;
    background-color: rgba(22, 27, 36, 0.5);
    width: 100%;
    margin: 1.2rem 0;
    font-size: 0.875rem !important;
}

.md-typeset table:not([class]) th {
    background-color: #1e2430;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 0.9rem;
}

.md-typeset table:not([class]) td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem !important;
}

.md-typeset table:not([class]) tr:last-child td {
    border-bottom: none;
}

.md-typeset table:not([class]) tr:hover td {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Buttons */
.md-button {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem !important;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.5em 1.1em;
    transition: all 0.2s ease;
}

.md-button--primary {
    background-color: var(--bpp-accent-color) !important;
    color: #000000 !important;
    border: none !important;
}

.md-button--primary:hover {
    background-color: var(--bpp-accent-hover) !important;
    box-shadow: 0 0 14px rgba(187, 134, 252, 0.4);
    transform: translateY(-1px);
}

/* Images & Figures */
.md-typeset img {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    height: auto;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 1.2rem !important;
    margin-bottom: 1.2rem !important;
}

.md-typeset p:has(> img) {
    text-align: center;
}

.md-typeset figure {
    margin: 1.5rem auto !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.md-typeset figure img {
    margin-bottom: 0.5rem !important;
}

.md-typeset figcaption {
    font-size: 0.82rem;
    color: var(--bpp-text-secondary);
    font-style: italic;
    text-align: center;
}

/* Footer (Hidden) */
.md-footer {
    display: none !important;
}

/* Custom Scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Documentation Version Badge in Header */
.bpp-docs-version {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--bpp-text-secondary);
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    margin-left: 0.6rem;
    vertical-align: middle;
    letter-spacing: 0.2px;
}

