/* ============================================================
   RÉPERTOIRE / SEARCH PAGE (repertoire.php)
   ============================================================ */

@import url("./variables.css");

.search-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- 6-column index layout ---- */
.repertoire-index {
    display: grid;
    grid-template-columns: 0.7fr 1.2fr 1.4fr 0.9fr 1.4fr 1fr;
    gap: 0;
    padding: 0 var(--space-m);
    height: 100%;
}

@media (max-width: 1024px) {
    .repertoire-index {
        grid-template-columns: 1fr 1fr 1fr;
        padding: 0 var(--space-s);
        min-height: auto;
    }

    .repertoire-col {
        border-bottom: 1px solid var(--border-primary);
    }

    .repertoire-col:nth-child(3n) {
        border-right: none;
    }
}

@media (max-width: 600px) {
    .repertoire-index {
        grid-template-columns: 1fr;
        padding: 0 var(--space-s);
        min-height: auto;
    }

    .repertoire-col {
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
        padding: var(--space-s) 0 var(--space-m);
    }

    .repertoire-col:last-child {
        border-bottom: none;
    }
}

.repertoire-col {
    padding: var(--space-xs) var(--space-2xs) var(--space-l);
    overflow-y: auto;
    overflow-x: hidden;
}

.repertoire-col:last-child {
    border-right: none;
}

.repertoire-index section > h2 {
    font-family: var(--font-display);
    font-size: var(--step--2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 400;
    margin: 0 0 var(--space-2xs) 0;
    padding-bottom: var(--space-3xs);
    border-bottom: 1px solid var(--border-secondary);
}

/* Strip list chrome inside repertoire columns */
.repertoire-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---- rep-entry: shared base (button + link variants) ---- */
.rep-entry {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: var(--space-3xs) 0;
    margin: 0;
    font-family: inherit;
    font-size: var(--step-0);
    color: var(--text-primary);
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition:
        color 0.15s,
        opacity 0.15s;
}

.rep-entry:hover {
    color: var(--accent-primary);
}

/* Link variant (students col) — no underline by default */
.rep-entry--link {
    text-decoration: none;
}

/* Selected: accent color */
.rep-entry--selected {
    color: var(--accent-primary) !important;
}

/* Faded/disabled: muted, not interactive */
.rep-entry--faded {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Years column — big bold numbers */
.repertoire-col[data-col="years"] .rep-entry {
    font-size: var(--step-3);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    padding: var(--space-3xs) 0;
}

/* Empty state in students column */
.rep-empty {
    color: var(--text-tertiary);
    font-size: var(--step--1);
    padding: var(--space-3xs) 0;
}

/* ---- HTMX loading indicator ---- */
.rep-indicator {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    pointer-events: none;
}

.rep-indicator.htmx-request {
    opacity: 1;
    animation: rep-progress 1.2s ease-in-out infinite;
}

@keyframes rep-progress {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }
    50% {
        transform: scaleX(0.7);
        transform-origin: left;
    }
    100% {
        transform: scaleX(1);
        transform-origin: left;
    }
}

/* ---- Search results view (grid) ---- */
.search-results-header {
    display: block;
    font-size: var(--step--1);
    color: var(--text-secondary);
    margin: var(--space-s) var(--space-m) var(--space-2xs);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-m);
    list-style: none;
    margin: 0;
    padding: var(--space-2xs) var(--space-m) var(--space-m);
}

.result-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: var(--space-3xs);
}

.result-card__authors {
    font-size: var(--step--1);
    font-weight: 500;
    color: var(--text-primary);
}

.result-card__title {
    font-size: var(--step--1);
    color: var(--text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-card__meta {
    font-size: var(--step--2);
    color: var(--accent-primary);
    font-style: normal;
}

/* Search controls bar */
.search-controls {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    padding: var(--space-3xs) var(--space-m);
    border-bottom: 1px solid var(--border-secondary);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.search-filter-label {
    display: flex;
    align-items: center;
    gap: var(--space-3xs);
    font-size: var(--step--2);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    cursor: default;
}

.search-filter-select {
    font-size: var(--step--1);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: var(--space-3xs) var(--space-2xs);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
}

.search-filter-select:focus {
    border-color: var(--accent-primary);
}

.search-apply-btn {
    font-size: var(--step--1);
    padding: var(--space-3xs) var(--space-xs);
    background: var(--accent-primary);
    color: var(--accent-foreground);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.search-apply-btn:hover {
    background: var(--accent-secondary);
}

.search-reset-link {
    font-size: var(--step--1);
    color: var(--text-secondary);
    text-decoration: underline;
    cursor: pointer;
}

/* Search results pagination */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2xs);
    padding: var(--space-m) 0;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0 var(--space-2xs);
    border: 1px solid var(--border-secondary);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: var(--step--1);
    text-decoration: none;
    transition: all 0.15s;
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-info {
    font-size: var(--step--1);
    color: var(--text-secondary);
    padding: 0 var(--space-2xs);
}

.search-empty {
    padding: var(--space-xl) var(--space-m);
    color: var(--text-secondary);
    font-size: var(--step-0);
    text-align: center;
}

/* Error message */
.search-error {
    background: var(--search-error-bg);
    border-left: 3px solid var(--search-error-border);
    color: var(--search-error-color);
    padding: var(--space-2xs) var(--space-s);
    font-size: var(--step--1);
    margin: var(--space-2xs) var(--space-m);
    flex-shrink: 0;
}
