/* CSS Variables for Theme */
:root {
    --primary: #ffa42e;
    --secondary: #fac17a;
    --accent: #e7b573;
    --dark: #c48f64;
    --light: #fff;
    --dark-bg: #1a1a1a;
    --dark-text: #f5f5f5;
    --light-bg: #f5e1c6;
    --light-text: #333;
    --header-bg: rgba(255, 255, 255, 0.1);
    --header-bg-dark: rgba(26, 26, 26, 0.8);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --card-bg: #fff;
    --input-bg: #fff;
    --input-text: #333;
}

/* Dark Mode */
.dark-mode {
    --bg-color: var(--dark-bg);
    --text-color: var(--dark-text);
    --header-bg: var(--header-bg-dark);
    --card-bg: #2a2a2a;
    --input-bg: #333;
    --input-text: #f5f5f5;
}

/* Light Mode */
.light-mode {
    --bg-color: var(--light-bg);
    --text-color: var(--light-text);
    --header-bg: var(--header-bg);
    --card-bg: #fff;
    --input-bg: #fff;
    --input-text: #333;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    padding-top: 80px;
}

/* Header Styles */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.header-scrolled {
    padding: 0.5rem 2rem;
}

.header-scrolled nav ul li a {
    color: var(--primary);
}

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

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

.logo h1 {
    font-size: 1.5rem;
    color: #ffa42e;
}

nav {
    display: flex;
    align-items: center;
}

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

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: var(--light);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

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

.theme-toggle {
    background: none;
    border: none;
    color: var(--light);
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 1.5rem;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--light);
    margin: 3px 0;
    transition: var(--transition);
}

/* ========== HERO SECTION ========== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--light);
    padding: 80px 2rem 40px;
    margin-top: -80px;
    position: relative;
    overflow: hidden;
}

/* CRITICAL FIX: Hero video - prevent duplication */
.hero > .background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    opacity: 0.5;
    /* Prevent duplicate rendering */
    background-color: #000;
    display: block;
    pointer-events: none; /* Prevent interaction with video */
}

/* Remove any other background-video styles that might conflict */
.background-video:not(.hero > .background-video) {
    display: none !important;
}

/* Hero overlay */
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

/* Hero content */
.background-video-content {
    position: relative;
    z-index: 1;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--primary);
    color: var(--light);
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    transition: var(--transition);
}

.cta-button:hover {
    background: var(--dark);
    transform: translateY(-3px);
}

/* Promotion Blocks */
.hero-promotion {
    position: relative;
    width: 100%;
    z-index: 1;
    margin-top: 20px;
}

.promotion-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.promo-block {
    width: 200px;
    height: 294px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    position: relative;
    background: var(--card-bg);
}

.promo-block:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
}

.promo-video-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

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

.promo-block:hover .promo-video {
    transform: scale(1.08);
}

.promo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 20px;
    color: white;
}

.promo-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.promo-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    color: var(--secondary);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.promo-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: pointer;
}
/* ========== END HERO SECTION ========== */

/* Featured Book Section */
.featured-book {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 164, 46, 0.1);
    max-width: 1200px;
    margin: 0 auto;
}

.featured-image {
    flex: 1;
    min-width: 300px;
}

.featured-image img {
    width: 100%;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.featured-details {
    flex: 1;
}

.featured-details h3 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: var(--text-color);
    font-weight: 700;
}

.book-author {
    color: var(--dark);
    margin-bottom: 15px;
    font-style: italic;
}

.featured-price {
    font-size: 1.8rem;
    color: var(--primary);
    margin: 20px 0;
    font-weight: bold;
}

.featured-rating {
    display: flex;
    align-items: center;
    margin: 15px 0;
}

.featured-stars {
    color: var(--primary);
    margin-right: 10px;
    font-size: 1.2rem;
}

.featured-reviews {
    color: var(--dark);
    font-size: 0.9rem;
}

.featured-description {
    margin: 20px 0;
    line-height: 1.8;
    font-size: 1.1rem;
}

.featured-meta {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Book Scroller */
.book-scroller {
    padding: 2rem 0;
    background: var(--bg-color);
    overflow: hidden;
    position: relative;
}

.scroller-container {
    display: flex;
    animation: scroll 30s linear infinite;
    width: max-content;
}

.scroller-item {
    flex: 0 0 auto;
    width: 150px;
    margin: 0 10px;
    text-align: center;
}

.scroller-item img {
    width: 110px;
    height: 180px;
    object-fit: cover;
    border-radius: 5px;
    box-shadow: var(--shadow);
}

.scroller-item p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Section Styles */
section {
    padding: 5rem 2rem;
    position: relative;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: var(--primary);
}

/* Book Grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.book-card {
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.book-card img {
    width: 199px;
    height: 320px;
    object-fit: fill;
    margin-left: 2.5rem;
    margin-top: 2.5rem;
}

.book-info {
    padding: 1.5rem;
}

.book-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.book-author {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.book-price {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 1rem;
}

.book-rating {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.stars {
    color: var(--primary);
    margin-right: 0.5rem;
}

.reviews {
    font-size: 0.9rem;
    color: var(--dark);
}

.buy-button {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background: var(--primary);
    color: var(--light);
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.buy-button:hover {
    background: var(--dark);
}

/* Buy Button Gradient */
.buy-button {
    background-color: initial;
    background-image: linear-gradient(-180deg, #FF7E31, #E62C03);
    border-radius: 6px;
    box-shadow: rgba(0, 0, 0, 0.1) 0 2px 4px;
    color: #FFFFFF;
    cursor: pointer;
    display: inline-block;
    font-family: Inter, -apple-system, system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
    height: 40px;
    line-height: 40px;
    outline: 0;
    overflow: hidden;
    padding: 0 20px;
    pointer-events: auto;
    position: relative;
    text-align: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    vertical-align: top;
    white-space: nowrap;
    width: 100%;
    z-index: 9;
    border: 0;
    transition: box-shadow .2s, transform .2s;
    font-weight: 600;
}

.buy-button:hover {
    box-shadow: rgba(253, 76, 0, 0.5) 0 3px 8px;
    transform: translateY(-2px);
}

/* Library Section */
.library-section {
    padding: 5rem 2rem;
}

.library-row {
    margin-bottom: 3rem;
}

.library-row h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem 0;
    scroll-behavior: smooth;
}

.library-book-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    min-width: 120px;
    text-align: center;
}

.library-book-card:hover {
    transform: translateY(-3px);
}

.library-book-card img {
    width: 140px;
    height: 240px;
    object-fit: cover;
}

.library-book-info {
    padding: 0.8rem;
}

.library-book-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    height: 2.4rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.library-preview-button {
    display: block;
    width: 100%;
    padding: 0.4rem;
    background: var(--dark);
    color: var(--light);
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.library-preview-button:hover {
    background: var(--primary);
}

/* Scroll Buttons */
.scroll-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.scroll-button {
    background: var(--primary);
    color: var(--light);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}

.scroll-button:hover {
    background: var(--dark);
    transform: scale(1.1);
}

/* Author Section */
#author .featured-book {
    align-items: center;
}

.author-image {
    flex: 0 0 300px;
}

.author-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.author-info {
    flex: 1;
    min-width: 300px;
}

.author-info h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.author-info p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Book Preview Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    overflow-y: auto;
}

.modal-content {
    background: var(--card-bg);
    margin: 2rem auto;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: var(--text-color);
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--primary);
}

.modal-body {
    padding: 2rem;
}

.modal-book-info {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.modal-book-image {
    flex: 0 0 250px;
}

.modal-book-image img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: var(--shadow);
}

.modal-book-details {
    flex: 1;
    min-width: 300px;
}

.book-meta {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.book-description {
    margin: 2rem 0;
}

.book-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Contact Section */
.contact-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.contact-form {
    flex: 1;
    min-width: 300px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--input-text);
    font-family: inherit;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 164, 46, 0.2);
}

.submit-button {
    padding: 0.8rem 2rem;
    background: var(--primary);
    color: var(--light);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    font-size: 1rem;
}

.submit-button:hover {
    background: var(--dark);
    transform: translateY(-2px);
}

.map-container {
    flex: 1;
    min-width: 300px;
    height: 400px;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* FAQ Section */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 1rem;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--card-bg);
}

.faq-question {
    padding: 1rem;
    background: var(--card-bg);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--bg-color);
}

.faq-answer {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--card-bg);
}

.faq-answer.active {
    padding: 1rem;
    max-height: 500px;
}

/* Footer */
footer {
    background: #5c422e;
    color: var(--light);
    padding: 3rem 2rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

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

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

.footer-links a {
    color: var(--light);
    text-decoration: none;
    transition: var(--transition);
}

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

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

.social-links a {
    color: var(--light);
    font-size: 1.5rem;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    color: var(--primary);
    background: rgba(255, 164, 46, 0.2);
}

.copyright {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: var(--light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    border: none;
    font-size: 1.5rem;
}

.back-to-top:hover {
    background: var(--dark);
    transform: translateY(-3px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Dropdown Styles */
nav ul li.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 180px;
    box-shadow: var(--shadow);
    border-radius: 5px;
    z-index: 1001;
    padding: 0.5rem 0;
}

.dark-mode .dropdown-content {
    background: var(--header-bg-dark);
}

.dropdown-content li {
    margin: 0;
    width: 100%;
}

.dropdown-content a {
    color: var(--light);
    padding: 0.8rem 1.5rem;
    display: block;
    white-space: nowrap;
    text-align: left;
}

.dropdown-content a:hover {
    background: rgba(255, 164, 46, 0.1);
    color: var(--primary);
}

nav ul li.dropdown:hover .dropdown-content {
    display: block;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 100px;
    right: 20px;
    background: #ff4444;
    color: white;
    padding: 15px;
    border-radius: 5px;
    z-index: 9999;
    max-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.no-books-message {
    text-align: center;
    padding: 2rem;
    color: var(--dark);
    font-style: italic;
    grid-column: 1 / -1;
}

/* Responsive Styles */
@media (max-width: 991px) {
    nav ul {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--header-bg);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 2rem;
        transition: var(--transition);
    }

    nav ul.active {
        left: 0;
    }

    nav ul li {
        margin: 1rem 0;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .hero h2 {
        font-size: 2.5rem;
    }

    .featured-book {
        flex-direction: column;
        gap: 30px;
    }

    /* Mobile dropdown */
    .dropdown-content {
        position: static;
        display: none;
        background: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        padding-left: 1.5rem;
    }
    
    nav ul.active .dropdown-content.active {
        display: block;
    }
    
    .dropdown-content li {
        margin: 0.5rem 0;
    }
    
    .dropdown-content a {
        padding: 0.5rem 0;
    }
    
    .dropdown > a::after {
        content: ' ▼';
        font-size: 0.8rem;
    }
    
    .dropdown.active > a::after {
        content: ' ▲';
    }

    /* Promotion responsive */
    .promotion-grid {
        justify-content: center;
        gap: 15px;
    }
    
    .promo-block {
        width: 180px;
        height: 265px;
    }
}

@media (max-width: 767px) {
    .hero h2 {
        font-size: 2rem;
    }

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

    .modal-book-info {
        flex-direction: column;
    }

    .modal-book-image {
        flex: 0 0 auto;
        text-align: center;
    }

    .modal-book-image img {
        max-width: 250px;
        margin: 0 auto;
    }

    .featured-details h3 {
        font-size: 1.8rem;
    }

    .featured-book {
        padding: 20px;
    }

    .promotion-grid {
        gap: 20px;
    }
    
    .promo-block {
        width: 250px;
        height: 368px;
    }
    
    .promo-title {
        font-size: 1.2rem;
    }
    
    .promo-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hero h2 {
        font-size: 1.8rem;
    }

    section {
        padding: 3rem 1rem;
    }

    .book-actions {
        flex-direction: column;
    }

    .featured-details h3 {
        font-size: 1.5rem;
    }

    .library-book-card {
        min-width: 130px;
        max-width: 130px;
    }
    
    .library-book-card img {
        height: 160px;
    }
    
    .library-book-title {
        font-size: 0.8rem;
    }

    .promotion-grid {
        flex-direction: column;
        align-items: center;
        gap: 25px;
    }
    
    .promo-block {
        width: 280px;
        height: 412px;
    }
    
    .promo-overlay {
        padding: 15px;
    }
}