/**
 * KidsActivities Worksheet Library Styles
 * Matches Newspaper theme: Open Sans font, #ff9bd2 theme color, landscape cards
 * Version: 2.0
 */

/* Library Container */
.kids-library-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
    font-family: "Open Sans", sans-serif;
}

/* ========== SIDEBAR ========== */
.kids-library-sidebar {
    width: 260px;
    flex-shrink: 0;
}
.kids-library-sidebar h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #222;
    margin: 20px 0 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ff9bd2;
    font-weight: 700;
}
.kids-library-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px;
}
.kids-library-sidebar li {
    margin: 0;
}
.kids-library-sidebar label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    color: #444;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.15s;
    user-select: none;
}
.kids-library-sidebar label:hover {
    background: #fff0f7;
    color: #e080b5;
}
.kids-library-sidebar input[type="checkbox"] {
    accent-color: #ff9bd2;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    flex-shrink: 0;
}
.kids-library-sidebar .filter-name {
    flex: 1;
}
.kids-library-sidebar .term-count {
    font-size: 11px;
    color: #999;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

/* ========== ACTIVE FILTER PILLS ========== */
.kids-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.kids-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fce4ec;
    color: #c2185b;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s;
}
.kids-filter-pill:hover {
    background: #f8bbd0;
}
.kids-filter-pill .pill-x {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    opacity: 0.6;
}
.kids-filter-pill .pill-x:hover {
    opacity: 1;
}
.kids-clear-all {
    font-size: 13px;
    color: #d32f2f;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 20px;
    background: #ffebee;
    transition: background 0.15s;
}
.kids-clear-all:hover {
    background: #ffcdd2;
}

/* ========== LOADING ========== */
.kids-card-grid.loading {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
    min-height: 200px;
}
.kids-card-grid.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #fce4ec;
    border-top-color: #ff9bd2;
    border-radius: 50%;
    animation: kids-spin 0.8s linear infinite;
}
@keyframes kids-spin { to { transform: rotate(360deg); } }

/* ========== MAIN CONTENT ========== */
.kids-library-main {
    flex: 1;
    min-width: 0;
}

/* ========== BREADCRUMBS ========== */
.kids-library-breadcrumbs {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kids-library-breadcrumbs a {
    color: #ff9bd2;
    text-decoration: none;
}
.kids-library-breadcrumbs a:hover {
    color: #e080b5;
}
.kids-library-breadcrumbs span {
    margin: 0 6px;
    color: #ddd;
}

/* ========== HEADER ========== */
.kids-library-header h1 {
    font-size: 26px;
    color: #222;
    margin: 0 0 10px;
    font-weight: 700;
    line-height: 1.3;
}
.kids-library-header .intro {
    color: #777;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 20px;
}
.kids-library-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.kids-library-meta .count {
    font-size: 13px;
    color: #999;
}

/* ========== AD SLOT ========== */
.kids-library-ad {
    grid-column: 1 / -1;
    text-align: center;
    padding: 10px 0;
    min-height: 90px;
}

/* ========== CARD GRID ========== */
.kids-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ========== CARD ========== */
.kids-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}
.kids-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.kids-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}
.kids-card-thumb {
    width: 100%;
    aspect-ratio: 570 / 339;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}
.kids-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}
.kids-card:hover .kids-card-thumb img {
    opacity: 0.9;
}
.kids-card-thumb .badge-free {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff9bd2;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kids-card-thumb .badge-grade {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 2px;
    letter-spacing: 0.3px;
}
.badge-grade-prek { background: rgba(46,125,50,0.9); color: #fff; }
.badge-grade-k { background: rgba(21,101,192,0.9); color: #fff; }
.badge-grade-1st { background: rgba(123,31,162,0.9); color: #fff; }
.badge-grade-all { background: rgba(230,81,0,0.9); color: #fff; }
.badge-grade-toddler { background: rgba(0,150,136,0.9); color: #fff; }

.kids-card-body {
    padding: 14px 16px 16px;
    border-top: 3px solid #ff9bd2;
}
.kids-card-body h3 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 8px;
    color: #222;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.kids-card:hover .kids-card-body h3 {
    color: #ff9bd2;
}
.kids-card-body .card-subject {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== PAGINATION ========== */
.kids-library-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 40px 0;
}
.kids-library-pagination a,
.kids-library-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
}
.kids-library-pagination a {
    background: #f5f5f5;
    color: #444;
}
.kids-library-pagination a:hover {
    background: #ff9bd2;
    color: #fff;
}
.kids-library-pagination span.current {
    background: #ff9bd2;
    color: #fff;
    font-weight: 700;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .kids-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .kids-library-wrap { flex-direction: column; gap: 15px; }
    .kids-library-sidebar { width: 100%; }
    .kids-filter-group { margin-bottom: 10px; }
    .kids-filter-group h3 { cursor: pointer; position: relative; }
    .kids-filter-group h3::after { content: '\25B8'; position: absolute; right: 0; transition: transform 0.2s; }
    .kids-filter-group.open h3::after { transform: rotate(90deg); }
    .kids-filter-group ul { display: none; }
    .kids-filter-group.open ul { display: block; }
    .kids-card-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .kids-library-header h1 { font-size: 22px; }
}
@media (max-width: 480px) {
    .kids-card-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kids-card-body { padding: 8px 10px; }
    .kids-card-body h3 { font-size: 12px; }
}
