@layer pages {
/* static/css/library.css */

/* ========================================
   TAB SYSTEM (PILLS)
   ======================================== */
.materials-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-03, 1rem);
    margin: var(--space-05, 2rem) 0 var(--space-04, 1.5rem);
    padding: var(--space-03, 1rem);
    border-radius: var(--radius-md, 18px);
    background: var(--glass, rgb(255 255 255 / 3%));
    border: 1px solid var(--border, rgb(255 255 255 / 8%));
    box-shadow: var(--shadow-card, 0 12px 30px rgb(0 0 0 / 15%));
}

.tab-pill {
    background: var(--glass, rgb(255 255 255 / 4%));
    border: 1px solid var(--border, rgb(255 255 255 / 8%));
    color: var(--text, var(--text-primary, #fff));
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgb(0 0 0 / 15%);
}

.tab-pill.active {
    background: linear-gradient(135deg, var(--color-primary, #c21728), var(--color-accent, #ffb347));
    color: var(--color-surface-contrast, #fff);
    border-color: transparent;
    box-shadow: 0 12px 30px rgb(194 23 40 / 35%);
}

/* ========================================
   LIBRARY CONTAINER & FILTERS
   ======================================== */

/* ========================================
   LIBRARY CONTAINER & FILTERS
   ======================================== */
.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
    border-radius: var(--radius-md, 18px);
}

.tab-content.active {
    display: block;
}

.library-container {
    /* Specific styles if needed, but display is handled by tab-content */
}

.library-filters {
    background: var(--glass, rgb(255 255 255 / 3%));
    backdrop-filter: blur(18px);
    border: 1px solid var(--border, rgb(255 255 255 / 8%));
    border-radius: var(--radius-md, 18px);
    padding: var(--space-05, 1.5rem);
    margin-bottom: var(--space-05, 2rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow-card, 0 12px 30px rgb(0 0 0 / 25%));
}

.search-bar-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.library-filters .search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    background: var(--card-bg, rgb(255 255 255 / 4%));
    border: 1px solid var(--border, rgb(255 255 255 / 8%));
    border-radius: var(--radius-md, 16px);
    color: var(--text, var(--text-primary, #fff));
    font-size: 1rem;
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

.library-filters .search-input:focus {
    outline: none;
    border-color: var(--color-primary, #c21728);
    box-shadow: 0 0 0 3px rgb(194 23 40 / 25%);
}

.library-filters .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted, #8a8ca3);
    pointer-events: none;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.filter-tag {
    background: var(--glass, rgb(255 255 255 / 4%));
    border: 1px solid var(--border, rgb(255 255 255 / 8%));
    color: var(--text, var(--text-secondary, #d5d5e5));
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tag:hover,
.filter-tag.active {
    background: linear-gradient(135deg, var(--color-primary, #c21728), var(--color-accent, #ffb347));
    color: white;
    border-color: transparent;
    box-shadow: 0 12px 24px rgb(194 23 40 / 35%);
}

/* ========================================
   BOOK GRID & 3D CARDS
   ======================================== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2.5rem;
    padding: 1rem;
}

.book-card {
    perspective: 1000px;
    cursor: pointer;
}

.book-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.book-card:hover .book-inner {
    transform: rotateY(-10deg) translateY(-10px);
}

.book-cover {
    position: absolute;
    inset: 0;
    border-radius: 4px 12px 12px 4px;
    overflow: hidden;
    box-shadow:
        -2px 0 5px rgb(0 0 0 / 20%),
        /* Spine shadow */
        5px 5px 15px rgb(0 0 0 / 30%);

    /* Drop shadow */
    background: #2a2a2a;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Spine effect (left edge) */
.book-cover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;
    background: linear-gradient(to right,
            rgb(255 255 255 / 20%) 0%,
            rgb(255 255 255 / 0%) 20%,
            rgb(0 0 0 / 10%) 100%);
    z-index: 2;
}

/* Store Overlay (Glassmorphism) */
.store-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgb(255 255 255 / 15%);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgb(0 0 0 / 50%);
    border: 1px solid rgb(255 255 255 / 20%);
    z-index: 3;
    opacity: 0.9;
}

/* Book Info (Below Card) */
.book-info {
    margin-top: 1.25rem;
    text-align: center;
    color: var(--text, var(--text-primary, #fff));
}

.book-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text, var(--text-primary, #fff));
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.book-price {
    color: var(--color-accent, #ffb347);
    font-weight: 700;
    font-size: 1.1rem;
}

.book-badge {
    background: linear-gradient(135deg, #ffd700, #fa0);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.btn-view-offer {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.9rem;
    background: transparent;
    border: 1px solid var(--color-accent, #ffb347);
    color: var(--color-accent, #ffb347);
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-view-offer:hover {
    background: var(--color-accent, #ffb347);
    color: #05040b;
}

/* Loading State */
.library-loading {
    text-align: center;
    padding: 4rem;
    color: var(--muted, #8a8ca3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgb(255 77 166 / 10%);
    border-left-color: var(--color-primary, #c21728);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (width <= 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1.5rem;
    }

    .tab-pill {
        padding: 0.5rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   CURRENCY DROPDOWN (Copied from Projects)
   ======================================== */
.currency-dropdown {
    appearance: none;
    background-color: var(--bg-glass, rgb(255 255 255 / 5%));
    border: 1px solid var(--border-default, rgb(255 255 255 / 10%));
    border-radius: var(--radius-md, 8px);
    color: var(--text-secondary, #a1a1aa);
    padding: 0.4rem 2rem 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-chevron-down'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    height: 48px;

    /* Match search input height */
    display: flex;
    align-items: center;
}

.light-mode .currency-dropdown {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-chevron-down'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    color: var(--text-primary, #111);
    border-color: var(--border-default, #e5e7eb);
}

.currency-dropdown:hover {
    border-color: var(--neon-pink, #d946ef);
    color: var(--neon-pink, #d946ef);
    background-color: var(--bg-elevated, rgb(255 255 255 / 8%));
}

.currency-dropdown:focus {
    outline: none;
    border-color: var(--neon-pink, #d946ef);
    box-shadow: 0 0 0 2px var(--neon-pink-glow, rgb(217 70 239 / 30%));
}

.text-danger {
    color: var(--danger-color);
}
}
