/* Book Catalog Styles */
.book-catalog-table {
    border-collapse: collapse;
    width: 100%;
    table-layout: auto;
}
.book-catalog-table th,
.book-catalog-table td {
    border-left: none;
    border-right: none;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    padding-left: 8px;
    padding-right: 15px;
}
.book-catalog-table thead th {
    border-top: 2px solid #dee2e6;
    border-bottom: 2px solid #dee2e6;
    background-color: #EDF2F9;
    border-color: #D8E2EF;
}
.book-catalog-table tbody tr:first-child td {
    border-top: 2px solid #dee2e6;
}
.book-catalog-table th:nth-child(2),
.book-catalog-table td:nth-child(2) {
    padding-left: 0;
}
.inventory-table {
    border-collapse: collapse;
}
.inventory-table th,
.inventory-table td {
    border-left: none;
    border-right: none;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}
.inventory-table thead th {
    border-top: 2px solid #dee2e6;
    border-bottom: 2px solid #dee2e6;
}
.inventory-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 3px;
    overflow: visible;
}
.inventory-date {
    display: inline-block;
    background-color: #BFDBFE;
    border: 1px solid #5578E4;
    color: #5578E4;
    border-radius: 15px;
    padding: 3px 8px;
    font-size: 0.85em;
    overflow: visible;
    box-sizing: border-box;
}
.inventory-init {
    display: inline-block;
    background-color: #E2E8F0;
    border: 1px solid #5E6E82;
    color: #5E6E82;
    border-radius: 15px;
    padding: 3px 8px;
    font-size: 0.85em;
    overflow: visible;
    box-sizing: border-box;
}
.inventory-curr {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 0.85em;
    overflow: visible;
    box-sizing: border-box;
}
.inventory-curr.in-stock {
    background-color: #B1F4D5;
    color: #198465;
    border: 1px solid #198465;
}
.inventory-curr.out-of-stock {
    background-color: #FECACA;
    color: #BC2626;
    border: 1px solid #BC2626;
}
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0;
}
.pagination li {
    display: inline-block;
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-decoration: none;
    color: #000000;
}
.pagination li:not(:first-child) a, .pagination li:not(:first-child) span {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.pagination li:not(:last-child) a, .pagination li:not(:last-child) span {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.pagination .active span {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}
.pagination a:hover {
    background-color: #e9ecef;
}
.book-info {
    line-height: 1.6;
    font-size: 1em;
}
.book-catalog-table td {
    font-size: 1em;
    line-height: 1.5;
    vertical-align: top;
}
.book-catalog-table td:nth-child(1) {
    padding-top: 12px;
    padding-bottom: 12px;
}
.book-catalog-table td:nth-child(1) > * {
    margin-bottom: 8px;
    display: block;
}
.book-catalog-table td:nth-child(1) > *:last-child {
    margin-bottom: 0;
}
.book-catalog-table td:nth-child(1) img {
    margin-top: 8px;
    margin-bottom: 8px;
    display: block;
}
.book-catalog-table td:nth-child(2) {
    padding-top: 12px;
    padding-bottom: 12px;
}
.book-catalog-table td:nth-child(4) {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 1em;
}
.book-catalog-table td:nth-child(4) > * {
    margin-bottom: 10px;
    display: block;
}
.book-catalog-table td:nth-child(4) > *:last-child {
    margin-bottom: 0;
}
.book-catalog-table td:nth-child(4) .inventory-item {
    margin-bottom: 8px;
}
.book-catalog-table td:nth-child(4) a,
.book-catalog-table td:nth-child(4) a:link,
.book-catalog-table td:nth-child(4) a:visited {
    font-weight: 600 !important;
    font-size: 1em;
    margin-top: 4px;
    margin-bottom: 4px;
    display: inline-block;
}
.inventory-date,
.inventory-init,
.inventory-curr {
    font-size: 0.9em;
}
/* Responsive: Combine Book Info and Inventory columns on small screens */
/* Desktop: show desktop header text, hide mobile header text */
.book-catalog-table th .header-text-desktop {
    display: inline;
}
.book-catalog-table th .header-text-mobile {
    display: none;
}
/* Desktop: hide mobile inventory, show desktop inventory cell */
.book-catalog-table td.book-info .mobile-inventory {
    display: none;
}
.book-catalog-table td.inventory-cell {
    display: table-cell;
}
@media (max-width: 768px) {
    /* Mobile: hide desktop header text, show mobile header text */
    .book-catalog-table th .header-text-desktop {
        display: none;
    }
    .book-catalog-table th .header-text-mobile {
        display: inline;
    }
    /* Mobile: hide inventory header */
    .book-catalog-table th.inventory-header {
        display: none;
    }
    /* Mobile: make book-info header span visually (remove right border) */
    .book-catalog-table th.book-info-header {
        border-right: none;
    }
    /* Mobile: hide desktop inventory cell, show mobile inventory */
    .book-catalog-table td.inventory-cell {
        display: none;
    }
    .book-catalog-table td.book-info .mobile-inventory {
        display: block;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid #dee2e6;
    }
    /* Mobile: remove right border from book-info cell to visually combine */
    .book-catalog-table td.book-info {
        border-right: none;
    }
    /* Mobile: Search box styles are now consolidated in responsive-common.css */
    /* These rules ensure the search elements match card container widths */
    /* Mobile: Keep all inventory elements on same line */
    .inventory-item {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    .inventory-date,
    .inventory-init,
    .inventory-curr {
        white-space: nowrap;
        flex-shrink: 0;
    }
    .inventory-init,
    .inventory-curr {
        font-size: 0.8em;
    }
    /* Mobile: Reorder pagination - put buttons above "Showing entries..." text */
    .pagination-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
    }
    .pagination-container .pagination {
        order: -1;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    .pagination-container .pagination-entries-text {
        order: 0;
        text-align: center;
    }
    .pagination-container > span:last-child {
        display: none;
    }
}
/* Loading spinner styles */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
