/*
 * MedNotes index: search bar + thin tab rows + Advanced disclosure.
 * Component prefix `mn-`. Mobile-first. Reuses base.html design tokens.
 */

.mn-index {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.mn-header {
    margin-bottom: 1.25rem;
}

.mn-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary, #d4d4d4);
    margin: 0 0 0.25rem 0;
}

.mn-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted, #858585);
    margin: 0;
}

/* ---------- form / filters ---------- */

.mn-filters {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.mn-search-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mn-search-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #858585);
}

.mn-search-wrap {
    position: relative;
    width: 100%;
}

.mn-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color, #3e3e42);
    background: var(--bg-primary, #1e1e1e);
    color: var(--text-primary, #d4d4d4);
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* ---------- search popdown (typeahead) ---------- */

.mn-search-popdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 50;
}

.mn-popdown {
    list-style: none;
    margin: 0;
    padding: 0.25rem;
    background: var(--bg-secondary, #252526);
    border: 1px solid var(--border-color, #3e3e42);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    max-height: 360px;
    overflow-y: auto;
}

.mn-popdown--empty {
    padding: 0.75rem 0.85rem;
    color: var(--text-muted, #858585);
    font-size: 0.9rem;
}

.mn-popdown__item {
    list-style: none;
}

.mn-popdown__link {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-secondary, #cccccc);
    font-size: 0.95rem;
    transition: background 0.12s, color 0.12s;
}

.mn-popdown__link:hover,
.mn-popdown__link:focus {
    background: rgba(34, 197, 94, 0.18);
    color: var(--text-primary, #d4d4d4);
    outline: none;
}

.mn-popdown__name {
    font-weight: 500;
}

.mn-popdown__sub {
    font-size: 0.75rem;
    color: var(--text-muted, #858585);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.mn-search-input::placeholder {
    color: var(--text-muted, #858585);
}

.mn-search-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18);
}

/* ---------- tab rows (type + pance) ---------- */

/* ---------- shared scroll row (tabs + pills) ----------
 * Used by:
 *   - Note Type row (.mn-tab-row.mn-tab-row-type)
 *   - PANCE row     (.mn-tab-row.mn-tab-row-pance)
 *   - VINDICATE row (.mn-pill-row inside .mn-filter-row)
 *   - Anatomy row   (.mn-pill-row inside .mn-filter-row)
 * Everyone scrolls horizontally on overflow, has a subtle bordered
 * container with shadow so the strip reads as its own filter group
 * (especially important on mobile where strips abut each other).
 */
.mn-tab-row,
.mn-pill-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border-color, #3e3e42);
    border-radius: 8px;
    background: var(--bg-secondary, #252526);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.02) inset;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* ---------- tab pills (note type + pance) ---------- */

.mn-tab-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.mn-tab {
    display: inline-block;
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-color, #3e3e42);
    background: var(--bg-primary, #1e1e1e);
    color: var(--text-secondary, #cccccc);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.mn-tab:hover {
    background: var(--bg-hover, #2a2d2e);
    color: var(--text-primary, #d4d4d4);
}

.mn-tab--small {
    font-size: 0.8rem;
    padding: 0.35rem 0.7rem;
}

.mn-tab-input:checked + .mn-tab {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.18);
    font-weight: 600;
}

/* ---------- inline filter rows (VINDICATE + Anatomy) ---------- */

.mn-filter-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mn-filter-row__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #858585);
    padding-left: 0.1rem;
}

.mn-pill-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.mn-pill {
    display: inline-block;
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-color, #3e3e42);
    background: var(--bg-primary, #1e1e1e);
    color: var(--text-secondary, #cccccc);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.mn-pill:hover {
    color: var(--text-primary, #d4d4d4);
    border-color: var(--text-muted, #858585);
}

.mn-pill-input:checked + .mn-pill {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.18);
    font-weight: 600;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
}

/* ---------- results ---------- */

.mn-notes-list {
    min-height: 200px;
}

.mn-category {
    margin-bottom: 1.5rem;
}

.mn-category__header {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary, #d4d4d4);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color, #3e3e42);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.mn-category__count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted, #858585);
}

.mn-notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mn-note-card {
    display: block;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-color, #3e3e42);
    background: var(--bg-secondary, #252526);
    color: var(--text-secondary, #cccccc);
    text-decoration: none;
    font-size: 0.92rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 2.5rem;
    box-sizing: border-box;
}

.mn-note-card:hover {
    background: var(--bg-hover, #2a2d2e);
    border-color: #22c55e;
    color: var(--text-primary, #d4d4d4);
}

.mn-note-card__name {
    display: block;
    font-weight: 500;
}

.mn-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted, #858585);
    font-size: 0.95rem;
}

.mn-empty__hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* ---------- "Oops, not written yet" box on the disease viewer ---------- */

.mn-oops {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-color, #3e3e42);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.08);
}

.mn-oops h2 {
    margin: 0 0 0.5rem 0;
    color: #f59e0b;
    font-size: 1.1rem;
}

.mn-oops p {
    margin: 0;
    color: var(--text-secondary, #cccccc);
    line-height: 1.5;
}

/* ---------- responsive ---------- */

@media (min-width: 480px) {
    .mn-notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 769px) {
    .mn-index {
        padding: 1.5rem 2rem;
    }
    .mn-title {
        font-size: 1.85rem;
    }
    .mn-notes-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.85rem;
    }
    .mn-search-row {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }
    .mn-search-label {
        min-width: 4rem;
    }
}

@media (min-width: 1100px) {
    .mn-notes-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---------- legacy class shims so any orphan template paths still render ---------- */

.mednotes-index { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.mednotes-index-title { font-size: 1.6rem; font-weight: 600; color: var(--text-primary, #d4d4d4); margin: 0 0 0.25rem 0; }
.mednotes-notes-list { min-height: 200px; }
.mednotes-empty-state { padding: 2rem; text-align: center; color: var(--text-muted, #858585); }
