/* assets/css/browse.css - Modern Catalog & Search View Styling */

/* Page Hero */
.page-hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(139, 92, 246, 0.12) 100%);
    border-bottom: 1px solid var(--border-subtle);
    padding: 3.5rem 0;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -100px;
    right: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.breadcrumbs a {
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.breadcrumbs a:hover {
    color: var(--primary-400);
}

.breadcrumbs i {
    font-size: 0.7rem;
}

.breadcrumbs span {
    color: var(--text-primary);
    font-weight: 600;
}

.page-title {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}

/* Browse Layout Grid */
.container-browse {
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.browse-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.75rem;
    padding-bottom: 5rem;
    align-items: start;
}

/* Sticky Filter Sidebar */
.browse-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-card {
    background: var(--glass-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-sm);
}

.filter-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.15);
}

.filter-card-header h3 {
    font-size: 1.05rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-card-header h3 i {
    color: var(--accent-cyan);
    font-size: 0.95rem;
}

.filter-card-body {
    padding: 1.25rem 1.5rem;
}

/* Search Box Inside Sidebar */
.sidebar-search-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sidebar-input-wrap {
    position: relative;
}

.sidebar-input-wrap i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.sidebar-input-wrap input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.92rem;
    outline: none;
    transition: all var(--transition-fast);
}

.sidebar-input-wrap input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Category Filter List */
.category-filter-list {
    list-style: none;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.category-filter-list li {
    margin-bottom: 0.25rem;
}

.category-filter-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.category-filter-list a:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text-primary);
}

.category-filter-list a.active {
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}

.category-filter-list a.active .count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.category-filter-list a .count {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* ========================================================
   SORT & VIEW TOOLBAR
   ======================================================== */
.browse-main {
    min-width: 0;
}

.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    gap: 1.5rem;
    flex-wrap: wrap;
}

.sort-info {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.sort-info strong {
    color: var(--text-primary);
}

.sort-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* View Mode Switcher (Grid / List) */
.view-switcher {
    display: flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.2rem;
}

.view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--primary-500);
    color: white;
    box-shadow: var(--shadow-glow);
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sort-controls label {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.sort-controls select {
    padding: 0.55rem 1.25rem 0.55rem 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.sort-controls select:focus {
    border-color: var(--primary-500);
}

/* Active Filter Chips */
.active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.75rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--primary-400);
    font-size: 0.85rem;
    font-weight: 600;
}

.filter-chip a {
    color: var(--primary-400);
    margin-left: 0.25rem;
    font-size: 0.8rem;
}

.filter-chip a:hover {
    color: var(--danger-500);
}

.clear-all-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: underline;
    margin-left: 0.5rem;
}

.clear-all-link:hover {
    color: var(--danger-500);
}

/* ========================================================
   BOOKS GRID (5 Columns) & LIST VIEW MODES
   ======================================================== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.15rem;
}

/* 5-Column Grid Card Proportion & Balance */
.books-grid .book-card {
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.books-grid .book-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.55), 0 0 20px rgba(139, 92, 246, 0.25);
}

.books-grid .book-card-body {
    padding: 0.85rem 0.85rem 0.95rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.books-grid .book-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.32;
    margin-bottom: 0.25rem;
    min-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.books-grid .book-card-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.books-grid .book-card-title a:hover {
    color: var(--primary-400);
}

.books-grid .book-card-author {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 0.55rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.books-grid .book-card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.74rem;
    color: var(--text-muted);
}

.books-grid .book-card-meta a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--primary-400);
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-card-footer-actions {
    margin-top: 0.65rem;
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.book-card-footer-actions .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.76rem;
}

/* Alternative List View */
.books-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.books-grid.list-view .book-card {
    flex-direction: row;
    height: auto;
    align-items: center;
}

.books-grid.list-view .book-card-cover {
    width: 140px;
    height: 190px;
    flex-shrink: 0;
}

.books-grid.list-view .book-card-body {
    padding: 1.5rem 2rem;
}

.books-grid.list-view .book-card-title {
    font-size: 1.35rem;
}

/* Empty Results State */
.no-results {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--glass-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
}

.no-results-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary-400);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
}

.no-results h3 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-muted);
    max-width: 420px;
    margin: 0 auto 2rem;
}

/* ========================================================
   PAGINATION
   ======================================================== */
.pagination-nav {
    margin-top: 3.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.85rem;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.page-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.page-link.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-glow);
}

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 0.4rem;
}

.pagination-info {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 1400px) {
    .books-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
}

@media (max-width: 1100px) {
    .browse-layout { grid-template-columns: 240px 1fr; gap: 1.5rem; }
    .books-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
}

@media (max-width: 768px) {
    .browse-layout { grid-template-columns: 1fr; }
    .browse-sidebar { position: static; }
    .sort-bar { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .sort-actions { width: 100%; justify-content: space-between; }
    .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
    .books-grid.list-view .book-card { flex-direction: column; }
    .books-grid.list-view .book-card-cover { width: 100%; height: auto; aspect-ratio: 3/4; }
}

@media (max-width: 480px) {
    .books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
    .books-grid .book-card-body { padding: 0.75rem 0.65rem; }
    .books-grid .book-card-title { font-size: 0.82rem; }
    .book-card-footer-actions { flex-direction: column; gap: 0.35rem; }
    .book-card-footer-actions .btn { width: 100%; }
}
