
/**
 * catalog.css — КАТАЛОГ (СПИСОК + КАРТОЧКИ)
 *
 * Содержит:
 * - list-pane (левая панель каталога)
 * - заголовок + счётчик
 * - поиск
 * - filter chips
 * - scroll область
 * - строки списка (.row)
 * - group labels
 * - school dot
 *
 * ⚠️ НЕ содержит:
 * - detail / entity (правая панель)
 * - layout (app-container, sidebar)
 */

/* ==========================================================================
   LIST PANE
   ========================================================================== */
.list-pane,
.list-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 360px;
    flex-shrink: 0;
    border-right: 1px solid var(--bd-border);
    background: var(--bg-sidebar);
}

/* ==========================================================================
   LIST HEAD
   ========================================================================== */
.list-head {
    padding: 22px 20px 14px;
    border-bottom: 1px solid var(--line-soft);
    flex-shrink: 0;
}

.list-title-row {
    margin:  0 auto 14px auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.list-title-row img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.list-title {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-main);
}

.list-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    background: var(--bg-sunken);
    border: 1px solid var(--bd-border);
    border-radius: var(--radius-md);
    padding: 2px 10px;
}

/* ==========================================================================
   SEARCH
   ========================================================================== */
.search-row {
    margin: auto;
    display: flex;
    gap: 8px;
}

.search {
    flex: 1;
    display: flex;
    max-width: 400px;
    align-items: center;
    gap: 8px;
    background: var(--bg-sunken);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 8px 10px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.search:focus-within {
    background: var(--bg-sidebar);
    border-color: var(--bd-border);
}

.search input {
    border: 0;
    outline: none;
    background: transparent;
    flex: 1;
}

.search input::placeholder {
    color: var(--text-muted);
}

.kbd {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    border: 1px solid var(--bd-border);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    background: var(--bg-sidebar);
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-sunken);
    border-radius: var(--radius-md);
    color: var(--text-soft);
    font-size: 13px;
    transition: background var(--transition-fast);
}

.filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* ==========================================================================
   FILTER CHIPS
   ========================================================================== */
.chips-row {
    display: flex;
    gap: 6px;
    padding: 10px 20px 12px;
    border-bottom: 1px solid var(--line-soft);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.chips-row::-webkit-scrollbar { display: none; }

.chip,
.filter-chip {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-sunken);
    color: var(--text-soft);
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
    cursor: pointer;
    border: none;
}

.chip:hover,
.filter-chip:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.chip.active,
.filter-chip.active {
    background: var(--text-main);
    color: var(--bg-sidebar);
}

.filter-chip.unavailable {
    opacity: 0.35;
    pointer-events: none;
}

/* ==========================================================================
   LIST SCROLL AREA
   ========================================================================== */
.list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px 20px;
}

.list-group-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
    padding: 14px 12px 6px;
}

/* ==========================================================================
   LIST ROW
   ========================================================================== */
.row {
    display: grid;
    width: 100%;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.row:hover { background: var(--bg-hover); }
.row.selected { background: var(--bg-active); }
.row.selected .row-name { color: var(--accent); }

.row-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-sub {
    font-size: 11.5px;
    justify-content: space-between;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.row-sub > span:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.row-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.spell-lvl {
    height: 24px;
    padding: 4px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-soft);
    background-color: var(--bg-sunken);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   SCHOOL DOT
   ========================================================================== */
.school-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    flex-shrink: 0;
}

/* ==========================================================================
   MODE SWITCHING
   ========================================================================== */

/* По умолчанию */
#app-sidebar  { display: none; }
#detail-pane  { display: none; }

/* Catalog mode */
body.is-catalog-mode #catalog-pane  { display: flex; }
body.is-catalog-mode #app-sidebar   { display: none; }
body.is-catalog-mode #detail-pane   { display: none; }

/* Split mode */
body.is-split-mode #catalog-pane    { display: none; }
body.is-split-mode #app-sidebar     { display: flex; }
body.is-split-mode #detail-pane     { display: flex; flex: 1; }

/* Detail pane base */
#detail-pane {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-body);
}

/* Catalog pane base */
#catalog-pane {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}


/* ==========================================================================
   FILTER MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 680px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--bd-border);
    flex-shrink: 0;
}

.modal-header h2 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    color: var(--text-main);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 16px;
    transition: background var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.filter-section h3 {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--bd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-footer-note {
    font-size: 12px;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.filter-reset-btn {
    padding: 7px 14px;
    border: 1px solid var(--bd-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-soft);
    background: transparent;
    transition: all var(--transition-fast);
}

.filter-reset-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.filter-submit-btn {
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--text-main);
    color: var(--bg-sidebar);
    border: 1px solid var(--text-main);
    transition: all var(--transition-fast);
}

.filter-submit-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* ==========================================================================
   CATALOG GRID
   ========================================================================== */
#catalog-pane {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#catalog-pane .list-head {
    flex-shrink: 0;
}

.content-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    min-height: 0;
    animation: content-fade-up 0.3s ease-out forwards;
}

@keyframes content-fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.catalog-group { margin-bottom: 32px; }

.catalog-group-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.catalog-group-divider__line {
    flex: 1;
    height: 1px;
    background: var(--bd-border);
}

.catalog-group-cr {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-main);
    white-space: nowrap;
}

.bestiary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

/* ==========================================================================
   NOTION CARD
   ========================================================================== */
.notion-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--bd-border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-main);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
    cursor: pointer;
    min-height: 120px;
}

.notion-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-soft);
}

.notion-card.active {
    background: var(--bg-active);
    border-color: var(--accent);
}
.row.active {
    background: var(--bg-active);
    border-color: var(--accent);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.3;
}

.card-cr {
    width: fit-content;
    text-transform: uppercase;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 2px 6px;
    background: var(--bg-sunken);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.card-meta {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 9px;
    border-top: 1px dashed var(--bd-border);
    margin-top: auto;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.stat-badge-source {
    color: var(--text-soft);
}

/* ==========================================================================
   CATALOG LOADING / EMPTY
   ========================================================================== */
.catalog-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 24px;
    color: var(--text-muted);
    font-size: 14px;
    gap: 12px;
}

.catalog-empty {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.rarity-none      { color: var(--r-common);    background: color-mix(in srgb, var(--r-common) 12%, transparent); }
.rarity-uncommon  { color: var(--r-uncommon);  background: color-mix(in srgb, var(--r-uncommon) 12%, transparent); }
.rarity-rare      { color: var(--r-rare);      background: color-mix(in srgb, var(--r-rare) 12%, transparent); }
.rarity-very-rare { color: var(--r-veryrare);  background: color-mix(in srgb, var(--r-veryrare) 12%, transparent); }
.rarity-legendary { color: var(--r-legendary); background: color-mix(in srgb, var(--r-legendary) 12%, transparent); }
.rarity-artifact  { color: var(--r-artifact);  background: color-mix(in srgb, var(--r-artifact) 12%, transparent); }



.post-type-archive-dnd_item .stat-value,
.single-dnd_item .stat-value {
    font-family: var(--font-geist);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
}

.spell-conc-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--accent);
    vertical-align: middle;
    letter-spacing: 0.04em;
}

/* ==========================================================================
   ACTIVE FILTERS BAR
   ========================================================================== */
.active-filters-bar {
    padding: 8px 20px 10px;
    border-bottom: 1px solid var(--line-soft);
    min-height: 38px;
    display: flex;
    align-items: center;
}

.archive.is-catalog-mode .active-filters-bar {
    border-bottom: 0px;
}

.active-filter-all {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-md);
    background: var(--text-main);
    color: var(--bg-sidebar);
}

.active-filters-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    width: 100%;
}

.active-filters-wrap::-webkit-scrollbar { display: none; }

.active-filters-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 3px 8px 3px 10px;
    border-radius: var(--radius-md);
    background: var(--accent-bg);
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.active-filter-remove {
    font-size: 14px;
    line-height: 1;
    color: var(--accent);
    opacity: 0.7;
    padding: 0;
    transition: opacity var(--transition-fast);
}

.active-filter-remove:hover { opacity: 1; }


/* ============ MOBILE ADAPTATION ============ */
@media (max-width: 768px) {
  body.is-split-mode #app-sidebar, .archive.is-catalog-mode .active-filters-bar {
    display: none;
  }

}