/* ========== LIBRARY MASTER PAGE STYLES ========== */
/* Page rendered by library-master.js at app.html?page=library */

.libm-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 28px 64px;
    box-sizing: border-box;
}

.libm-section {
    margin-top: 32px;
}

.libm-section-heading {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 12px;
}

/* AI hero — reuses .th-page-eyebrow + .th-lp-* composer / scope chip /
   textarea / placeholder / send-button styling from teacher-home.css so
   the visual rhythm matches the analytics & lesson-plans heroes. The
   only library-specific bit is the class-color legend strip + a few
   thinking/empty tweaks below. */

.libm-ai-hero-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.libm-ai-thinking .th-lp-msg-body {
    color: #9ca3af;
    font-style: italic;
}

/* Class-color legend strip — mirrors the analytics row of class dots. */
.libm-ai-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    margin-top: 12px;
    padding: 0 4px;
    font-size: 12.5px;
    color: #6b7280;
}
.libm-ai-legend-all {
    color: #9ca3af;
    letter-spacing: 0.04em;
    font-size: 12px;
}
.libm-ai-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #374151;
}
.libm-ai-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.libm-ai-legend-count {
    color: #9ca3af;
    font-style: italic;
    margin-left: 2px;
    font-size: 11.5px;
}

/* Tile grid (Your Libraries + Shared Libraries) */
.libm-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

/* Two-column section (Recent + Favorites) */
.libm-twocol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 820px) {
    .libm-twocol {
        grid-template-columns: 1fr;
    }
    .libm-page {
        padding: 16px 14px 48px;
    }
    .libm-title {
        font-size: 32px;
    }
}

/* Section-level placeholder text used during early phases */
.libm-placeholder {
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    padding: 28px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    background: #f9fafb;
}

.libm-loading,
.libm-empty {
    grid-column: 1 / -1;
    padding: 24px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    background: #f9fafb;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
}

/* ===== TILE ===== */
.libm-tile {
    position: relative;
    display: block;
    text-align: left;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.08s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    font-family: inherit;
}
.libm-tile:hover {
    border-color: var(--libm-tile-color, #d1d5db);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.libm-tile:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.libm-tile:focus-visible {
    outline: 2px solid var(--libm-tile-color, #6366f1);
    outline-offset: 2px;
}

.libm-tile-stripe {
    display: block;
    height: 6px;
    background: var(--libm-tile-color, #6366f1);
}

.libm-tile-body {
    padding: 14px 16px 16px;
}

.libm-tile-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 4px;
}

.libm-tile-sub {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
    /* Truncate long connected-class lists to one line */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.libm-tile-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}
.libm-tile-count {
    color: #111827;
    font-weight: 500;
}
.libm-tile-dot {
    color: #d1d5db;
}

/* ===== SHARED TILE (linked-teacher libraries) ===== */
.libm-tile-shared-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.libm-tile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ecfeff;
    color: #0e7490;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.libm-tile-shared-name {
    flex: 1;
    min-width: 0;
}
.libm-tile-badge {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: #0e7490;
    letter-spacing: 0.02em;
}
.libm-tile-meta-muted {
    color: #9ca3af;
    font-style: italic;
}

/* ===== ROWS (Recent + Favorites columns) ===== */
.libm-rows {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.libm-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}
.libm-row:last-child {
    border-bottom: none;
}
.libm-row:hover {
    background: #f9fafb;
}
.libm-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    padding: 10px 6px 10px 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
}
.libm-row-main:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
    border-radius: 4px;
}
.libm-row-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.libm-row-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.libm-row-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.libm-row-meta {
    font-size: 11.5px;
    color: #6b7280;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.libm-row-kebab-wrap {
    position: relative;
    flex-shrink: 0;
    padding: 0 8px;
}
.libm-row-kebab {
    background: transparent;
    border: 1px solid transparent;
    color: #6b7280;
    font-size: 16px;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
}
.libm-row-kebab:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #111827;
}
.libm-row-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 200px;
    padding: 4px;
    z-index: 30;
}
.libm-row-menuitem {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 8px 10px;
    font-size: 13px;
    color: #1f2937;
    cursor: pointer;
    border-radius: 4px;
    font-family: inherit;
}
.libm-row-menuitem:hover {
    background: #f0fdf4;
    color: #065f46;
}

/* ===== UNGRADED CLASS BANNER ===== */
.libm-ungraded-banner {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
}
.libm-ungraded-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.libm-ungraded-body {
    flex: 1;
    min-width: 0;
}
.libm-ungraded-title {
    font-size: 13px;
    font-weight: 600;
    color: #78350f;
}
.libm-ungraded-sub {
    font-size: 12px;
    color: #92400e;
    margin-top: 2px;
}
.libm-ungraded-cta {
    background: #fff;
    border: 1px solid #fcd34d;
    color: #78350f;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.libm-ungraded-cta:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}
