/* ============================================================
   PUBLIC LIBRARY — List + Detail Styles
   ============================================================ */

/* ---------- FILTERS ---------- */

.library-filters
{
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pub-search-input
{
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    border: 1px solid var(--pub-border);
    border-radius: 8px;
    font-size: 0.95em;
    color: var(--pub-text);
    background: var(--pub-card);
    outline: none;
    transition: border-color 0.15s;
}

.pub-search-input:focus
{
    border-color: var(--pub-primary);
}

.pub-search-input::placeholder
{
    color: var(--pub-text-light);
}

.pub-filter-select
{
    padding: 10px 16px;
    border: 1px solid var(--pub-border);
    border-radius: 8px;
    font-size: 0.95em;
    color: var(--pub-text);
    background: var(--pub-card);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.pub-filter-select:focus
{
    border-color: var(--pub-primary);
}

/* ---------- COUNT ---------- */

.library-count
{
    text-align: right;
    margin-bottom: 16px;
    color: var(--pub-text-light);
    font-size: 0.9em;
}

/* ---------- BOOK GRID ---------- */

.library-grid
{
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

/* ---------- BOOK CARD ---------- */

.book-card
{
    background: var(--pub-card);
    border-radius: 12px;
    border: 1px solid var(--pub-border);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    animation: pubFadeIn 0.3s ease-out both;
}

.book-card:hover
{
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.book-card-cover
{
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.book-card-cover img
{
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.book-card:hover .book-card-cover img
{
    transform: scale(1.03);
}

.book-card-placeholder
{
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 3em;
    position: absolute;
    top: 0;
    left: 0;
}

.book-card-info
{
    padding: 12px;
}

.book-card-title
{
    font-weight: 600;
    font-size: 1em;
    color: var(--pub-text);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-author
{
    color: var(--pub-text-light);
    font-size: 0.9em;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-badge
{
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.badge-available
{
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-loaned
{
    background: #FFEBEE;
    color: #C62828;
}

.book-card-copies
{
    font-size: 0.8em;
    color: var(--pub-text-light);
    margin-top: 4px;
}

/* ---------- EMPTY STATE ---------- */

.library-empty
{
    text-align: center;
    padding: 60px 20px;
    color: var(--pub-text-light);
    grid-column: 1 / -1;
}

.library-empty i
{
    font-size: 3em;
    margin-bottom: 16px;
    opacity: 0.4;
    display: block;
}

.library-empty p
{
    font-size: 1.05em;
    margin: 0;
}

/* ---------- PAGINATION ---------- */

.pub-pagination
{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.pub-btn-page
{
    padding: 8px 16px;
    border: 1px solid var(--pub-border);
    border-radius: 8px;
    background: var(--pub-card);
    color: var(--pub-text);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.15s;
}

.pub-btn-page:hover:not(:disabled)
{
    border-color: var(--pub-primary);
    color: var(--pub-primary);
}

.pub-btn-page:disabled
{
    opacity: 0.4;
    cursor: default;
}

/* ---------- BACK BUTTON ---------- */

.pub-btn-back
{
    padding: 10px 20px;
    border: 1px solid var(--pub-border);
    border-radius: 8px;
    background: var(--pub-card);
    color: var(--pub-text);
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.15s;
}

.pub-btn-back:hover
{
    border-color: var(--pub-primary);
    color: var(--pub-primary);
}

/* ---------- DETAIL PAGE ---------- */

.book-detail-layout
{
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

.book-detail-images
{
    display: flex;
    gap: 16px;
    flex-shrink: 0;
    width: 40%;
}

.book-detail-cover
{
    flex: 1;
    aspect-ratio: 2 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.book-detail-cover img
{
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-detail-placeholder
{
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 3em;
    position: absolute;
    top: 0;
    left: 0;
}

.book-detail-info
{
    flex: 1;
    min-width: 0;
}

.book-detail-title
{
    font-size: 2em;
    font-weight: 700;
    color: var(--pub-text);
    margin: 0 0 8px;
    line-height: 1.2;
}

.book-detail-author
{
    font-size: 1.1em;
    color: var(--pub-text-light);
    margin-bottom: 16px;
}

.book-detail-author i
{
    color: var(--pub-primary);
}

.book-detail-availability
{
    margin-bottom: 20px;
}

.book-detail-grid
{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.detail-field
{
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    background: var(--pub-bg);
    border-radius: 8px;
    border: 1px solid var(--pub-border);
}

.detail-label
{
    font-size: 0.78em;
    font-weight: 600;
    color: var(--pub-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-field > span:last-child
{
    font-size: 0.95em;
    color: var(--pub-text);
    font-weight: 500;
}

.book-detail-description
{
    font-size: 0.95em;
    color: var(--pub-text);
    line-height: 1.7;
    padding-top: 20px;
    border-top: 1px solid var(--pub-border);
    white-space: pre-line;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1400px)
{
    .library-grid
    {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 1024px)
{
    .library-grid
    {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px)
{
    .library-grid
    {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .book-detail-layout
    {
        flex-direction: column;
    }

    .book-detail-images
    {
        width: 100%;
    }

    .book-detail-title
    {
        font-size: 1.5em;
    }

    .book-detail-grid
    {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px)
{
    .library-grid
    {
        grid-template-columns: 1fr !important;
    }

    .library-filters
    {
        flex-direction: column;
    }

    .pub-search-input
    {
        min-width: 0;
    }

    .book-detail-images
    {
        flex-direction: column;
    }
}
