/* ========================================
   GOOGLE FONTS - Modern Typography
======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========================================
   BASE RESPONSIVE CONTAINER
======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 576px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 992px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* ========================================
   MODERN PREMIUM PAGE HEADER
======================================== */
.modern-ebook-header {
    position: relative;
    padding: 140px 0 80px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    overflow: hidden;
}

[data-theme="dark"] .modern-ebook-header {
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
}

.header-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(201, 48, 44, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(243, 156, 18, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.header-content-wrapper {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

/* Breadcrumb */
.header-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: rgba(201, 48, 44, 0.1);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary-color, #c9302c);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.header-breadcrumb:hover {
    background: rgba(201, 48, 44, 0.15);
    transform: translateY(-2px);
}

.header-breadcrumb a {
    color: var(--primary-color, #c9302c);
    transition: color 0.3s ease;
}

.header-breadcrumb a:hover {
    color: var(--secondary-color, #f39c12);
}

.breadcrumb-separator {
    color: var(--text-secondary, #666);
    opacity: 0.5;
}

.breadcrumb-current {
    color: var(--text-primary, #333);
    font-weight: 600;
}

/* Header Main Content */
.header-main-content {
    margin-bottom: 2rem;
}

.header-icon-badge {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 
        0 10px 30px rgba(201, 48, 44, 0.25),
        0 0 0 8px rgba(201, 48, 44, 0.1);
    transition: transform 0.3s ease;
}

.header-icon-badge:hover {
    transform: scale(1.05);
}

.modern-page-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.modern-page-description {
    font-size: 1.125rem;
    color: var(--text-secondary, #666);
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
}

/* Quick Stats */
.header-quick-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(201, 48, 44, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

[data-theme="dark"] .header-quick-stats {
    background: rgba(22, 33, 62, 0.8);
    border-color: rgba(201, 48, 44, 0.2);
}

.quick-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon-mini {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    border-radius: 12px;
    color: white;
    font-size: 1.25rem;
}

.stat-info {
    text-align: left;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-stat-divider {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(201, 48, 44, 0.3), transparent);
}

/* Quick Links */
.header-quick-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.quick-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.quick-link-btn.primary {
    background: linear-gradient(135deg, #c9302c 0%, #a82828 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(201, 48, 44, 0.3);
}

.quick-link-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 48, 44, 0.4);
}

.quick-link-btn.secondary {
    background: white;
    color: #c9302c;
    border: 2px solid rgba(201, 48, 44, 0.2);
}

.quick-link-btn.secondary:hover {
    background: rgba(201, 48, 44, 0.05);
    border-color: #c9302c;
}

/* ========================================
   AVAILABILITY BADGE STYLES
======================================== */
/* Language Badge (Top Right) */
.language-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(201, 48, 44, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Availability Badge (Bottom Right) */
.availability-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 5;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.availability-badge.available {
    background: rgba(92, 184, 92, 0.9);
    color: white;
}

.availability-badge.limited {
    background: rgba(240, 173, 78, 0.9);
    color: white;
}

.availability-badge.borrowed {
    background: rgba(217, 83, 79, 0.9);
    color: white;
}

.availability-badge.maintenance {
    background: rgba(119, 119, 119, 0.9);
    color: white;
}

/* ========================================
   LOAN BUTTON STYLES
======================================== */
.btn-loan-main {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    white-space: nowrap;
    background: linear-gradient(135deg, #5cb85c 0%, #449d44 100%);
    color: white;
}

.btn-loan-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92, 184, 92, 0.4);
    color: white;
}

.btn-unavailable {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    white-space: nowrap;
    background: var(--bg-primary, #fff);
    color: var(--text-secondary, #999);
    border: 2px solid var(--border-color, #ddd);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   LOAN INFO SECTION
======================================== */
.loan-info-section {
    padding: 5rem 0;
    background: var(--bg-secondary, #f8f9fa);
}

.loan-info-wrapper {
    background: white;
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .loan-info-wrapper {
    background: var(--bg-primary, #1a1a2e);
}

.loan-info-header {
    text-align: center;
    margin-bottom: 3rem;
}

.loan-info-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.loan-info-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary, #333);
    margin: 0;
}

.loan-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.loan-info-card {
    padding: 2rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 16px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .loan-info-card {
    background: rgba(255, 255, 255, 0.05);
}

.loan-info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.info-card-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.loan-info-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #333);
    margin-bottom: 1rem;
}

.loan-info-card ol,
.loan-info-card ul {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-secondary, #666);
    line-height: 1.8;
}

.loan-info-card li {
    margin-bottom: 0.5rem;
}

.loan-cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-cta-loan {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-cta-loan.primary {
    background: linear-gradient(135deg, #c9302c 0%, #a82828 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(201, 48, 44, 0.3);
}

.btn-cta-loan.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(201, 48, 44, 0.4);
}

.btn-cta-loan.secondary {
    background: white;
    color: #c9302c;
    border: 2px solid #c9302c;
}

.btn-cta-loan.secondary:hover {
    background: #c9302c;
    color: white;
}

/* ========================================
   FILTER SECTION
======================================== */
.modern-filter-section {
    padding: 3rem 0;
    background: var(--bg-secondary, #f8f9fa);
    position: relative;
    z-index: 10;
}

.filter-container {
    background: var(--bg-primary, #fff);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.filter-search-wrapper {
    margin-bottom: 2rem;
}

.search-input-group {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #666);
    font-size: 1.125rem;
}

.modern-search-input {
    width: 100%;
    padding: 1rem 3.5rem;
    font-size: 1rem;
    color: var(--text-primary, #333);
    background: var(--bg-secondary, #f8f9fa);
    border: 2px solid transparent;
    border-radius: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.modern-search-input:focus {
    background: var(--bg-primary, #fff);
    border-color: #c9302c;
    box-shadow: 0 0 0 4px rgba(201, 48, 44, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0.5rem;
}

/* Filter Controls */
.filter-control-group {
    margin-bottom: 1.5rem;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary, #1e293b);
    margin-bottom: 0.875rem;
}

.control-label i {
    color: #c9302c;
    font-size: 0.9375rem;
}

.category-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    padding: 0.5rem 0;
}

.chip-button {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.chip-button:hover {
    border-color: #c9302c;
    color: #c9302c;
    background: #fef2f2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 48, 44, 0.12);
}

.chip-button:active {
    transform: translateY(0);
}

.chip-button.active {
    background: linear-gradient(135deg, #c9302c 0%, #dc2626 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(201, 48, 44, 0.35);
    font-weight: 600;
}

.chip-button.active:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #c9302c 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(201, 48, 44, 0.4);
}

.chip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    background: #f1f5f9;
    border-radius: 6px;
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0;
}

.chip-button:hover .chip-badge {
    background: rgba(201, 48, 44, 0.12);
    color: #c9302c;
}

.chip-button.active .chip-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Dark mode support */
[data-theme="dark"] .chip-button {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .chip-button:hover {
    background: #2d1b1b;
    border-color: #c9302c;
    color: #fca5a5;
}

[data-theme="dark"] .chip-badge {
    background: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .chip-button:hover .chip-badge {
    background: rgba(201, 48, 44, 0.2);
    color: #fca5a5;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-select-wrapper {
    flex: 1;
    min-width: 150px;
}

.select-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin-bottom: 0.5rem;
}

.modern-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary, #333);
    background: var(--bg-secondary, #f8f9fa);
    border: 2px solid transparent;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modern-select:focus {
    border-color: #c9302c;
    box-shadow: 0 0 0 3px rgba(201, 48, 44, 0.1);
}

.reset-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-filters-btn:hover {
    background: #c9302c;
    border-color: #c9302c;
    color: white;
}

/* ========================================
   EBOOK GRID & CARDS
======================================== */
.ebook-section {
    padding: 3rem 0 5rem;
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 16px;
}

.results-text {
    font-size: 1rem;
    color: var(--text-secondary, #666);
}

.results-text strong {
    color: var(--primary-color, #c9302c);
    font-weight: 700;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-primary, #fff);
    padding: 0.25rem;
    border-radius: 12px;
}

.view-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: rgba(201, 48, 44, 0.1);
    color: var(--primary-color, #c9302c);
}

.view-btn.active {
    background: var(--primary-color, #c9302c);
    color: white;
}

.ebook-grid {
    display: grid;
    gap: 2rem;
}

.ebook-grid.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.ebook-grid.list-view {
    grid-template-columns: 1fr;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* List View Specific Styles */
.ebook-grid.list-view .modern-ebook-card {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 1fr auto;
    min-height: 280px;
    max-height: 320px;
}

.ebook-grid.list-view .ebook-card-cover {
    grid-column: 1;
    grid-row: 1 / 3;
    aspect-ratio: auto;
    max-height: 320px;
    overflow: hidden;
}

.ebook-grid.list-view .cover-wrapper {
    height: 100%;
    max-height: 320px;
}

.ebook-grid.list-view .cover-wrapper img {
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* List view badge positioning - stack vertically */
.ebook-grid.list-view .category-badge {
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    max-width: calc(100% - 1.5rem);
}

.ebook-grid.list-view .language-badge {
    top: auto;
    bottom: auto;
    top: 0.75rem;
    right: 0.75rem;
    left: auto;
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
}

.ebook-grid.list-view .availability-badge {
    bottom: 0.75rem;
    left: 0.75rem;
    right: auto;
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
}

.ebook-grid.list-view .ebook-card-body {
    grid-column: 2;
    grid-row: 1;
    min-height: auto;
    padding: 1.25rem 1.5rem 1rem;
}

.ebook-grid.list-view .ebook-card-footer {
    grid-column: 2;
    grid-row: 2;
    padding: 0.75rem 1.5rem;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ebook-grid.list-view .footer-info {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
}

.ebook-grid.list-view .isbn-info,
.ebook-grid.list-view .file-size,
.ebook-grid.list-view .book-location {
    white-space: nowrap;
}

.ebook-grid.list-view .ebook-title {
    min-height: auto;
    -webkit-line-clamp: 1;
    margin-bottom: 0.5rem;
}

.ebook-grid.list-view .author-info {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.875rem;
    min-height: auto;
}

.ebook-grid.list-view .ebook-excerpt {
    min-height: auto;
    -webkit-line-clamp: 2;
    margin-bottom: 0.75rem;
}

.ebook-grid.list-view .ebook-meta {
    padding-top: 0.75rem;
    gap: 0.375rem;
}

.ebook-grid.list-view .action-buttons {
    flex-shrink: 0;
}

.ebook-grid.list-view .btn-loan-main,
.ebook-grid.list-view .btn-unavailable {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.modern-ebook-card {
    background: var(--bg-primary, #fff);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(201, 48, 44, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.modern-ebook-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(201, 48, 44, 0.2);
}

.ebook-card-cover {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--bg-secondary, #f8f9fa);
}

.cover-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
}

[data-theme="dark"] .cover-wrapper {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.modern-ebook-card:hover .cover-wrapper img {
    transform: scale(1.05);
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modern-ebook-card:hover .cover-overlay {
    opacity: 1;
}

.overlay-actions {
    display: flex;
    gap: 1rem;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modern-ebook-card:hover .overlay-actions {
    transform: translateY(0);
}

.action-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: var(--primary-color, #c9302c);
    font-size: 1.125rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.action-icon:hover {
    transform: scale(1.1);
    background: var(--primary-color, #c9302c);
    color: white;
}

.action-icon.preview-btn:hover {
    background: #5bc0de;
    color: white;
}

.action-icon.detail-btn:hover {
    background: #f39c12;
    color: white;
}

.action-icon.loan-btn {
    background: rgba(92, 184, 92, 0.95);
    color: white;
}

.action-icon.loan-btn:hover {
    background: #449d44;
    transform: scale(1.1);
}

.category-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color, #c9302c);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.ebook-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.ebook-title {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ebook-title a {
    color: var(--text-primary, #333);
    text-decoration: none;
    transition: color 0.3s ease;
}

.ebook-title a:hover {
    color: #c9302c;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, rgba(201, 48, 44, 0.08) 0%, rgba(243, 156, 18, 0.08) 100%);
    border-left: 3px solid var(--primary-color, #c9302c);
    border-radius: 8px;
    margin-bottom: 0.875rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    min-height: 44px;
}

.author-info i {
    color: var(--primary-color, #c9302c);
}

.ebook-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
    line-height: 1.6;
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 4.2em;
}

.ebook-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    color: var(--text-secondary, #666);
    padding: 0.25rem 0;
}

.meta-item i {
    color: var(--primary-color, #c9302c);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.ebook-card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary, #f8f9fa);
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    min-height: 80px;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.isbn-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.isbn-info i,
.file-size i,
.book-location i {
    color: var(--primary-color, #c9302c);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.file-size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
}

.book-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #666);
    font-weight: 600;
}

/* No Results */
.no-ebook-found,
.no-results-message {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(201, 48, 44, 0.1) 0%, rgba(243, 156, 18, 0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #c9302c;
}

.no-results-message h3,
.no-ebook-found h3 {
    font-size: 1.5rem;
    color: var(--text-primary, #333);
    margin-bottom: 0.5rem;
}

.no-results-message p,
.no-ebook-found p {
    color: var(--text-secondary, #666);
    margin-bottom: 1.5rem;
}

.btn-reset-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #c9302c 0%, #f39c12 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset-inline:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 48, 44, 0.3);
}

/* ========================================
   RESPONSIVE - TABLET LANDSCAPE (1024px)
======================================== */
@media (max-width: 1024px) {
    /* Header Optimizations */
    .modern-ebook-header {
        padding: 100px 0 60px;
    }
    
    .header-icon-badge {
        width: 70px;
        height: 70px;
        border-radius: 20px;
        font-size: 1.75rem;
    }
    
    .header-quick-stats {
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Filter Optimizations */
    .filter-container {
        padding: 1.5rem;
    }
    
    .filters-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .reset-filters-btn {
        grid-column: 1 / -1;
    }
    
    /* Category Chips - Horizontal Scroll */
    .category-chips-container {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.5rem;
        margin: 0 -0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .category-chips-container::-webkit-scrollbar {
        display: none;
    }
    
    .chip-button {
        flex-shrink: 0;
        scroll-snap-align: start;
    }
    
    /* Grid View */
    .ebook-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    /* List view tablet adjustments */
    .ebook-grid.list-view .modern-ebook-card {
        grid-template-columns: 180px 1fr;
        min-height: 260px;
        max-height: 300px;
    }
    
    .ebook-grid.list-view .category-badge,
    .ebook-grid.list-view .language-badge {
        padding: 0.3rem 0.625rem;
        font-size: 0.625rem;
    }
    
    .ebook-grid.list-view .category-badge {
        top: 0.5rem;
        left: 0.5rem;
    }
    
    .ebook-grid.list-view .language-badge {
        top: 2.25rem;
        left: 0.5rem;
        right: auto;
    }
    
    .ebook-grid.list-view .availability-badge {
        bottom: 0.5rem;
        left: 0.5rem;
        right: auto;
    }
    
    /* List view footer for tablet */
    .ebook-grid.list-view .ebook-card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .ebook-grid.list-view .footer-info {
        flex-direction: column;
        gap: 0.375rem;
        align-items: flex-start;
    }
    
    .ebook-grid.list-view .action-buttons {
        width: 100%;
    }
    
    .ebook-grid.list-view .btn-loan-main,
    .ebook-grid.list-view .btn-unavailable {
        width: 100%;
        justify-content: center;
    }
    
    /* Card Body Optimization */
    .ebook-card-body {
        padding: 1.25rem;
        min-height: 260px;
    }
    
    .ebook-title {
        font-size: 1rem;
    }
    
    /* Loan Info Section */
    .loan-info-wrapper {
        padding: 2rem;
    }
    
    .loan-info-grid {
        gap: 1.5rem;
    }
}

/* ========================================
   RESPONSIVE - TABLET PORTRAIT (768px)
======================================== */
@media (max-width: 768px) {
    /* Header Compact */
    .modern-ebook-header {
        padding: 90px 0 50px;
    }
    
    .header-icon-badge {
        width: 60px;
        height: 60px;
        border-radius: 16px;
        font-size: 1.5rem;
        box-shadow: 
            0 8px 20px rgba(201, 48, 44, 0.2),
            0 0 0 5px rgba(201, 48, 44, 0.1);
    }
    
    .modern-page-description {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .header-breadcrumb {
        padding: 0.4rem 1rem;
        font-size: 0.8125rem;
        margin-bottom: 1.5rem;
    }
    
    /* Quick Stats - Compact Horizontal */
    .header-quick-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        padding: 1.25rem;
        border-radius: 16px;
        margin-bottom: 1.25rem;
    }
    
    .quick-stat-card {
        flex: 1 1 calc(50% - 1rem);
        min-width: 140px;
        max-width: 180px;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.5);
        border-radius: 12px;
        gap: 0.75rem;
    }
    
    [data-theme="dark"] .quick-stat-card {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .stat-icon-mini {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .quick-stat-divider {
        display: none;
    }
    
    /* Quick Links - Stack */
    .header-quick-links {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .quick-link-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    /* Filter Section */
    .modern-filter-section {
        padding: 2rem 0;
    }
    
    .filter-container {
        padding: 1.25rem;
        border-radius: 20px;
    }
    
    .search-input-group {
        max-width: 100%;
    }
    
    .modern-search-input {
        padding: 0.875rem 3rem;
        font-size: 0.9375rem;
        border-radius: 14px;
    }
    
    .filter-search-wrapper {
        margin-bottom: 1.5rem;
    }
    
    /* Filters Row - Single Column */
    .filters-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .filter-select-wrapper {
        width: 100%;
        min-width: unset;
    }
    
    .modern-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
        border-radius: 10px;
    }
    
    .select-label {
        font-size: 0.75rem;
        margin-bottom: 0.375rem;
    }
    
    .reset-filters-btn {
        grid-column: 1 / -1;
        padding: 0.625rem 1rem;
        border-radius: 10px;
        font-size: 0.875rem;
    }
    
    /* Grid View - 2 Columns */
    .ebook-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Results Info */
    .results-info {
        flex-direction: row;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.875rem 1rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }
    
    .results-text {
        font-size: 0.875rem;
    }
    
    .view-toggle {
        padding: 0.2rem;
        border-radius: 10px;
    }
    
    .view-btn {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }
    
    /* List View Mobile */
    .ebook-grid.list-view .modern-ebook-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        max-height: none;
        min-height: auto;
    }
    
    .ebook-grid.list-view .ebook-card-cover {
        grid-column: 1;
        grid-row: 1;
        aspect-ratio: 3/4;
        max-height: 320px;
    }
    
    .ebook-grid.list-view .ebook-card-body {
        grid-column: 1;
        grid-row: 2;
        min-height: auto;
        padding: 1.25rem;
    }
    
    .ebook-grid.list-view .ebook-card-footer {
        grid-column: 1;
        grid-row: 3;
    }
    
    /* Reset badge positions for mobile list view */
    .ebook-grid.list-view .category-badge {
        top: 0.875rem;
        left: 0.875rem;
        padding: 0.4rem 0.875rem;
        font-size: 0.6875rem;
        max-width: none;
    }
    
    .ebook-grid.list-view .language-badge {
        top: 0.875rem;
        right: 0.875rem;
        left: auto;
        padding: 0.4rem 0.875rem;
        font-size: 0.6875rem;
    }
    
    .ebook-grid.list-view .availability-badge {
        bottom: 0.875rem;
        right: 0.875rem;
        left: auto;
        padding: 0.375rem 0.75rem;
        font-size: 0.6875rem;
    }
    
    .ebook-grid.list-view .ebook-title {
        min-height: 2.6em;
        -webkit-line-clamp: 2;
    }
    
    .ebook-grid.list-view .ebook-excerpt {
        min-height: 3.6em;
        -webkit-line-clamp: 2;
    }
    
    /* Reset footer layout for mobile list view */
    .ebook-grid.list-view .ebook-card-footer {
        display: grid;
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .ebook-grid.list-view .footer-info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        align-items: center;
        margin-bottom: 0.75rem;
    }
    
    /* Grid View Card Footer */
    .ebook-card-footer {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .footer-info {
        width: 100%;
        order: 1;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.375rem 1rem;
    }
    
    .action-buttons {
        width: 100%;
        order: 2;
    }
    
    .btn-loan-main,
    .btn-unavailable {
        flex: 1;
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
    }
    
    /* Card Body */
    .ebook-card-body {
        padding: 1.125rem;
        min-height: 240px;
    }
    
    .ebook-title {
        font-size: 0.9375rem;
        margin-bottom: 0.625rem;
        min-height: 2.6em;
    }
    
    .author-info {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
        min-height: 40px;
    }
    
    .ebook-excerpt {
        font-size: 0.8125rem;
        margin-bottom: 1rem;
        min-height: 3.6em;
        -webkit-line-clamp: 2;
    }
    
    .ebook-meta {
        gap: 0.375rem;
        padding-top: 0.875rem;
    }
    
    .meta-item {
        font-size: 0.75rem;
        padding: 0.2rem 0;
    }
    
    /* Category & Language Badge */
    .category-badge {
        padding: 0.375rem 0.75rem;
        font-size: 0.6875rem;
        border-radius: 25px;
    }
    
    .language-badge {
        padding: 0.375rem 0.75rem;
        font-size: 0.6875rem;
        border-radius: 25px;
    }
    
    .availability-badge {
        padding: 0.3rem 0.625rem;
        font-size: 0.6875rem;
        border-radius: 16px;
    }
    
    /* Loan Info Section */
    .loan-info-section {
        padding: 3rem 0;
    }
    
    .loan-info-wrapper {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .loan-info-header {
        margin-bottom: 2rem;
    }
    
    .loan-info-icon {
        width: 56px;
        height: 56px;
        border-radius: 16px;
        font-size: 1.5rem;
    }
    
    .loan-info-header h2 {
        font-size: 1.5rem;
    }
    
    .loan-info-grid {
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .loan-info-card {
        padding: 1.25rem;
        border-radius: 14px;
    }
    
    .info-card-icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        font-size: 1.125rem;
    }
    
    .loan-info-card h3 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .loan-info-card ol,
    .loan-info-card ul {
        font-size: 0.875rem;
        line-height: 1.7;
    }
    
    .loan-cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-cta-loan {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
    }
    
    /* Hover State Disabled on Touch */
    @media (hover: none) {
        .modern-ebook-card:hover {
            transform: none;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        }
        
        .cover-overlay {
            opacity: 0 !important;
        }
    }
}

/* ========================================
   RESPONSIVE - MOBILE (480px)
======================================== */
@media (max-width: 480px) {
    /* Header Extra Compact */
    .modern-ebook-header {
        padding: 80px 0 40px;
    }
    
    .header-breadcrumb {
        padding: 0.35rem 0.875rem;
        font-size: 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .header-icon-badge {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        font-size: 1.25rem;
        margin-bottom: 1rem;
        box-shadow: 
            0 6px 16px rgba(201, 48, 44, 0.2),
            0 0 0 4px rgba(201, 48, 44, 0.1);
    }
    
    .modern-page-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }
    
    .modern-page-description {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
    
    .header-main-content {
        margin-bottom: 1.5rem;
    }
    
    /* Quick Stats - Compact Grid */
    .header-quick-stats {
        padding: 1rem;
        gap: 0.625rem;
        border-radius: 14px;
        margin-bottom: 1rem;
    }
    
    .quick-stat-card {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 130px;
        padding: 0.625rem;
        gap: 0.5rem;
    }
    
    .stat-icon-mini {
        width: 36px;
        height: 36px;
        border-radius: 9px;
        font-size: 0.9375rem;
    }
    
    .stat-value {
        font-size: 1.125rem;
    }
    
    .stat-label {
        font-size: 0.6875rem;
        letter-spacing: 0.25px;
    }
    
    /* Quick Links */
    .header-quick-links {
        gap: 0.625rem;
    }
    
    .quick-link-btn {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        border-radius: 10px;
    }
    
    /* Filter Section */
    .modern-filter-section {
        padding: 1.5rem 0;
    }
    
    .filter-container {
        padding: 1rem;
        border-radius: 16px;
    }
    
    .filter-search-wrapper {
        margin-bottom: 1.25rem;
    }
    
    .modern-search-input {
        padding: 0.75rem 2.75rem;
        font-size: 0.875rem;
        border-radius: 12px;
    }
    
    .search-icon {
        left: 1rem;
        font-size: 1rem;
    }
    
    /* Category Chips - Horizontal Scroll */
    .category-chips-container {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .chip-button {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
        border-radius: 8px;
        gap: 0.5rem;
    }
    
    .chip-badge {
        min-width: 1.25rem;
        height: 1.25rem;
        padding: 0 0.375rem;
        font-size: 0.625rem;
        border-radius: 5px;
    }
    
    .control-label {
        font-size: 0.8125rem;
        margin-bottom: 0.625rem;
    }
    
    /* Filters Row - Full Width */
    .filters-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .select-label {
        font-size: 0.6875rem;
    }
    
    .modern-select {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .reset-filters-btn {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }
    
    /* Ebook Section */
    .ebook-section {
        padding: 2rem 0 3rem;
    }
    
    /* Results Info */
    .results-info {
        padding: 0.75rem;
        border-radius: 10px;
        margin-bottom: 1.25rem;
    }
    
    .results-text {
        font-size: 0.8125rem;
    }
    
    .view-btn {
        width: 34px;
        height: 34px;
        border-radius: 7px;
    }
    
    /* Grid View - Single Column */
    .ebook-grid.grid-view {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Card Styling */
    .modern-ebook-card {
        border-radius: 16px;
    }
    
    .ebook-card-cover {
        border-radius: 16px 16px 0 0;
    }
    
    /* Badges Compact */
    .category-badge {
        top: 0.75rem;
        left: 0.75rem;
        padding: 0.35rem 0.625rem;
        font-size: 0.625rem;
        border-radius: 20px;
        gap: 0.375rem;
    }
    
    .language-badge {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.35rem 0.625rem;
        font-size: 0.625rem;
        border-radius: 20px;
        gap: 0.375rem;
    }
    
    .availability-badge {
        bottom: 0.75rem;
        right: 0.75rem;
        padding: 0.3rem 0.5rem;
        font-size: 0.625rem;
        border-radius: 14px;
        gap: 0.25rem;
    }
    
    /* Overlay Actions */
    .overlay-actions {
        gap: 0.625rem;
    }
    
    .action-icon {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
    
    /* Card Body Compact */
    .ebook-card-body {
        padding: 1rem;
        min-height: 220px;
    }
    
    .ebook-title {
        font-size: 0.9375rem;
        margin-bottom: 0.5rem;
        min-height: 2.4em;
        line-height: 1.35;
    }
    
    .author-info {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
        margin-bottom: 0.625rem;
        min-height: 36px;
        gap: 0.5rem;
        border-radius: 6px;
    }
    
    .ebook-excerpt {
        font-size: 0.8125rem;
        line-height: 1.5;
        margin-bottom: 0.875rem;
        min-height: 3.2em;
        -webkit-line-clamp: 2;
    }
    
    .ebook-meta {
        gap: 0.25rem;
        padding-top: 0.75rem;
    }
    
    .meta-item {
        font-size: 0.6875rem;
        gap: 0.5rem;
        padding: 0.15rem 0;
    }
    
    .meta-item i {
        width: 14px;
        font-size: 0.75rem;
    }
    
    /* Card Footer */
    .ebook-card-footer {
        padding: 0.875rem;
        gap: 0.625rem;
        border-radius: 0 0 16px 16px;
    }
    
    .footer-info {
        gap: 0.25rem 0.75rem;
    }
    
    .isbn-info,
    .file-size,
    .book-location {
        font-size: 0.6875rem;
        gap: 0.375rem;
    }
    
    .isbn-info i,
    .file-size i,
    .book-location i {
        width: 12px;
        font-size: 0.6875rem;
    }
    
    .btn-loan-main,
    .btn-unavailable {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
        border-radius: 8px;
    }
    
    /* No Results */
    .no-ebook-found,
    .no-results-message {
        padding: 2.5rem 1.5rem;
    }
    
    .empty-state-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
        margin-bottom: 1.25rem;
    }
    
    .no-results-message h3,
    .no-ebook-found h3 {
        font-size: 1.25rem;
    }
    
    .no-results-message p,
    .no-ebook-found p {
        font-size: 0.875rem;
    }
    
    .btn-reset-inline {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
    
    /* Loan Info Section */
    .loan-info-section {
        padding: 2.5rem 0;
    }
    
    .loan-info-wrapper {
        padding: 1.25rem;
        border-radius: 16px;
    }
    
    .loan-info-header {
        margin-bottom: 1.5rem;
    }
    
    .loan-info-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .loan-info-header h2 {
        font-size: 1.25rem;
    }
    
    .loan-info-grid {
        gap: 0.875rem;
        margin-bottom: 1.5rem;
    }
    
    .loan-info-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .info-card-icon {
        width: 40px;
        height: 40px;
        border-radius: 9px;
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .loan-info-card h3 {
        font-size: 1rem;
        margin-bottom: 0.625rem;
    }
    
    .loan-info-card ol,
    .loan-info-card ul {
        font-size: 0.8125rem;
        line-height: 1.6;
        padding-left: 1rem;
    }
    
    .loan-info-card li {
        margin-bottom: 0.375rem;
    }
    
    .loan-cta-buttons {
        gap: 0.625rem;
    }
    
    .btn-cta-loan {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
        border-radius: 10px;
    }
}

/* ========================================
   RESPONSIVE - EXTRA SMALL MOBILE (360px)
======================================== */
@media (max-width: 360px) {
    .modern-ebook-header {
        padding: 75px 0 35px;
    }
    
    .header-icon-badge {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        font-size: 1.125rem;
    }
    
    .modern-page-title {
        font-size: 1.5rem;
    }
    
    .modern-page-description {
        font-size: 0.875rem;
    }
    
    .header-quick-stats {
        padding: 0.875rem;
        gap: 0.5rem;
    }
    
    .quick-stat-card {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 115px;
        padding: 0.5rem;
    }
    
    .stat-icon-mini {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 0.875rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.625rem;
    }
    
    .quick-link-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }
    
    .filter-container {
        padding: 0.875rem;
    }
    
    .modern-search-input {
        padding: 0.625rem 2.5rem;
        font-size: 0.8125rem;
    }
    
    .chip-button {
        padding: 0.35rem 0.625rem;
        font-size: 0.6875rem;
    }
    
    .chip-badge {
        min-width: 1.125rem;
        height: 1.125rem;
        font-size: 0.5625rem;
    }
    
    .ebook-card-body {
        padding: 0.875rem;
        min-height: 200px;
    }
    
    .ebook-title {
        font-size: 0.875rem;
        min-height: 2.2em;
    }
    
    .author-info {
        padding: 0.4rem 0.5rem;
        font-size: 0.6875rem;
        min-height: 32px;
    }
    
    .ebook-excerpt {
        font-size: 0.75rem;
        min-height: 2.8em;
    }
    
    .meta-item {
        font-size: 0.625rem;
    }
    
    .ebook-card-footer {
        padding: 0.75rem;
    }
    
    .isbn-info,
    .file-size,
    .book-location {
        font-size: 0.625rem;
    }
    
    .btn-loan-main,
    .btn-unavailable {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .loan-info-wrapper {
        padding: 1rem;
    }
    
    .loan-info-card {
        padding: 0.875rem;
    }
    
    .loan-info-card h3 {
        font-size: 0.9375rem;
    }
    
    .loan-info-card ol,
    .loan-info-card ul {
        font-size: 0.75rem;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
======================================== */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .modern-ebook-card:hover {
        transform: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }
    
    .modern-ebook-card:hover .cover-wrapper img {
        transform: none;
    }
    
    .cover-overlay {
        display: none;
    }
    
    .chip-button:hover {
        transform: none;
    }
    
    .quick-link-btn:hover {
        transform: none;
    }
    
    /* Better tap targets */
    .chip-button,
    .view-btn,
    .modern-select,
    .btn-loan-main,
    .btn-unavailable,
    .reset-filters-btn,
    .quick-link-btn,
    .btn-cta-loan {
        min-height: 44px;
    }
    
    /* Active states for touch */
    .chip-button:active {
        background: linear-gradient(135deg, #c9302c 0%, #dc2626 100%);
        color: white;
    }
    
    .btn-loan-main:active {
        transform: scale(0.98);
    }
    
    .modern-ebook-card:active {
        transform: scale(0.99);
    }
}

/* ========================================
   LANDSCAPE MOBILE
======================================== */
@media (max-width: 768px) and (orientation: landscape) {
    .modern-ebook-header {
        padding: 80px 0 40px;
    }
    
    .header-quick-stats {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .quick-stat-card {
        flex: 1;
        min-width: auto;
    }
    
    .ebook-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ebook-card-cover {
        aspect-ratio: 4/5;
    }
    
    .loan-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   SAFE AREA (NOTCH) SUPPORT
======================================== */
@supports (padding: max(0px)) {
    .modern-ebook-header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .filter-container,
    .loan-info-wrapper {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Performance Optimizations */
.modern-ebook-card,
.btn-loan-main,
.btn-unavailable,
.action-icon {
    will-change: transform;
}

/* Smooth scrolling for filter chips */
.category-chips-container {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .modern-ebook-card:hover {
        transform: none;
    }
}