/* Copyright (c) 2025 Erick Bourgeois, firestoned
 * SPDX-License-Identifier: MIT
 */

/**
 * bindcar Documentation - Custom Styles for MkDocs Material
 *
 * This file contains custom styles adapted from the mdBook theme to
 * maintain visual consistency during the migration to MkDocs Material.
 */

/* ============================================
   Custom Color Overrides
   ============================================ */

:root {
    /* Light mode colors - blue theme */
    --md-primary-fg-color: #2196F3;
    --md-primary-fg-color--light: #42A5F5;
    --md-primary-fg-color--dark: #1976D2;
    --md-accent-fg-color: #3F51B5;
    --md-accent-fg-color--transparent: rgba(63, 81, 181, 0.1);
}

[data-md-color-scheme="slate"] {
    /* Dark mode colors */
    --md-primary-fg-color: #42A5F5;
    --md-primary-fg-color--light: #64B5F6;
    --md-primary-fg-color--dark: #2196F3;
    --md-accent-fg-color: #5C6BC0;
    --md-accent-fg-color--transparent: rgba(92, 107, 192, 0.1);
}

/* ============================================
   Right-side Page TOC (Table of Contents)
   ============================================ */

.md-sidebar--secondary .md-sidebar__scrollwrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar {
    width: 6px;
}

.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar-track {
    background: transparent;
}

.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.md-sidebar--secondary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* TOC link styling */
.md-nav--secondary .md-nav__link {
    transition: all 0.15s ease;
}

.md-nav--secondary .md-nav__link:hover {
    color: var(--md-accent-fg-color);
}

.md-nav--secondary .md-nav__link.md-nav__link--active {
    font-weight: 500;
    color: var(--md-accent-fg-color);
}

/* ============================================
   Mermaid Diagram Enhancements
   ============================================ */

.mermaid {
    text-align: center;
    margin: 1.5rem 0;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
}

pre.mermaid {
    overflow-x: auto;
    padding: 1rem;
    border-radius: 0.2rem;
    background-color: var(--md-code-bg-color);
}

[data-md-color-scheme="slate"] .mermaid {
    filter: invert(0.9) hue-rotate(180deg);
}

/* ============================================
   Code Block Enhancements
   ============================================ */

.highlight pre {
    padding: 1rem;
    overflow-x: auto;
    line-height: 1.5;
}

.md-clipboard {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* ============================================
   Admonition Customization
   ============================================ */

.admonition {
    margin: 1.5rem 0;
}

/* ============================================
   Table Styling
   ============================================ */

.md-typeset table:not([class]) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.md-typeset table:not([class]) th {
    font-weight: 600;
    border-bottom: 2px solid var(--md-default-fg-color--lighter);
}

/* ============================================
   Navigation Enhancements
   ============================================ */

.md-tabs {
    background-color: var(--md-primary-fg-color);
}

.md-tabs__link {
    transition: background-color 0.2s ease;
}

.md-tabs__link:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* ============================================
   Mobile Responsiveness
   ============================================ */

@media screen and (max-width: 76.1875em) {
    .md-sidebar--secondary {
        display: none;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .md-header,
    .md-tabs,
    .md-sidebar,
    .md-footer {
        display: none !important;
    }

    .md-content {
        max-width: 100% !important;
    }

    .highlight pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }
}

/* ============================================
   Custom Improvements
   ============================================ */

html {
    scroll-behavior: smooth;
}

.md-content a:hover {
    text-decoration: underline;
}

a:focus,
button:focus {
    outline: 2px solid var(--md-accent-fg-color);
    outline-offset: 2px;
}

.headerlink {
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-left: 0.5rem;
}

h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink,
h5:hover .headerlink,
h6:hover .headerlink {
    opacity: 1;
}
