:root {
    --primary: #5D8A74;
    --secondary: #A3BFA8;
    --accent: #D4A76A;
    --light: #F7F4EF;
    --dark: #2C3E2D;
    --text: #333333;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Base styles matching your theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

/* Header styles */
header {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px var(--shadow);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 1.8rem;
}

.logo i {
    margin-right: 10px;
    color: var(--accent);
}

nav ul {
    display: flex;
    list-style: none;
}

nav li {
    margin-left: 1.5rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    position: relative;
}

nav a:hover {
    color: var(--accent);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: white;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* Hero section */
.hero {
    background: linear-gradient(rgba(44, 62, 45, 0.7), rgba(44, 62, 45, 0.7)),
        url('https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    text-align: center;
    padding: 4rem 2rem;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

/* Main content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.book-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 4px solid var(--secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow);
}

.book-image {
    height: 200px;
    background-color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    font-style: italic;
    position: relative;
    overflow: hidden;
}

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

.book-card:hover .book-image img {
    transform: scale(1.05);
}

.book-image::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom right, var(--primary), transparent);
    opacity: 0.3;
}

.book-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.book-author {
    color: var(--primary);
    font-style: italic;
    margin-bottom: 1rem;
}

.book-description {
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.book-link {
    display: inline-block;
    background-color: var(--accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
    align-self: flex-start;
    margin-top: auto;
}

.book-link:hover {
    background-color: var(--primary);
}

/* Search section */
.search-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow);
    margin-bottom: 2rem;
    border-top: 4px solid var(--primary);
}

.search-title {
    margin-bottom: 1rem;
    color: var(--primary);
}

.search-box {
    display: flex;
    max-width: 600px;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--secondary);
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
    color: var(--dark);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: var(--dark);
}

/* Category filters */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.category-filter {
    background-color: var(--light);
    color: var(--dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.category-filter:hover,
.category-filter.active {
    background-color: var(--primary);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: white;
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-body {
    padding: 2rem;
}

.modal-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.modal-book-image {
    flex: 0 0 200px;
    height: 280px;
    background-color: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
}

.modal-book-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-book-info {
    flex: 1;
}

.modal-title {
    font-size: 1.8rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.modal-author {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
    font-style: italic;
}

.modal-category {
    display: inline-block;
    background-color: var(--light);
    color: var(--dark);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.modal-summary {
    margin-top: 1.5rem;
    line-height: 1.7;
}

.modal-summary h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--primary);
    font-style: italic;
}

/* ===========================
   Footer
=========================== */
footer {
    background-color: var(--dark);
    color: white;
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding: 0 2rem;
}

.footer-col h3 {
    font-family: 'Merriweather', serif;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--accent);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--accent);
    transform: translateY(-3px);
}

.copyright {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* ========== RESPONSIVE STYLES ========== */

/* Large devices (desktops, 992px and up) */
@media (max-width: 1199.98px) {
    .header-container {
        padding: 0 1.5rem;
    }
    
    .container {
        padding: 1.5rem;
    }
    
    .hero {
        padding: 3rem 1.5rem;
    }
}

/* Medium devices (tablets, 768px to 991.98px) */
@media (max-width: 991.98px) {
    .header-container {
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 1.6rem;
    }
    
    nav li {
        margin-left: 1rem;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .modal-header {
        gap: 1.5rem;
    }
    
    .modal-book-image {
        flex: 0 0 180px;
        height: 250px;
    }
    
    /* Footer adjustments for tablets */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 0 1.5rem;
    }
    
    .footer-col h3 {
        font-size: 1.3rem;
    }
    
    .social-links {
        justify-content: flex-start;
    }
}

/* Small devices (landscape phones, 576px to 767.98px) */
@media (max-width: 767.98px) {
    /* Header adjustments for mobile */
    .header-container {
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    nav {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    nav.active {
        max-height: 300px;
    }
    
    nav ul {
        flex-direction: column;
        width: 100%;
        padding: 1rem 0;
    }
    
    nav li {
        margin: 0;
        text-align: center;
        width: 100%;
    }
    
    nav a {
        display: block;
        padding: 0.75rem 0;
        width: 100%;
    }
    
    /* Hero adjustments */
    .hero {
        padding: 2rem 1rem;
        min-height: 50vh;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    /* Books grid adjustments */
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .book-content {
        padding: 1rem;
    }
    
    /* Search section adjustments */
    .search-section {
        padding: 1.5rem;
    }
    
    .search-box {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-box input {
        border-radius: 4px;
        margin-bottom: 0.5rem;
    }
    
    .search-box button {
        border-radius: 4px;
        padding: 0.75rem;
    }
    
    /* Category filters adjustments */
    .category-filters {
        justify-content: center;
    }
    
    /* Modal adjustments */
    .modal-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .modal-book-image {
        flex: 0 0 auto;
        width: 200px;
        height: 280px;
        margin: 0 auto;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .modal-author {
        font-size: 1.1rem;
    }
    
    /* Footer adjustments for mobile landscape */
    footer {
        padding: 3rem 0 1.5rem;
        margin-top: 3rem;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
        text-align: left;

        ul{
            padding-left: 1rem;
            
            li{
                padding-left: 1rem;
            }
        }
        
    }
    
    .footer-col h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .social-links {
        justify-content: center;
    }
    
    .copyright {
        padding-top: 1.5rem;
        margin-top: 1.5rem;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .header-container {
        padding: 0.5rem;
    }
    
    .logo {
        font-size: 1.4rem;
    }
    
    .hero {
        padding: 1.5rem 0.5rem;
    }
    
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .search-section {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .category-filters {
        gap: 0.3rem;
    }
    
    .category-filter {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .modal {
        padding: 0.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-book-image {
        width: 150px;
        height: 210px;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    /* Footer adjustments for mobile portrait */
    footer {
        padding: 2.5rem 0 1.5rem;
        margin-top: 2.5rem;
    }
    
    .footer-container {
        padding: 0 0.5rem;
        gap: 1.5rem;
    }
    
    .footer-col h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .footer-links li {
        margin-bottom: 0.5rem;
    }
    
    .social-links {
        gap: 0.8rem;
    }
    
    .social-links a {
        width: 36px;
        height: 36px;
    }
    
    .copyright {
        font-size: 0.85rem;
        padding-top: 1rem;
        margin-top: 1rem;
    }
}

/* Print styles */
@media print {
    header, footer, .search-section, .book-link {
        display: none;
    }
    
    .book-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .container {
        max-width: 100%;
    }
}