/* Base Styles and Variables */
:root {
    /* Light Theme Colors */
    --primary-color: #8e44ad;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #f9f9f9;
    --card-bg-color: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #eeeeee;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --gradient-start: #8e44ad;
    --gradient-end: #3498db;
}

/* Dark Theme Colors */
[data-theme="dark"] {
    --primary-color: #9b59b6;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #1a1a2e;
    --card-bg-color: #16213e;
    --text-color: #f0f0f0;
    --text-light: #cccccc;
    --border-color: #2a2a4a;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-start: #9b59b6;
    --gradient-end: #3498db;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Theme Switch */
.theme-switch-wrapper {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--card-bg-color);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.slider:before {
    background-color: var(--primary-color);
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 26px;
}

input:checked + .slider {
    background-color: var(--card-bg-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
    background-color: var(--secondary-color);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.slider .fa-sun {
    position: absolute;
    left: 8px;
    top: 8px;
    color: #f39c12;
    font-size: 14px;
}

.slider .fa-moon {
    position: absolute;
    right: 8px;
    top: 8px;
    color: #f1c40f;
    font-size: 14px;
}

/* Header Styles */
header {
    background-color: var(--card-bg-color);
    box-shadow: 0 2px 10px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    margin-right: 10px;
}

.logo h1 {
    font-family: 'Quicksand', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    color: var(--text-color);
    font-weight: 500;
    position: relative;
    padding-bottom: 5px;
}

nav ul li a:hover,
nav ul li a.active {
    color: var(--primary-color);
}

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

nav ul li a:hover:after,
nav ul li a.active:after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

/* Hero Section */
.hero {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/hero-pattern.svg');
    background-size: cover;
    opacity: 0.1;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    font-family: 'Quicksand', sans-serif;
}

.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.search-bar {
    display: flex;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 5px;
    max-width: 500px;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    color: white;
    outline: none;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-bar button {
    background-color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    color: var(--primary-color);
    transition: background-color 0.3s ease;
}

.search-bar button:hover {
    background-color: var(--accent-color);
    color: white;
}

.hero-image {
    flex: 1;
    max-width: 500px;
    margin-left: 30px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Section Styles */
section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 50px;
    position: relative;
    font-family: 'Quicksand', sans-serif;
    color: var(--primary-color);
}

.section-title::after {
    content: '';
    position: absolute;
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px;
}

/* Categories Section */
.category-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
    gap: 10px;
}

.filter-btn {
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

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

.book-card {
    background-color: var(--card-bg-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px var(--shadow-color);
}

.book-cover {
    height: 200px;
    overflow: hidden;
}

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

.book-card:hover .book-cover img {
    transform: scale(1.1);
}

.book-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.book-author {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.book-description {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 20px;
    flex: 1;
}

.read-more {
    align-self: flex-start;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.read-more:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-column: 1 / -1;
    padding: 50px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* About Section */
.about-content {
    display: flex;
    align-items: center;
    gap: 50px;
}

.about-text {
    flex: 1;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.about-image {
    flex: 1;
    max-width: 500px;
}

/* Contribute Section */
.contribute-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.step {
    background-color: var(--card-bg-color);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 5px 15px var(--shadow-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease;
}

.step:hover {
    transform: translateY(-5px);
}

.step-number {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 20px;
}

.step-content h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.contribute-cta {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.secondary-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

/* Footer Styles */
footer {
    background-color: var(--card-bg-color);
    padding: 60px 0 20px;
    box-shadow: 0 -5px 15px var(--shadow-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-logo img {
    height: 30px;
    margin-bottom: 10px;
}

.footer-logo p {
    font-weight: 600;
    color: var(--primary-color);
}

.footer-links h3,
.footer-social h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--primary-color);
}

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

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links ul li a {
    color: var(--text-color);
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

.footer-links ul li a:hover {
    color: var(--primary-color);
    transform: translateX(5px);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--background-color);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-5px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-light);
}

.footer-bottom p {
    margin-bottom: 10px;
}

.footer-bottom .fa-heart {
    color: var(--accent-color);
}

/* Book Detail Page */
.book-detail {
    padding: 50px 0;
}

.book-detail-container {
    background-color: var(--card-bg-color);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    overflow: hidden;
}

.book-header {
    padding: 30px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    position: relative;
}

.book-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/book-pattern.svg');
    background-size: cover;
    opacity: 0.1;
}

.book-header-content {
    position: relative;
    z-index: 1;
}

.book-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-family: 'Quicksand', sans-serif;
}

.book-meta {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.book-meta .author {
    margin-right: 20px;
}

.book-meta .category {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.book-content {
    padding: 30px;
}

.book-content img {
    max-width: 100%;
    border-radius: 5px;
    margin: 20px 0;
}

.book-content h1,
.book-content h2,
.book-content h3,
.book-content h4,
.book-content h5,
.book-content h6 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.book-content p {
    margin-bottom: 20px;
    line-height: 1.8;
}

.book-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-light);
}

.book-content code {
    background-color: var(--background-color);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

.book-content pre {
    background-color: var(--background-color);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 20px 0;
}

.book-content pre code {
    background-color: transparent;
    padding: 0;
}

.book-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.back-to-list {
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.back-to-list i {
    margin-right: 5px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-3px);
}

.share-btn.twitter {
    background-color: #1da1f2;
}

.share-btn.facebook {
    background-color: #3b5998;
}

.share-btn.linkedin {
    background-color: #0077b5;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .hero .container {
        flex-direction: column;
        text-align: center;
    }

    .hero-content {
        margin-bottom: 40px;
    }

    .search-bar {
        margin: 0 auto;
    }

    .about-content {
        flex-direction: column;
    }

    .about-text {
        order: 2;
    }

    .about-image {
        order: 1;
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    header .container {
        flex-wrap: wrap;
    }

    nav {
        display: none;
        width: 100%;
        margin-top: 20px;
    }

    nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;
    }

    nav ul li {
        margin: 10px 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .books-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .contribute-steps {
        grid-template-columns: 1fr;
    }

    .book-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .hero-content h2 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .books-container {
        grid-template-columns: 1fr;
    }

    .contribute-cta {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}