/* ============================================================================
   teaching-library.css — the instructor-facing resource browser.
   Pairs with teaching-library.html and shared/js/library_filter.js.
   ========================================================================== */

.tl-page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

.tl-hero {
    background: linear-gradient(135deg, #1a5fb4 0%, #2a7de1 100%);
    color: #fff;
    border-radius: 14px;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.tl-hero h1 {
    margin: 0 0 8px;
    font-size: 1.9rem;
    line-height: 1.2;
}

.tl-hero p {
    margin: 0;
    max-width: 68ch;
    font-size: 1rem;
    line-height: 1.55;
    opacity: 0.94;
}

.tl-hero-stats {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    font-size: 0.9rem;
    opacity: 0.95;
}

/* --------------------------------------------------------------- Show Me */

.tl-lenses {
    margin-bottom: 24px;
}

.tl-lenses h2 {
    font-size: 1.05rem;
    margin: 0 0 10px;
    color: var(--app-text);
}

.tl-lens-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tl-lens {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--app-text);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.tl-lens:hover {
    border-color: var(--app-accent);
    box-shadow: 0 2px 8px rgba(42, 125, 225, 0.16);
}

.tl-lens[aria-pressed="true"] {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.tl-lens-icon {
    font-size: 1.05rem;
}

/* ---------------------------------------------------------------- layout */

.tl-body {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .tl-body {
        grid-template-columns: 1fr;
    }
}

.tl-rail {
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 16px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.tl-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tl-rail-head h2 {
    font-size: 1rem;
    margin: 0;
}

.tl-facet {
    border-top: 1px solid var(--app-border);
    padding: 12px 0 4px;
}

.tl-facet:first-of-type {
    border-top: none;
}

.tl-facet > h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    margin: 0 0 8px;
}

.tl-facet-hint {
    font-size: 0.76rem;
    color: var(--app-muted);
    margin: -4px 0 8px;
    line-height: 1.4;
}

.tl-opt {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
    font-size: 0.86rem;
    line-height: 1.35;
    cursor: pointer;
}

.tl-opt input {
    margin: 0;
    flex-shrink: 0;
}

.tl-opt-count {
    margin-left: auto;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.tl-opt.is-empty {
    opacity: 0.45;
}

/* --------------------------------------------------------------- toolbar */

.tl-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.tl-search {
    flex: 1 1 280px;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--app-card-bg);
    color: var(--app-text);
}

.tl-search:focus {
    outline: 2px solid var(--app-accent);
    outline-offset: 1px;
}

.tl-kind-toggle {
    display: flex;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--app-card-bg);
}

.tl-kind-toggle button {
    border: none;
    background: transparent;
    padding: 9px 14px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--app-muted);
    cursor: pointer;
    border-right: 1px solid var(--app-border);
}

.tl-kind-toggle button:last-child {
    border-right: none;
}

.tl-kind-toggle button[aria-pressed="true"] {
    background: var(--app-accent);
    color: #fff;
}

.tl-count {
    font-size: 0.9rem;
    color: var(--app-muted);
}

/* ----------------------------------------------------------------- cards */

.tl-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.tl-card {
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tl-card-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.tl-kind-badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    border-radius: 5px;
}

.tl-kind-reading {
    background: #e8f0fd;
    color: #1a5fb4;
}

.tl-kind-mini-tool {
    background: #e8f7ee;
    color: #1d7a45;
}

.tl-kind-tool {
    background: #f3ecfd;
    color: #6b3fbb;
}

.tl-card h3 {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.3;
    color: var(--app-text);
}

.tl-card-desc {
    margin: 0;
    font-size: 0.87rem;
    line-height: 1.5;
    color: var(--app-muted);
}

.tl-card-teaches {
    margin: 0;
    font-size: 0.83rem;
    line-height: 1.45;
    color: var(--app-text);
    background: #f7f9fc;
    border-left: 3px solid var(--app-accent);
    padding: 8px 10px;
    border-radius: 0 6px 6px 0;
}

.tl-kit {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 0.8rem;
    color: var(--app-muted);
}

.tl-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tl-chip {
    font-size: 0.74rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: #47566a;
    border: none;
    cursor: pointer;
}

.tl-chip:hover {
    background: #dfe7f1;
}

.tl-chip-math {
    background: #fdf2e3;
    color: #8a5a12;
}

.tl-card-actions {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tl-btn {
    font-size: 0.83rem;
    font-weight: 600;
    padding: 7px 13px;
    border-radius: 7px;
    border: 1px solid var(--app-border);
    background: var(--app-card-bg);
    color: var(--app-text);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tl-btn:hover {
    border-color: var(--app-accent);
    color: var(--app-accent-dark);
}

.tl-btn-primary {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.tl-btn-primary:hover {
    background: var(--app-accent-dark);
    border-color: var(--app-accent-dark);
    color: #fff;
}

.tl-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.tl-btn-in-course {
    background: #e8f7ee;
    border-color: #9ed5b4;
    color: #1d7a45;
}

/* ------------------------------------------------------------ empty state */

.tl-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: var(--app-muted);
}

.tl-empty h3 {
    margin: 0 0 8px;
    color: var(--app-text);
}

/* -------------------------------------------------------------- shortlist */

.tl-shortlist-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--app-text);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    z-index: 900;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.18);
}

.tl-shortlist-bar[hidden] {
    display: none;
}

.tl-shortlist-bar .tl-btn {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

.tl-shortlist-bar .tl-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* ------------------------------------------------------------------ modal */

.tl-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

.tl-modal-backdrop[hidden] {
    display: none;
}

.tl-modal {
    background: var(--app-card-bg);
    border-radius: 12px;
    max-width: 860px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px 24px;
}

.tl-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.tl-modal-head h2 {
    margin: 0;
    font-size: 1.2rem;
}

.tl-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--app-muted);
    padding: 0 4px;
}

/* ------------------------------------------------------- course + notices */

.tl-course-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #eef4fd;
    border: 1px solid #c7dcfa;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.tl-notice {
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.tl-notice[hidden] {
    display: none;
}

.tl-notice-info {
    background: #eef4fd;
    border: 1px solid #c7dcfa;
    color: #1a4a86;
}

.tl-notice-warn {
    background: #fdf6e7;
    border: 1px solid #f0d9a0;
    color: #77551a;
}

.tl-notice-error {
    background: #fdecec;
    border: 1px solid #f3b9b9;
    color: #99302f;
}

@media (prefers-reduced-motion: reduce) {
    .tl-lens,
    .tl-btn {
        transition: none;
    }
}
