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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

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

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

[dir="rtl"] .hero-content {
    text-align: right;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.5em;
    color: #1a1a1a;
}

h1 {
    font-size: 2.5rem;
    line-height: 1.2;
}

h2 {
    font-size: 2rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

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

a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    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: #6b7280;
    color: white;
}

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

.btn-outline {
    background-color: transparent;
    color: #2563eb;
    border: 2px solid #2563eb;
}

.btn-outline:hover {
    background-color: #2563eb;
    color: white;
    text-decoration: none;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

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

.cookie-banner .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

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

.cookie-banner a {
    color: #93c5fd;
}

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

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 32px;
    width: 32px;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-weight: 500;
    color: #4b5563;
    transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #2563eb;
    text-decoration: none;
}

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

.hero-bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0.1;
    z-index: 1;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    text-align: center;
    margin: 0 auto;
}

.hero h1 {
    margin-bottom: 24px;
    color: #1a1a1a;
}

.hero p {
    font-size: 1.125rem;
    color: #4b5563;
    margin-bottom: 32px;
}

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

.page-header h1 {
    margin-bottom: 16px;
}

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

/* Sections */
.featured-books,
.categories-preview,
.books-directory,
.categories-section,
.content-section,
.contact-section {
    padding: 80px 0;
}

.featured-books h2,
.categories-preview h2,
.categories-section h2 {
    text-align: center;
    margin-bottom: 48px;
}

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

.book-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.book-image {
    width: 100%;
    height: 200px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-image img {
    width: 120px;
    height: 160px;
    object-fit: cover;
}

.book-info {
    padding: 24px;
}

.book-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
}

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

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

.book-description {
    color: #4b5563;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.book-card .btn {
    width: 100%;
}

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

.categories-grid.large {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.category-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px;
    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 h2,
.category-card h3 {
    margin-bottom: 16px;
    color: #1a1a1a;
}

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

.category-card.large {
    padding: 40px;
}

.book-count {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 20px;
}

/* Directory Controls */
.directory-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.search-box,
.filter-box {
    flex: 1;
    min-width: 200px;
}

.search-box input,
.filter-box select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

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

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

.book-detail-content {
    max-width: 1000px;
    margin: 0 auto;
}

.book-detail-header {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.book-detail-image {
    text-align: center;
}

.book-detail-image img {
    width: 200px;
    height: 280px;
    object-fit: cover;
    border-radius: 8px;
}

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

.book-detail-meta {
    margin-bottom: 24px;
}

.book-detail-meta p {
    margin-bottom: 8px;
    color: #6b7280;
}

.book-detail-meta strong {
    color: #1a1a1a;
}

.book-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.purchase-notice {
    background-color: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.purchase-notice p {
    margin: 0;
    color: #92400e;
}

.book-detail-section {
    margin-bottom: 40px;
}

.book-detail-section h2 {
    margin-bottom: 20px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.book-detail-section ul {
    list-style-type: none;
    padding-left: 0;
}

.book-detail-section li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.book-detail-section li:before {
    content: "•";
    color: #2563eb;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Content Sections */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 48px;
}

.content-main {
    line-height: 1.7;
}

.content-main h2 {
    margin-top: 32px;
    margin-bottom: 16px;
}

.content-main h2:first-child {
    margin-top: 0;
}

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

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

.sidebar-box {
    background-color: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.sidebar-box h3 {
    margin-bottom: 16px;
    color: #1a1a1a;
}

.sidebar-box ul {
    list-style: none;
    padding: 0;
}

.sidebar-box li {
    padding: 4px 0;
}

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

.contact-form h2,
.contact-info h2 {
    margin-bottom: 24px;
}

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

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

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

.form-group input: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: 12px 16px;
    border-radius: 6px;
    margin-top: 16px;
}

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

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

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

.contact-item h3 {
    margin-bottom: 8px;
    color: #1a1a1a;
}

.contact-item p {
    margin: 0;
    color: #6b7280;
}

.contact-item a {
    color: #2563eb;
}

/* Legal Content */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

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

.legal-content h2:first-child {
    margin-top: 0;
}

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

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

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

/* Not Found */
.book-not-found,
.not-found-content {
    padding: 80px 0;
    text-align: center;
}

.not-found-content h1 {
    margin-bottom: 16px;
    color: #6b7280;
}

.not-found-content p {
    margin-bottom: 32px;
    color: #9ca3af;
}

.no-results {
    text-align: center;
    padding: 40px 0;
    color: #6b7280;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

/* Footer */
.footer {
    background-color: #1f2937;
    color: white;
    padding: 48px 0 24px;
}

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

.footer-section h4 {
    color: white;
    margin-bottom: 16px;
}

.footer-section p {
    color: #d1d5db;
    margin-bottom: 16px;
}

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

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

.footer-section a {
    color: #d1d5db;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: white;
    text-decoration: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .featured-books,
    .categories-preview,
    .books-directory,
    .categories-section,
    .content-section,
    .contact-section {
        padding: 60px 0;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .book-detail-header {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .directory-controls {
        flex-direction: column;
    }
    
    .book-links {
        justify-content: center;
    }
    
    .cookie-banner .container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .page-header {
        padding: 40px 0;
    }
    
    .featured-books,
    .categories-preview,
    .books-directory,
    .categories-section,
    .content-section,
    .contact-section {
        padding: 40px 0;
    }
    
    .category-card,
    .category-card.large {
        padding: 24px;
    }
    
    .book-info {
        padding: 20px;
    }
    
    .sidebar-box {
        padding: 20px;
    }
}