/* Flashcards library — Knowt-inspired deck grid (/app — #flashcardsLibraryPage) */

.flashcards-library-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(1rem, 4vw, 2rem) clamp(1rem, 3vw, 1.5rem) 3rem;
    box-sizing: border-box;
}

.flashcards-library-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.flashcards-library-header h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 3.5vw, 1.65rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.flashcards-library-header .subtitle {
    margin: 0;
    color: #94a3b8;
    font-size: 0.9rem;
    max-width: 36rem;
    line-height: 1.45;
}

.flashcards-library-btn-new {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: transparent;
    color: #f1f5f9;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.flashcards-library-btn-new:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(61, 214, 140, 0.45);
}

.flashcards-library-btn-new-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: rgba(61, 214, 140, 0.2);
    color: #3dd68c;
    font-size: 1rem;
    line-height: 1;
}

.flashcards-library-loading,
.flashcards-library-error {
    padding: 1rem 0;
    color: #94a3b8;
    font-size: 0.9rem;
}

.flashcards-library-error {
    color: #fca5a5;
}

/* Grid of deck tiles */
.flashcards-library-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.flashcards-library-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

.flashcards-library-load-more-wrap.hidden {
    display: none !important;
}

.flashcards-library-load-more {
    min-width: 10rem;
}

.flashcards-library-tile {
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 188px;
    border-radius: 20px;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    overflow: hidden;
}

.flashcards-library-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    border-color: rgba(61, 214, 140, 0.22);
}

/* Upper area: icon, title, meta — full region opens Study */
.flashcards-library-tile-main {
    position: relative;
    flex: 1;
    padding: 1rem 1.1rem 0.75rem;
    min-height: 120px;
    box-sizing: border-box;
}

.flashcards-library-tile-hit {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 0;
}

.flashcards-library-tile-main > :not(.flashcards-library-tile-hit) {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.flashcards-library-tile-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.flashcards-library-tile-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 1.15rem;
    line-height: 1;
}

.flashcards-library-tile-icon--hub {
    background: rgba(59, 130, 246, 0.18);
}

.flashcards-library-tile-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.16);
    color: #5eead4;
    border: 1px solid rgba(45, 212, 191, 0.25);
    white-space: nowrap;
}

.flashcards-library-tile-badge--empty {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.2);
}

.flashcards-library-tile-title {
    margin: 0 0 0.4rem;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f8fafc;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-right: 2rem;
}

.flashcards-library-tile-meta {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    color: #94a3b8;
    min-height: 1.1em;
}

.flashcards-library-tile-avatar {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    background: hsl(var(--avatar-h, 200), 48%, 42%);
    border: 2px solid #1e1e1e;
    pointer-events: none;
}

.flashcards-library-tile-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem 0.85rem 0.65rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.flashcards-library-tile-actions a {
    font-size: 0.72rem;
    font-weight: 600;
    color: #cbd5e1;
    text-decoration: none;
    padding: 0.25rem 0.45rem;
    border-radius: 6px;
    transition: color 0.12s ease, background 0.12s ease;
}

.flashcards-library-tile-actions a:hover {
    color: #3dd68c;
    background: rgba(61, 214, 140, 0.08);
}

.flashcards-library-tile-actions button {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.25rem 0.45rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: #94a3b8;
}

.flashcards-library-tile-actions button:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

.flashcards-library-tile-actions .flashcards-library-tile-actions-delete {
    color: #f87171;
}

.flashcards-library-tile-actions .flashcards-library-tile-actions-delete:hover {
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
}

.flashcards-library-empty-state,
.flashcards-library-empty {
    text-align: center;
    padding: clamp(2rem, 6vw, 3rem) 1.25rem;
    border-radius: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(30, 30, 30, 0.6);
}

.flashcards-library-empty .empty-icon,
.flashcards-library-empty-state .empty-icon {
    font-size: 2.25rem;
    display: block;
    margin-bottom: 0.75rem;
}

.flashcards-library-empty h2,
.flashcards-library-empty-state h2 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    color: #f1f5f9;
}

.flashcards-library-empty p,
.flashcards-library-empty-state p {
    margin: 0 0 1.25rem;
    color: #94a3b8;
    font-size: 0.95rem;
}

@media (max-width: 520px) {
    .flashcards-library-grid {
        grid-template-columns: 1fr;
    }
}
