/* Worksheets — grid cards with top toolbar filters */

.page-header p b { color: var(--accent); font-weight: 700; }

/* ── Filter toolbar ── */
.filter-toolbar {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Toolbar top row: search + result count */
.toolbar-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-wrap {
    position: relative;
    flex: 1;
    max-width: 320px;
}
.search-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
}
.search-wrap input {
    width: 100%; padding: 8px 12px 8px 32px;
    font-size: .78rem;
    border: 1px solid var(--border-light);
    border-radius: 100px;
    background: var(--page-bg);
    color: var(--text);
    outline: none;
    transition: border-color .15s;
}
.search-wrap input:focus {
    border-color: var(--accent);
}
.toolbar-count {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
}

/* Toolbar filter rows */
.toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.toolbar-row-label {
    font-size: .64rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    flex-shrink: 0;
    min-width: 42px;
}
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Pill buttons */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
    white-space: nowrap;
}
.pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}
.pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pill input { display: none; }

/* Unit pills — slightly different style */
.pill-unit-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pill-unit-group:empty { display: none; }

/* Divider between filter rows */
.toolbar-divider {
    width: 100%;
    height: 1px;
    background: var(--border-light);
    margin: 2px 0;
}

/* ── Grade sections ── */
.grade-sec { margin-bottom: 28px; }
.grade-sec.hide { display: none; }

/* ── Unit sections ── */
.u-sec { margin-bottom: 20px; }
.u-sec.hide { display: none; }
.u-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.u-name { font-size: .72rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.u-name em { font-style: normal; color: var(--text-muted); font-weight: 500; text-transform: none; }

/* ── Worksheet grid cards ── */
.ws-table {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
    gap: 16px;
}
a.ws-row {
    display: flex; flex-direction: column;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    text-decoration: none; color: inherit;
    cursor: pointer;
    overflow: hidden;
}
a.ws-row:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 12px rgba(0,0,0,.06);
}
.ws-row.hide { display: none; }

/* ── Preview area ── */
.ws-preview {
    aspect-ratio: 210 / 297;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
    position: relative;
    background: var(--page-bg);
}
.ws-preview img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    position: absolute; top: 0; left: 0;
    opacity: 0;
    transition: opacity .15s;
}
.ws-preview img.active { opacity: 1; }
.ws-preview iframe {
    width: 200%; height: 200%;
    transform: scale(0.5);
    transform-origin: top left;
    pointer-events: none;
    border: none;
    display: block;
}
.ws-preview .ws-ph {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 6px;
    background: var(--page-bg);
    color: var(--text-muted);
}
.ws-ph span:first-child {
    font-size: 2rem;
}
.ws-ph span:last-child {
    font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
}

/* ── Thumbnail hover segments ── */
.ws-preview-zones {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex; z-index: 2;
}
.ws-preview-zones span {
    flex: 1;
}

/* ── Thumbnail dots ── */
.ws-dots {
    position: absolute; bottom: 8px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 5px; z-index: 3;
    opacity: 0; transition: opacity .15s;
}
.ws-preview:hover .ws-dots { opacity: 1; }
.ws-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.45);
    transition: background .12s, transform .12s;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.ws-dot.active {
    background: #fff;
    transform: scale(1.25);
}

/* ── Card body ── */
.ws-card-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Grade.Unit strip */
.ws-gu-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--accent);
    color: #fff;
}
.ws-gu-num {
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.02em;
}
.ws-gu-label {
    font-size: .68rem;
    font-weight: 600;
    opacity: .85;
    line-height: 1.2;
}

/* Card info */
.ws-card-info {
    padding: 10px 12px;
    min-width: 0;
}
.ws-title {
    font-size: .8rem; font-weight: 700; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-meta {
    font-size: .64rem; color: var(--text-muted); font-weight: 500; margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Badges row */
.ws-badges {
    display: flex; align-items: center; gap: 0;
    border-top: 1px solid var(--border-light);
    justify-content: space-evenly;
}
.ws-badge {
    flex: 0 1 auto;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 8px 6px;
    font-size: .66rem; font-weight: 600;
    text-decoration: none; white-space: nowrap;
    color: var(--text-dim); background: var(--surface);
    transition: background .12s, color .12s;
    border: none; border-radius: 0;
}
.ws-badge + .ws-badge {
    border-left: 1px solid var(--border-light);
}
.ws-badge:hover { background: var(--page-bg); color: var(--accent); }
.ws-badge.hide { display: none; }

/* ── Responsive ── */
@media (max-width: 700px) {
    .ws-table { grid-template-columns: 1fr 1fr; }
    .filter-toolbar { padding: 12px 14px; gap: 10px; }
    .search-wrap { max-width: 100%; }
    .toolbar-top { flex-wrap: wrap; }
}
@media (max-width: 440px) {
    .ws-table { grid-template-columns: 1fr; }
    .toolbar-row { gap: 6px; }
    .pill { padding: 5px 11px; font-size: .68rem; }
}

/* ── Empty state ── */
.empty-state {
    text-align: center; padding: 56px 20px;
    color: var(--text-muted); font-size: .85rem;
}
.empty-state.hide { display: none; }
