/* Products CSS - Dark Mode Compatible */
:root {
    --primary-color: #6c4ab6;
    --primary-dark: #5a3a9e;
    --primary-light: #8d6bd6;
    --secondary-color: #f8b400;
    --secondary-dark: #d89a00;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --white-color: #ffffff;
    --black-color: #212121;
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Base Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--white-bg);
    color: var(--black-color);
    overflow-x: hidden;
    transition: var(--transition);
    line-height: 1.7;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: var(--light-color);
    color: var(--dark-color);
}

/* Text Colors */
.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.dark-mode .text-dark {
    color: var(--dark-color) !important;
}

.dark-mode .text-light {
    color: var(--light-color) !important;
}

/* Background Colors */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.dark-mode .bg-dark {
    background-color: var(--light-color) !important;
}

.dark-mode .bg-light {
    background-color: var(--dark-color) !important;
}

/* Preloader Styles */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.dark-mode .preloader {
    background: var(--light-color);
}

.spinner {
    width: 70px;
    height: 70px;
    position: relative;
}

.double-bounce1,
.double-bounce2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
}

@keyframes sk-bounce {
    0%, 100% {
        transform: scale(0.0);
    }
    50% {
        transform: scale(1.0);
    }
}

/* Floating Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    background: var(--primary-light);
    border-radius: 50%;
    opacity: 0.3;
    animation: float-up linear infinite;
}

.dark-mode .particle {
    background: var(--secondary-color);
    opacity: 0.2;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

/* Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.btn-theme {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 5px 20px rgba(108, 74, 182, 0.3);
}

.btn-theme:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 25px rgba(108, 74, 182, 0.4);
}

.btn-theme .fa-sun {
    display: none;
}

.dark-mode .btn-theme .fa-moon {
    display: none;
}

.dark-mode .btn-theme .fa-sun {
    display: block;
}

/* Back to Top Button */
.back-to-top {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(108, 74, 182, 0.3);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(108, 74, 182, 0.4);
    opacity: 1 !important;
}

/* Hero Section */
.hero-banner {
    height: 80vh;
    min-height: 600px;
    background: linear-gradient(rgba(26, 26, 46, 0.7), rgba(26, 26, 46, 0.7)),
        url('https://images.unsplash.com/photo-1544716278-ca5e3f4abd8c?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') center/cover no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 80px;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--white-color);
    padding: 0 20px;
    max-width: 800px;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
    animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-bottom: 30px;
    opacity: 0.9;
    animation: fadeInUp 1s ease-out 0.2s forwards;
    opacity: 0;
}

.hero-cta {
    animation: fadeInUp 1s ease-out 0.4s forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floating-cross {
    position: absolute;
    color: rgba(255, 255, 255, 0.15);
    z-index: 0;
    animation: float 8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(5deg);
    }
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-subtitle {
    color: var(--secondary-color);
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 15px;
    display: inline-block;
    position: relative;
    letter-spacing: 1px;
}

.section-subtitle::after {
    content: "";
    position: absolute;
    width: 50px;
    height: 3px;
    background-color: var(--secondary-color);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.section-description {
    color: var(--gray-color);
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
}

.dark-mode .section-description {
    color: rgba(255, 255, 255, 0.7);
}

/* Search Bar */
.search-bar {
    max-width: 700px;
    margin: 0 auto 60px;
    position: relative;
}

.search-bar .form-control {
    height: 60px;
    border-radius: 50px;
    padding-left: 30px;
    border: 2px solid var(--primary-color);
    font-size: 1.1rem;
    background-color: var(--white-bg);
    color: var(--black-color);
    box-shadow: 0 5px 20px rgba(108, 74, 182, 0.1);
    transition: var(--transition);
}

.dark-mode .search-bar .form-control {
    background-color: var(--light-color);
    color: var(--dark-color);
    border-color: var(--primary-light);
    box-shadow: 0 5px 20px rgba(108, 74, 182, 0.2);
}

.search-bar .form-control:focus {
    box-shadow: 0 5px 25px rgba(108, 74, 182, 0.2);
    border-color: var(--primary-dark);
}

.search-bar .btn {
    position: absolute;
    right: 8px;
    top: 8px;
    height: 44px;
    width: 44px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--white-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: var(--transition);
}

.search-bar .btn:hover {
    background-color: var(--primary-dark);
    transform: scale(1.1);
}

/* Book Card */
.book-card {
    background-color: var(--white-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    margin-bottom: 30px;
    height: 100%;
    position: relative;
}

.dark-mode .book-card {
    background-color: var(--light-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.dark-mode .book-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.book-cover {
    height: 300px;
    overflow: hidden;
    position: relative;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.1);
}

.book-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: var(--secondary-color);
    color: var(--black-color);
    font-weight: 600;
    padding: 6px 15px;
    border-radius: 30px;
    font-size: 0.875rem;
    box-shadow: 0 3px 10px rgba(248, 180, 0, 0.3);
    z-index: 1;
}

.book-details {
    padding: 25px;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--black-color);
}

.dark-mode .book-title {
    color: var(--dark-color);
}

.book-author {
    color: var(--gray-color);
    font-size: 0.9375rem;
    margin-bottom: 12px;
}

.dark-mode .book-author {
    color: rgba(255, 255, 255, 0.7);
}

.book-rating {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 0.9375rem;
}

.book-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.book-price del {
    color: var(--gray-color);
    font-size: 1rem;
    margin-right: 10px;
}

.dark-mode .book-price del {
    color: rgba(255, 255, 255, 0.5);
}

.book-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: var(--white-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(108, 74, 182, 0.3);
}

.btn-outline-primary2 {
    background-color: transparent;
    color: var(--primary-color);
    border: none;
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50px;
    font-weight: 500;
    transition: var(--transition);
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode .btn-outline-primary2 {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary2:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
    transform: translateY(-3px);
}

.dark-mode .btn-outline-primary2:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px;
    border-radius: 50%;
    font-weight: 500;
    transition: var(--transition);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode .btn-outline-primary {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
    transform: translateY(-3px);
}

.dark-mode .btn-outline-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

/* Category Card */
.category-card {
    background-color: var(--white-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    margin-bottom: 30px;
    text-align: center;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(108, 74, 182, 0.1);
}

.dark-mode .category-card {
    background-color: var(--light-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
}

.category-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    opacity: 0;
    z-index: -1;
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: transparent;
}

.dark-mode .category-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.category-card:hover::before {
    opacity: 0.1;
}

.category-icon {
    font-size: 50px;
    color: var(--primary-color);
    margin-bottom: 25px;
    transition: var(--transition);
}

.dark-mode .category-icon {
    color: var(--primary-light);
}

.category-card:hover .category-icon {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.category-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--black-color);
}

.dark-mode .category-title {
    color: var(--dark-color);
}

.category-count {
    color: var(--gray-color);
    font-size: 0.9375rem;
}

.dark-mode .category-count {
    color: rgba(255, 255, 255, 0.7);
}

/* Advert Banner */
.advert-banner {
    background-color: var(--white-bg);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05);
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(108, 74, 182, 0.1);
}

.dark-mode .advert-banner {
    background-color: var(--light-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
}

.advert-banner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(108, 74, 182, 0.05), rgba(248, 180, 0, 0.05));
    z-index: 0;
}

.advert-banner-content {
    position: relative;
    z-index: 1;
}

.advert-banner img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.advert-banner h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    color: var(--black-color);
    margin-bottom: 20px;
    line-height: 1.3;
}

.dark-mode .advert-banner h3 {
    color: var(--dark-color);
}

.advert-banner p {
    color: var(--gray-color);
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    font-size: 1.1rem;
}

.dark-mode .advert-banner p {
    color: rgba(255, 255, 255, 0.7);
}

.advert-slide {
    display: none;
}

.advert-slide.active {
    display: block;
    animation: fadeIn 1s ease-in-out;
}

.advert-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.advert-dot {
    width: 12px;
    height: 12px;
    background-color: var(--light-gray);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.dark-mode .advert-dot {
    background-color: rgba(255, 255, 255, 0.2);
}

.advert-dot.active {
    background-color: var(--primary-color);
    transform: scale(1.2);
}

.dark-mode .advert-dot.active {
    background-color: var(--secondary-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Advert Card */
.advert-card {
    background-color: var(--white-bg);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    margin-bottom: 30px;
    border: 1px solid rgba(108, 74, 182, 0.1);
}

.dark-mode .advert-card {
    background-color: var(--light-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
}

.advert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.dark-mode .advert-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.advert-image {
    height: 200px;
    overflow: hidden;
}

.advert-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.advert-card:hover .advert-image img {
    transform: scale(1.1);
}

.advert-content {
    padding: 25px;
}

.advert-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--black-color);
    margin-bottom: 15px;
}

.dark-mode .advert-content h3 {
    color: var(--dark-color);
}

.advert-content p {
    color: var(--gray-color);
    margin-bottom: 20px;
    font-size: 0.9375rem;
}

.dark-mode .advert-content p {
    color: rgba(255, 255, 255, 0.7);
}

/* Featured Books Section */
.featured-books {
    padding: 80px 0;
}

/* Categories Section */
.categories-section {
    padding: 80px 0;
    background-color: rgba(248, 249, 250, 0.5);
}

.dark-mode .categories-section {
    background-color: rgba(26, 26, 46, 0.5);
}


/* Filter Sidebar */
.filter-sidebar {
    background-color: var(--white-bg);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border: 1px solid rgba(108, 74, 182, 0.1);
}

.dark-mode .filter-sidebar {
    background-color: var(--light-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
}

.filter-header {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--black-color);
    position: relative;
    padding-bottom: 10px;
}

.dark-mode .filter-header {
    color: var(--dark-color);
}

.filter-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

.filter-group {
    margin-bottom: 25px;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--black-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.dark-mode .filter-title {
    color: var(--dark-color);
}

.filter-title i {
    transition: var(--transition);
}

.filter-title.collapsed i {
    transform: rotate(-90deg);
}

.filter-options {
    list-style: none;
    padding-left: 0;
}

.filter-options li {
    margin-bottom: 10px;
}

.filter-options a {
    color: var(--gray-color);
    transition: var(--transition);
    text-decoration: none;
}

.dark-mode .filter-options a {
    color: rgba(255, 255, 255, 0.7);
}

.filter-options a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.filter-options a.active {
    color: var(--primary-color);
    font-weight: 500;
    padding-left: 10px;
    border-left: 3px solid var(--primary-color);
}

.form-check-label {
    color: var(--black-color);
    cursor: pointer;
}

.dark-mode .form-check-label {
    color: var(--dark-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.price-range-slider {
    width: 100%;
    margin-top: 20px;
}

.price-range-values {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.sorting-options {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
    align-items: center;
}

.sorting-label {
    margin-right: 10px;
    color: var(--black-color);
    font-weight: 500;
}

.dark-mode .sorting-label {
    color: var(--dark-color);
}

.sorting-select {
    border: 2px solid var(--primary-color);
    border-radius: 50px;
    padding: 8px 15px;
    background-color: var(--white-bg);
    color: var(--black-color);
    font-weight: 500;
}

.dark-mode .sorting-select {
    background-color: var(--light-color);
    color: var(--dark-color);
    border-color: var(--primary-light);
}

.pagination {
    justify-content: center;
    margin-top: 40px;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-link {
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    margin: 0 5px;
    border-radius: 50px !important;
    min-width: 45px;
    text-align: center;
    font-weight: 500;
    transition: var(--transition);
}

.dark-mode .page-link {
    color: var(--primary-light);
    border-color: var(--primary-light);
}

.page-link:hover {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.dark-mode .page-link:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

.results-count {
    color: var(--gray-color);
    margin-bottom: 20px;
}

.dark-mode .results-count {
    color: rgba(255, 255, 255, 0.7);
}

/* Responsive Styles */
@media (max-width: 1199.98px) {
    .hero-banner {
        height: 70vh;
    }
}

@media (max-width: 991.98px) {
    .hero-banner {
        height: 60vh;
        min-height: 500px;
    }

    .book-cover {
        height: 250px;
    }

    .advert-banner {
        padding: 30px;
    }

    .advert-banner img {
        height: 200px;
    }

    .sorting-options {
        justify-content: flex-start;
        margin-top: 30px;
    }
}

@media (max-width: 767.98px) {
    .hero-banner {
        height: 500px;
    }

    .section-header {
        margin-bottom: 40px;
    }

    .book-card,
    .category-card,
    .advert-card {
        margin-bottom: 25px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-about {
        max-width: 100%;
    }

    .filter-sidebar {
        margin-bottom: 0;
    }

    /* Mobile Grid for Books (2 columns) */
    .book-grid .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .book-cover {
        height: 200px;
    }

    .book-details {
        padding: 15px;
    }

    .book-title {
        font-size: 1.1rem;
    }

    .book-price {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .btn-primary,
    .btn-outline-primary {
        padding: 8px 15px;
        font-size: 0.875rem;
    }

    .btn-outline-primary {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 575.98px) {
    .hero-banner {
        height: 450px;
    }

    .search-bar .form-control {
        height: 50px;
        padding-left: 20px;
        font-size: 1rem;
    }

    .search-bar .btn {
        width: 40px;
        height: 40px;
        right: 5px;
        top: 5px;
    }

    .advert-banner {
        padding: 25px;
    }

    .advert-banner h3 {
        font-size: 1.5rem;
    }

    .advert-banner p {
        font-size: 1rem;
    }

    .footer-legal {
        flex-direction: column;
        gap: 10px;
    }

    .legal-separator {
        display: none;
    }

    .theme-toggle {
        bottom: 20px;
        right: 20px;
    }
}


/* Mobile-First Book Card Styles (default) */
.book-card {
    width: 100%;
    margin-bottom: 20px;
    transition: var(--transition);
  }
  
  .book-cover {
    height: 200px;
    overflow: hidden;
  }
  
  .book-details {
    padding: 15px;
  }
  
  .book-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  /* Tablet Styles (481px - 768px) */
  @media (min-width: 481px) {
    .book-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 20px;
    }
    
    .book-card {
      margin-bottom: 0;
      display: flex;
      flex-direction: column;
    }
    
    .book-cover {
      height: 220px;
    }
    
    .book-details {
      flex-grow: 1;
      display: flex;
      flex-direction: column;
      padding: 20px;
    }
    
    .book-actions {
      flex-direction: row;
      margin-top: auto;
    }
    
    .btn-primary {
      flex: 1;
    }
  }
  
  /* Small Desktop Styles (769px - 1024px) */
  @media (min-width: 769px) {
    .book-grid {
      grid-template-columns: repeat(3, 1fr);
    }
    
    .book-cover {
      height: 250px;
    }
    
    .book-title {
      font-size: 1.3rem;
      min-height: 3.2em; /* Ensures consistent height for 2-line titles */
    }
    
    .book-price {
      font-size: 1.3rem;
    }
  }
  
  /* Large Desktop Styles (1025px and up) */
  @media (min-width: 1025px) {
    .book-grid {
      grid-template-columns: repeat(4, 1fr);
      gap: 25px;
    }
    
    .book-cover {
      height: 280px;
    }
    
    .book-details {
      padding: 25px;
    }
  }
  
  /* Tall Mobile Screens (481px - 768px height) */
  @media (min-width: 481px) and (max-height: 768px) {
    .book-cover {
      height: 180px;
    }
    
    .book-title {
      font-size: 1.1rem;
    }
  }
  
  /* Hover Effects (only on non-touch devices) */
  @media (hover: hover) {
    .book-card:hover {
      transform: translateY(-10px);
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    .dark-mode .book-card:hover {
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    }
    
    .book-card:hover .book-cover img {
      transform: scale(1.1);
    }
  }
  
  /* iOS Viewport Unit Fix */
  @supports (-webkit-touch-callout: none) {
    .book-cover {
      height: 35vw;
      max-height: 200px;
    }
    
    @media (min-width: 481px) {
      .book-cover {
        height: 25vw;
        max-height: 280px;
      }
    }
  }
  
  /* Dark Mode Adjustments */
  .dark-mode .book-card {
    background-color: var(--light-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  }
  
  .dark-mode .book-title,
  .dark-mode .book-price {
    color: var(--dark-color);
  }
  
  .dark-mode .book-author,
  .dark-mode .book-price del {
    color: rgba(255, 255, 255, 0.7);
  }
  
  /* Button Adjustments for Dark Mode */
  .dark-mode .btn-outline-primary {
    color: var(--primary-light);
    border-color: var(--primary-light);
  }
  
  .dark-mode .btn-outline-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
  }
  
  /* Mobile Optimization (below 480px) */
  @media (max-width: 480px) {
    .book-grid {
      grid-template-columns: 1fr;
    }
    
    .book-cover {
      height: 180px;
    }
    
    .book-actions {
      flex-direction: row; /* Better use of space on mobile */
    }
    
    .btn-primary,
    .btn-outline-primary {
      min-height: 44px; /* Better touch targets */
    }
  }

  /* Mobile-First Book Grid (1 column by default) */
.book-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 15px;
  }
  
  /* Small Mobile Devices (360px+) */
  @media (min-width: 360px) {
    .book-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 15px;
    }
    
    .book-cover {
      height: 160px;
    }
    
    .book-details {
      padding: 12px;
    }
    
    .book-title {
      font-size: 1rem;
      margin-bottom: 6px;
    }
    
    .book-price {
      font-size: 1.1rem;
      margin-bottom: 12px;
    }
    
    .book-actions {
      flex-direction: row;
      gap: 8px;
    }
    
    .btn-primary,
    .btn-outline-primary {
      padding: 8px 12px;
      font-size: 0.85rem;
    }
    
    .btn-outline-primary {
      width: 36px;
      height: 36px;
    }
  }
  
  /* Larger Mobile Devices (480px+) */
  @media (min-width: 480px) {
    .book-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 20px;
    }
    
    .book-cover {
      height: 180px;
    }
    
    .book-details {
      padding: 15px;
    }
    
    .book-title {
      font-size: 1.1rem;
    }
  }
  
  /* Small Tablets (600px+) */
  @media (min-width: 600px) {
    .book-grid {
      grid-template-columns: repeat(3, 1fr);
    }
    
    .book-cover {
      height: 200px;
    }
  }
  
  /* Tablets (768px+) */
  @media (min-width: 768px) {
    .book-grid {
      grid-template-columns: repeat(3, 1fr);
      gap: 25px;
    }
    
    .book-cover {
      height: 220px;
    }
    
    .book-details {
      padding: 20px;
    }
  }
  
  /* Small Desktops (992px+) */
  @media (min-width: 992px) {
    .book-grid {
      grid-template-columns: repeat(4, 1fr);
    }
    
    .book-cover {
      height: 240px;
    }
  }
  
  /* Large Desktops (1200px+) */
  @media (min-width: 1200px) {
    .book-grid {
      grid-template-columns: repeat(5, 1fr);
      gap: 30px;
    }
    
    .book-cover {
      height: 260px;
    }
  }
  
  /* Mobile-Specific Enhancements */
  @media (max-width: 767px) {
    .book-card {
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    
    .dark-mode .book-card {
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }
    
    /* Ensure touch-friendly targets */
    .book-actions a {
      min-width: 44px;
      min-height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    /* iOS viewport unit fix */
    @supports (-webkit-touch-callout: none) {
      .book-cover {
        height: 40vw;
        max-height: 180px;
      }
    }
  }
  
  /* Dark Mode Adjustments for Mobile */
  @media (max-width: 767px) {
    .dark-mode .book-card {
      background-color: var(--light-color);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .dark-mode .book-title {
      color: var(--dark-color);
    }
    
    .dark-mode .book-author {
      color: rgba(255, 255, 255, 0.7);
    }
  }