/* 5 AM Study - Warm Dark Theme */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */

:root {
    /* Core palette */
    --5am-bg: #1a1a1a;
    --5am-bg-surface: #252525;
    --5am-border: #333333;

    /* Text colors */
    --5am-text: #e8e6e3;
    --5am-text-muted: #a0a0a0;
    --5am-text-faint: #666666;

    /* Accent */
    --5am-accent: #ff5722;
    --5am-accent-hover: #ff7043;
    --5am-accent-muted: #ff8a65;

    /* Semantic colors */
    --5am-warning: #ffa726;

    /* Shared values */
    --5am-border-radius: 4px;
    --5am-border-radius-lg: 6px;
    --5am-transition: 0.2s ease;
}

/* ============================================
   MATERIAL THEME OVERRIDES
   ============================================ */

[data-md-color-scheme="slate"] {
    /* Primary/accent */
    --md-primary-fg-color: var(--5am-accent);
    --md-primary-fg-color--light: var(--5am-accent-hover);
    --md-primary-fg-color--dark: var(--5am-accent);
    --md-primary-bg-color: var(--5am-bg);
    --md-accent-fg-color: var(--5am-accent);
    --md-accent-fg-color--transparent: rgba(255, 87, 34, 0.1);
    --md-accent-bg-color: var(--5am-bg);

    /* Backgrounds & text */
    --md-default-bg-color: var(--5am-bg);
    --md-default-fg-color: var(--5am-text);
    --md-default-fg-color--light: var(--5am-text-muted);
    --md-default-fg-color--lighter: var(--5am-text-muted);
    --md-default-fg-color--lightest: var(--5am-text-faint);

    /* Code */
    --md-code-bg-color: var(--5am-bg-surface);
    --md-code-fg-color: var(--5am-text);

    /* Typography */
    --md-typeset-color: var(--5am-text);
    --md-typeset-a-color: var(--5am-accent);

    /* Header & footer */
    --md-header-bg-color: var(--5am-bg);
    --md-header-fg-color: var(--5am-text);
    --md-footer-bg-color: var(--5am-bg);
    --md-footer-bg-color--dark: var(--5am-bg);
    --md-footer-fg-color: var(--5am-text-muted);
    --md-footer-fg-color--light: var(--5am-text-faint);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

.md-typeset {
    font-size: 0.85rem;
    line-height: 1.7;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
    color: var(--5am-text);
    font-weight: 600;
}

.md-typeset h1 {
    margin-bottom: 1.5rem;
}

.md-typeset p {
    margin-bottom: 1.25rem;
}

.md-typeset hr {
    border-color: var(--5am-border);
    margin: 2rem 0;
}

/* ============================================
   LINKS
   ============================================ */

a {
    color: var(--5am-accent);
    text-decoration: none;
    transition: color var(--5am-transition);
}

a:hover {
    color: var(--5am-accent-hover);
}

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

/* ============================================
   HEADER & NAVIGATION TABS
   ============================================ */

.md-header {
    background-color: var(--5am-bg);
    border-bottom: 1px solid var(--5am-border);
}

.md-header__button,
.md-header__title,
.md-header__topic,
.md-header .md-icon {
    color: var(--5am-text);
}

.md-tabs {
    background-color: var(--5am-bg);
    border-bottom: 1px solid var(--5am-border);
}

.md-tabs__link {
    color: var(--5am-text-muted);
    opacity: 1;
    transition: color var(--5am-transition);
}

.md-tabs__link:hover {
    color: var(--5am-text);
}

.md-tabs__item--active > .md-tabs__link {
    color: var(--5am-accent);
}

.md-tabs__item--active > .md-tabs__link:hover {
    color: var(--5am-accent-hover);
}

/* ============================================
   MOBILE DRAWER (HAMBURGER MENU)
   ============================================ */

/* Make all drawer title bars use the orange accent consistently */
/* Breakpoint 76.234375em = Material's default mobile/tablet threshold */
@media screen and (max-width: 76.234375em) {
    .md-nav--primary .md-nav__title {
        background-color: var(--5am-accent);
        color: var(--5am-bg);
    }
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

/* Hide left sidebar content but keep the space for centered layout.
   Using visibility:hidden (not display:none) preserves the layout grid. */
@media screen and (min-width: 76.25em) {
    .md-sidebar--primary .md-sidebar__scrollwrap {
        visibility: hidden;
    }
}

.md-nav__link {
    color: var(--5am-text-muted);
    transition: color var(--5am-transition);
}

.md-nav__link:hover {
    color: var(--5am-text);
}

.md-nav__item--nested > .md-nav__link {
    color: var(--5am-text);
}

/* ============================================
   CODE
   ============================================ */

.md-typeset code {
    background-color: var(--5am-bg-surface);
    color: var(--5am-accent-muted);
    padding: 0.15em 0.4em;
    border-radius: var(--5am-border-radius);
    font-size: 0.9em;
}

.md-typeset pre {
    background-color: var(--5am-bg-surface);
    border-radius: var(--5am-border-radius-lg);
    border: 1px solid var(--5am-border);
}

.md-typeset pre code {
    color: var(--5am-text);
    padding: 0;
    background: transparent;
}

.md-clipboard {
    color: var(--5am-text-muted);
}

.md-clipboard:hover {
    color: var(--5am-accent);
}

/* ============================================
   ADMONITIONS
   ============================================ */

.md-typeset .admonition {
    background-color: var(--5am-bg-surface);
    border: 1px solid var(--5am-border);
    border-left: 4px solid var(--5am-accent);
    border-radius: var(--5am-border-radius);
    box-shadow: none;
}

.md-typeset .admonition-title {
    background-color: transparent;
    border-bottom: 1px solid var(--5am-border);
    padding: 0.6rem 1rem;
}

.md-typeset .admonition-title::before {
    color: var(--5am-accent);
}

.md-typeset .admonition.warning {
    border-left-color: var(--5am-warning);
}

.md-typeset .admonition.example {
    border-left-color: var(--5am-text-muted);
}

/* ============================================
   BUTTONS
   ============================================ */

.md-button {
    background-color: transparent;
    color: var(--5am-text);
    border: 2px solid var(--5am-accent);
    border-radius: var(--5am-border-radius);
    padding: 0.6em 1.2em;
    font-weight: 500;
    transition: all var(--5am-transition);
}

.md-button:hover {
    background-color: var(--5am-accent);
    color: var(--5am-bg);
    border-color: var(--5am-accent);
}

.md-button--primary {
    background-color: var(--5am-accent);
    color: var(--5am-bg);
    border-color: var(--5am-accent);
}

.md-button--primary:hover {
    background-color: var(--5am-text);
    border-color: var(--5am-text);
    color: var(--5am-accent);
}

/* ============================================
   SEARCH
   ============================================ */

.md-search__input {
    background-color: var(--5am-bg-surface);
    color: var(--5am-text);
    border-radius: var(--5am-border-radius);
}

.md-search__input::placeholder {
    color: var(--5am-text-faint);
}

.md-search__icon {
    color: var(--5am-text-muted);
}

/* ============================================
   FOOTER
   ============================================ */

.md-footer {
    background-color: var(--5am-bg);
    border-top: 1px solid var(--5am-border);
}

.md-footer a {
    color: var(--5am-text-muted);
}

.md-footer a:hover {
    color: var(--5am-accent);
}

/* ============================================
   TABLES
   ============================================ */

.md-typeset table:not([class]) {
    border: 1px solid var(--5am-border);
    border-radius: var(--5am-border-radius);
    overflow: hidden;
}

.md-typeset table:not([class]) th {
    background-color: var(--5am-bg-surface);
    color: var(--5am-text);
    font-weight: 600;
}

.md-typeset table:not([class]) td {
    border-top: 1px solid var(--5am-border);
}

/* ============================================
   LAYOUT
   ============================================ */

.md-content__inner {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

/* ============================================
   SCROLLBAR
   ============================================ */

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

::-webkit-scrollbar-track {
    background: var(--5am-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--5am-border);
    border-radius: var(--5am-border-radius);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--5am-text-faint);
}

/* ============================================
   DISCORD BUTTON (RIGHT SIDEBAR)
   ============================================ */

.discord-button-container {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0 0.6rem;
}

.discord-button-link {
    display: block;
}

.discord-button-image {
    width: 100%;
    max-width: 240px;
    border-radius: calc(var(--5am-border-radius) * 2);
    transition:
        opacity var(--5am-transition),
        transform var(--5am-transition);
}

.discord-button-image:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

/* ============================================
   TASK LISTS (CHECKBOXES) - Obsidian Style
   ============================================ */

.md-typeset .task-list-item {
    list-style-type: none;
    margin-left: -0.5em;
}

.md-typeset .task-list-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1em;
    height: 1em;
    border: 1.5px solid var(--5am-text-muted);
    border-radius: 3px;
    background-color: transparent;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 0.4em;
    margin-top: -0.1em;
    position: relative;
    transition: all 0.15s ease;
}

.md-typeset .task-list-item input[type="checkbox"]:hover {
    border-color: var(--5am-accent);
}

.md-typeset .task-list-item input[type="checkbox"]:checked {
    background-color: var(--5am-accent);
    border-color: var(--5am-accent);
}

.md-typeset .task-list-item input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 2.5px;
    top: 0.5px;
    width: 4px;
    height: 8px;
    border: solid var(--5am-bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Strikethrough completed items - Obsidian style */
.md-typeset .task-list-item:has(input[type="checkbox"]:checked) {
    color: var(--5am-text-faint);
    text-decoration: line-through;
}

/* ============================================
   PROGRESS TRACK
   ============================================ */

.progress-track {
    font-family: var(--md-code-font-family);
    padding: 2.5rem 0 1.5rem 0;
    overflow: visible;
}

.progress-status {
    text-align: center;
    color: var(--5am-text);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.progress-status .progress-count {
    color: var(--5am-accent);
    font-weight: 700;
    font-size: 1.3rem;
}

.progress-bar-container {
    position: relative;
    height: 8px;
    background-color: var(--5am-bg-surface);
    border-radius: 4px;
    border: 1px solid var(--5am-border);
    margin: 0 auto;
    max-width: 100%;
    overflow: visible;
}

.progress-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--5am-accent),
        var(--5am-accent-hover)
    );
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

.progress-checkpoint {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: var(--5am-bg);
    border: 2px solid var(--5am-text-muted);
    border-radius: 50%;
    z-index: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-checkpoint:hover {
    transform: translate(-50%, -50%) scale(1.3);
    border-color: var(--5am-accent);
    box-shadow: 0 0 8px rgba(255, 87, 34, 0.4);
}

.progress-checkpoint::after {
    content: attr(data-label);
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--5am-text);
    background-color: var(--5am-bg-surface);
    padding: 0.2rem 0.5rem;
    border-radius: var(--5am-border-radius);
    border: 1px solid var(--5am-border);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.progress-checkpoint:hover::after {
    opacity: 1;
}

/* Passed checkpoints */
.progress-checkpoint.passed {
    background-color: var(--5am-accent);
    border-color: var(--5am-accent);
}

.progress-checkpoint.passed::before {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    color: var(--5am-bg);
    font-weight: bold;
}

.progress-labels {
    position: relative;
    height: 1.5rem;
    margin-top: 0.5rem;
}

.progress-labels span {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--5am-text-muted);
}
