/**
 * E-Books A-Z Page Styles
 * Comprehensive styling for digital books collection page
 */

/* CSS Custom Properties for E-Books Theme */
:root {
    --eb-primary: #ffc107;
    --eb-primary-dark: #f39c12;
    --eb-secondary: #6c757d;
    --eb-accent: #17a2b8;
    --eb-success: #28a745;
    --eb-warning: #ffc107;
    --eb-danger: #dc3545;
    --eb-light: #f8f9fa;
    --eb-dark: #343a40;
    --eb-gradient: linear-gradient(135deg, var(--eb-primary) 0%, var(--eb-primary-dark) 100%);
    --eb-shadow: 0 4px 15px rgba(255, 193, 7, 0.15);
    --eb-shadow-hover: 0 8px 25px rgba(255, 193, 7, 0.25);
    --eb-border-radius: 12px;
    --eb-transition: all 0.3s ease;
}

/* Page Hero Section */
.page-hero {
    position: relative;
    height: 60vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin-top: 180px; /* Account for fixed header */
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.5);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--eb-gradient);
    opacity: 0.85;
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
}

.hero-content .breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
    border: none;
}

.hero-content .breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: rgba(255, 255, 255, 0.8);
}

.hero-content .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--eb-transition);
}

.hero-content .breadcrumb-item a:hover {
    color: white;
}

.hero-content .breadcrumb-item.active {
    color: white;
}

/* Statistics Section */
.stats-section {
    background: var(--eb-gradient);
    position: relative;
    overflow: hidden;
}

.stats-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="books-grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23books-grid)"/></svg>');
    opacity: 0.3;
}

.stat-item {
    text-align: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Filter Section */
.filter-section {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.search-box .form-control {
    border: 2px solid #e9ecef;
    border-radius: 8px 0 0 8px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: var(--eb-transition);
}

.search-box .form-control:focus {
    border-color: var(--eb-primary);
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

.search-box .btn {
    border-radius: 0 8px 8px 0;
    border: 2px solid var(--eb-primary);
    padding: 12px 20px;
}

.form-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: var(--eb-transition);
}

.form-select:focus {
    border-color: var(--eb-primary);
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
}

/* Alphabet Navigation */
.alphabet-nav {
    padding: 20px 0;
}

.alphabet-btn {
    border: 2px solid #e9ecef;
    color: var(--eb-secondary);
    padding: 8px 12px;
    margin: 4px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--eb-transition);
    min-width: 40px;
}

.alphabet-btn:hover {
    border-color: var(--eb-primary);
    color: var(--eb-primary);
    transform: translateY(-2px);
}

.alphabet-btn.active {
    background: var(--eb-gradient);
    border-color: var(--eb-primary);
    color: white;
    transform: translateY(-2px);
}

/* View Controls */
.view-controls {
    background: white;
    padding: 20px;
    border-radius: var(--eb-border-radius);
    box-shadow: var(--eb-shadow);
    margin-bottom: 2rem;
}

.results-info {
    color: var(--eb-secondary);
    font-size: 1rem;
}

.view-options .btn-group .btn {
    border: 2px solid var(--eb-primary);
    color: var(--eb-primary);
    padding: 8px 16px;
    transition: var(--eb-transition);
}

.view-options .btn-group .btn.active {
    background: var(--eb-gradient);
    color: white;
}

.view-options .form-select {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Book Items */
.book-item {
    background: white;
    border-radius: var(--eb-border-radius);
    box-shadow: var(--eb-shadow);
    transition: var(--eb-transition);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid #f8f9fa;
}

.book-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--eb-shadow-hover);
}

/* List View */
.book-item.list-view {
    display: flex;
    align-items: flex-start;
    padding: 24px;
    gap: 24px;
}

.book-item.list-view .book-cover {
    flex-shrink: 0;
    width: 120px;
    height: 160px;
    position: relative;
}

.book-item.list-view .book-info {
    flex: 1;
    min-width: 0;
}

.book-item.list-view .book-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 180px;
}

/* Grid View */
.book-item.grid-view {
    display: flex;
    flex-direction: column;
    padding: 20px;
    text-align: center;
    max-width: 300px;
    margin: 0 auto 24px;
}

.book-item.grid-view .book-cover {
    width: 100px;
    height: 140px;
    margin: 0 auto 16px;
    position: relative;
}

.book-item.grid-view .book-info {
    flex: 1;
    margin-bottom: 16px;
}

.book-item.grid-view .book-actions {
    display: flex;
    gap: 8px;
}

/* Book Cover */
.cover-placeholder {
    width: 100%;
    height: 100%;
    background: var(--eb-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.format-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Book Information */
.book-title {
    color: var(--eb-dark);
    font-weight: 600;
    font-size: 1.4rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--eb-secondary);
}

.book-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.book-meta i {
    color: var(--eb-primary);
    width: 16px;
    text-align: center;
}

.book-description {
    color: var(--eb-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.book-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.book-subjects span {
    background: #f8f9fa;
    color: var(--eb-secondary);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid #e9ecef;
    transition: var(--eb-transition);
}

.book-subjects span:hover {
    background: var(--eb-primary);
    color: white;
    border-color: var(--eb-primary);
}

.book-stats {
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.book-stats .stat {
    text-align: center;
}

.book-stats .stat strong {
    display: block;
    font-size: 1.2rem;
    color: var(--eb-primary);
    font-weight: 700;
}

.book-stats .stat span {
    font-size: 0.8rem;
    color: var(--eb-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Book Actions */
.book-actions .btn {
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--eb-transition);
    flex: 1;
}

.book-actions .btn-warning {
    background: var(--eb-gradient);
    border: none;
    color: white;
}

.book-actions .btn-outline-warning {
    border-color: var(--eb-primary);
    color: var(--eb-primary);
}

.book-actions .btn-outline-warning:hover {
    background: var(--eb-primary);
    border-color: var(--eb-primary);
    color: white;
}

.book-actions .btn-outline-secondary {
    border-color: var(--eb-secondary);
    color: var(--eb-secondary);
}

.book-actions .btn-outline-secondary:hover {
    background: var(--eb-secondary);
    border-color: var(--eb-secondary);
    color: white;
}

/* Pagination */
.pagination-container {
    margin-top: 3rem;
}

.pagination .page-link {
    border: 2px solid #e9ecef;
    color: var(--eb-primary);
    padding: 12px 16px;
    margin: 0 4px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--eb-transition);
}

.pagination .page-link:hover {
    background: var(--eb-primary);
    border-color: var(--eb-primary);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: var(--eb-gradient);
    border-color: var(--eb-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--eb-shadow-hover);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
}

/* Modal Styles */
.modal-content {
    border-radius: var(--eb-border-radius);
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: var(--eb-gradient);
    color: white;
    border-radius: var(--eb-border-radius) var(--eb-border-radius) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

.book-cover-large {
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
}

.book-cover-large .cover-placeholder {
    height: 100%;
    font-size: 3rem;
}

.book-details-meta p {
    margin-bottom: 8px;
    color: var(--eb-secondary);
}

.book-details-meta strong {
    color: var(--eb-dark);
    font-weight: 600;
}

.book-description-full h6,
.book-table-contents h6 {
    color: var(--eb-dark);
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 20px;
}

.book-table-contents ul {
    color: var(--eb-secondary);
    padding-left: 20px;
}

.book-table-contents li {
    margin-bottom: 4px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .book-item.list-view .book-actions {
        width: 140px;
    }
    
    .book-item.list-view .book-actions .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .page-hero {
        height: 50vh;
        min-height: 400px;
    }
    
    .hero-content .display-4 {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .book-item.list-view {
        flex-direction: column;
        text-align: center;
    }
    
    .book-item.list-view .book-cover {
        width: 100px;
        height: 140px;
        margin: 0 auto 16px;
    }
    
    .book-item.list-view .book-actions {
        width: 100%;
        flex-direction: row;
        gap: 8px;
    }
    
    .book-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .view-controls {
        text-align: center;
    }
    
    .view-controls .d-flex {
        flex-direction: column;
        gap: 16px;
        align-items: center !important;
    }
    
    .alphabet-nav .d-flex {
        justify-content: center !important;
    }
    
    .filter-section .row > div {
        margin-bottom: 12px;
    }
}

@media (max-width: 576px) {
    .hero-content .display-4 {
        font-size: 1.75rem;
    }
    
    .hero-content .lead {
        font-size: 1rem;
    }
    
    .book-item {
        margin-bottom: 20px;
    }
    
    .book-title {
        font-size: 1.2rem;
    }
    
    .book-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .book-actions {
        flex-direction: column !important;
    }
    
    .alphabet-btn {
        min-width: 35px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .stats-section .row > div {
        margin-bottom: 20px;
    }
}

/* Print Styles */
@media print {
    .page-hero,
    .filter-section,
    .view-controls,
    .book-actions,
    .pagination-container,
    .alphabet-nav {
        display: none !important;
    }
    
    .book-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }
    
    .book-item.list-view {
        padding: 16px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .book-item {
        border: 2px solid var(--eb-dark);
    }
    
    .alphabet-btn {
        border: 2px solid var(--eb-dark);
    }
    
    .view-controls {
        border: 2px solid var(--eb-dark);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .book-item:hover,
    .alphabet-btn:hover,
    .pagination .page-link:hover {
        transform: none;
    }
}

/* Focus Styles for Accessibility */
.book-item:focus-within {
    outline: 2px solid var(--eb-primary);
    outline-offset: 2px;
}

.alphabet-btn:focus {
    outline: 2px solid var(--eb-primary);
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--eb-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--eb-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--eb-primary-dark);
}
