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

html {
    font-size: 16px;
    line-height: 1.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    background-color: #fff;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    text-decoration: none;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
    text-decoration: none;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #1f2937;
    color: white;
    padding: 16px;
    z-index: 1000;
    display: none;
}

.cookie-banner.show {
    display: block;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-content p {
    margin: 0;
    flex: 1;
}

/* Header */
.header {
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav a {
    color: #6b7280;
    font-weight: 500;
    padding: 8px 0;
    text-decoration: none;
}

.nav a:hover,
.nav a.active {
    color: #2563eb;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background-color: #374151;
    transition: all 0.2s ease;
}

/* Hero Section */
.hero {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 24px;
    color: #1f2937;
}

.hero-content p {
    font-size: 1.25rem;
    color: #6b7280;
    margin-bottom: 32px;
}

.hero-image img {
    width: 100%;
    height: auto;
}

/* Page Header */
.page-header {
    padding: 60px 0;
    background-color: #f8fafc;
    text-align: center;
}

.page-header h1 {
    color: #1f2937;
    margin-bottom: 16px;
}

.page-header p {
    color: #6b7280;
    font-size: 1.125rem;
}

/* Sections */
section {
    padding: 60px 0;
}

.section-footer {
    text-align: center;
    margin-top: 40px;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

.book-card {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
}

.book-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.book-card img {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 16px;
}

.book-card h3 {
    margin-bottom: 8px;
}

.book-card .author {
    color: #6b7280;
    margin-bottom: 8px;
}

.book-card .category {
    display: inline-block;
    background-color: #dbeafe;
    color: #1e40af;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.book-card p {
    color: #6b7280;
    margin-bottom: 16px;
}

.book-card .btn {
    font-size: 14px;
    padding: 8px 16px;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.category-card {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.2s ease;
}

.category-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.category-card h3 {
    color: #1f2937;
    margin-bottom: 12px;
}

.category-card p {
    color: #6b7280;
    margin-bottom: 16px;
}

.category-card .book-count {
    color: #2563eb;
    font-weight: 600;
}

/* Filters */
.filters {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    flex: 1;
    min-width: 300px;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px 0 0 6px;
    font-size: 16px;
}

.search-box button {
    padding: 12px 20px;
    background-color: #2563eb;
    color: white;
    border: 1px solid #2563eb;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-weight: 500;
}

.search-box button:hover {
    background-color: #1d4ed8;
}

.category-filter select {
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    background-color: white;
}

/* Book Details */
.book-details {
    padding: 40px 0;
}

.book-header {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.book-cover img {
    width: 100%;
    border-radius: 12px;
}

.book-info h1 {
    margin-bottom: 12px;
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    color: #6b7280;
}

.book-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.book-category {
    display: inline-block;
    background-color: #dbeafe;
    color: #1e40af;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.purchase-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.purchase-note {
    background-color: #f3f4f6;
    border-left: 4px solid #2563eb;
    padding: 16px;
    margin: 32px 0;
    border-radius: 0 6px 6px 0;
}

.book-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.book-description h2 {
    margin-bottom: 16px;
}

.book-sidebar .sidebar-section {
    background-color: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.book-sidebar h3 {
    margin-bottom: 16px;
}

.book-sidebar ul {
    list-style: none;
}

.book-sidebar li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.book-sidebar li:last-child {
    border-bottom: none;
}

/* Categories Page */
.categories-list {
    display: grid;
    gap: 40px;
}

.category-section {
    background-color: #f8fafc;
    padding: 40px;
    border-radius: 12px;
}

.category-section h2 {
    margin-bottom: 16px;
}

.category-section p {
    color: #6b7280;
    margin-bottom: 24px;
}

.category-books {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.category-book {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.category-book h4 {
    margin-bottom: 8px;
}

.category-book .author {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.category-book p {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

/* Contact Page */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.contact-details {
    margin-top: 32px;
}

.contact-item {
    margin-bottom: 32px;
}

.contact-item h3 {
    margin-bottom: 8px;
}

.contact-form {
    background-color: #f8fafc;
    padding: 40px;
    border-radius: 12px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-message {
    padding: 16px;
    border-radius: 6px;
    margin-top: 16px;
}

.form-message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.form-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Legal Content */
.legal-content {
    padding: 40px 0;
}

.legal-content .content {
    max-width: 800px;
    margin: 0 auto;
}

.legal-content h2 {
    margin-top: 40px;
    margin-bottom: 16px;
    color: #1f2937;
}

.legal-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: #374151;
}

.legal-content ul {
    margin-bottom: 16px;
    padding-left: 20px;
}

.legal-content li {
    margin-bottom: 8px;
}

/* About Page */
.about-content {
    padding: 40px 0;
}

.content-grid {
    display: grid;
    gap: 40px;
}

.content-section {
    background-color: #f8fafc;
    padding: 40px;
    border-radius: 12px;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.category-item {
    background-color: white;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.category-item h3 {
    margin-bottom: 12px;
    color: #2563eb;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.book-not-found {
    padding: 80px 0;
    text-align: center;
}

.not-found-content h1 {
    margin-bottom: 24px;
    color: #1f2937;
}

.not-found-content p {
    color: #6b7280;
    margin-bottom: 32px;
    font-size: 1.125rem;
}

/* Footer */
.footer {
    background-color: #1f2937;
    color: #d1d5db;
    padding: 60px 0 20px;
}

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

.footer-section h3 {
    color: #fff;
    margin-bottom: 16px;
}

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

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
}

.footer-section a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 20px;
    text-align: center;
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .hero .container {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .book-header {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }
    
    .book-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .cookie-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .purchase-links {
        justify-content: center;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .contact-form {
        padding: 24px;
    }
    
    .content-section {
        padding: 24px;
    }
}

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .logo {
    flex-direction: row-reverse;
}

[dir="rtl"] .hero .container {
    direction: rtl;
}

[dir="rtl"] .book-header {
    direction: rtl;
}

[dir="rtl"] .contact-grid {
    direction: rtl;
}

[dir="rtl"] .footer-content {
    direction: rtl;
}