/* Compendium page styles */
/* Header styles are in style.css - do not duplicate here */

/* Compendium main */
.compendium-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    padding-bottom: 3.5rem; /* clear fixed footer */
}

/* ================================
   Subheader bar
   ================================ */
.compendium-subheader {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1.25rem;
    background: var(--ink);
    color: var(--parchment);
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.compendium-stats {
    font-size: 0.95rem;
    color: var(--gold);
    text-align: center;
}

.compendium-stats .stat-label {
    color: var(--parchment);
}

.compendium-stats .stat-dot {
    color: #96928a;
    padding: 0 0.35rem;
}

.mobile-separator {
    width: 100%;
    border: none;
    border-top: 1px solid var(--ink-light);
    margin: 0.15rem 0;
}

/* ================================
   Controls – two-row flexbox
   The outer .compendium-controls is a column that holds
   .controls-row items; each row is a flex row that wraps
   naturally on small screens.
   ================================ */
.compendium-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

/* Each controls-row is a horizontal flex that wraps when needed */
.controls-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

/* ---- Row 1: Dropdowns + checkbox ---- */
.filter-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.filter-label select {
    font-family: inherit;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--gold);
    background: var(--parchment);
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox-filter {
    cursor: pointer;
    user-select: none;
}

.checkbox-filter input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold);
    cursor: pointer;
}

.checkbox-filter .checkbox-label {
    color: var(--parchment);
    font-size: 0.85rem;
}

/* ---- Row 2: Search fields side-by-side ---- */
.search-field {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1 1 180px;   /* grow equally, wrap below 180px */
    min-width: 0;
}

.search-field-icon {
    position: absolute;
    left: 8px;
    color: var(--ink-light);
    pointer-events: none;
    z-index: 1;
}

.search-field input {
    font-family: inherit;
    padding: 0.3rem 0.5rem 0.3rem 2rem;
    border: 1px solid var(--parchment);
    background: var(--parchment);
    font-size: 0.85rem;
    width: 100%;          /* fill available flex space */
    min-width: 0;
}

.search-field input:focus {
    outline: none;
    border-color: var(--gold);
}

/* ================================
   Search autocomplete dropdown
   ================================ */
.search-field-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--parchment);
    border: 1px solid var(--gold);
    border-top: none;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-field-results.visible {
    display: block;
}

/* Shared result-item styling */
.search-result-item,
.master-result-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid var(--parchment-dark);
    transition: background 0.1s ease;
}

.search-result-item:hover,
.master-result-item:hover {
    background: var(--parchment-dark);
}

.search-result-item:last-child,
.master-result-item:last-child {
    border-bottom: none;
}

/* Actor results */
.search-result-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--gold);
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.search-result-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-handle {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--ink-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Master results */
.master-result-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--gold);
    flex-shrink: 0;
}

.master-result-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ink-light);
    border: 1px solid var(--gold);
    flex-shrink: 0;
}

.master-result-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.master-result-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.master-result-handle {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--ink-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================
   Cards
   ================================ */
.compendium-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.compendium-cards .actor-card {
    width: 320px;
}

.no-results {
    width: 100%;
    text-align: center;
    padding: 2rem;
    color: var(--ink-light);
    font-style: italic;
}

/* ================================
   Responsive
   
   The flex-wrap on .controls-row handles the
   natural break from side-by-side → stacked.
   These breakpoints just tighten spacing and
   adjust the subheader layout.
   ================================ */
@media (max-width: 768px) {
    .compendium-main {
        padding: 1rem;
    }

    .compendium-subheader {
        padding: 0.6rem 0.75rem;
        gap: 0.4rem;
    }

    .compendium-stats {
        font-size: 0.85rem;
    }

    /* Center the filter dropdowns row */
    .controls-row:first-child {
        justify-content: center;
    }

    /* Cards */
    .compendium-cards {
        gap: 0.75rem;
    }

    .compendium-cards .actor-card {
        width: calc(50% - 0.5rem);
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .compendium-main {
        padding: 0.75rem;
    }

    .compendium-subheader {
        padding: 0.5rem;
        gap: 0.35rem;
    }

    .compendium-stats {
        font-size: 0.75rem;
    }

    .filter-label {
        font-size: 0.8rem;
    }

    .search-field input {
        font-size: 0.8rem;
        padding: 0.25rem 0.4rem 0.25rem 1.75rem;
    }

    .compendium-cards {
        gap: 0.5rem;
    }

    .compendium-cards .actor-card {
        width: calc(50% - 0.25rem);
        max-width: 160px;
    }
}
