/*
 * Hebrew Bible Studies - Main Stylesheet
 * Navy Blue Theme with Solid Colors
 */

/* ============================================
   CSS Custom Properties (Variables)
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #001F54;
    --primary-light: #002D7A;
    --primary-dark: #001540;
    
    /* Accent Colors */
    --accent: #B85C38;
    --accent-light: #D4714A;
    --accent-dark: #8C4629;
    
    /* Neutral Colors */
    --soft-cream: #F8F6F3;
    --warm-gray: #6B7280;
    --light-gray: #E5E7EB;
    --medium-gray: #9CA3AF;
    --dark-gray: #374151;
    
    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: var(--soft-cream);
    --bg-dark: var(--primary);
    
    /* Text Colors */
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --text-muted: var(--warm-gray);
    --text-light: #FFFFFF;
    
    /* Border Colors */
    --border-light: #E5E7EB;
    --border-medium: #D1D5DB;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Crimson Pro', serif;
    --font-size-base: 1.125rem;
    --line-height-base: 1.8;
    
    /* Spacing */
    --section-spacing: 6rem;
    --container-padding: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
}

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

[dir="ltr"] {
    --text-align: left;
}

/* ============================================
   Base Styles
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

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

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    z-index: 9999;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   Header & Navigation
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.navbar {
    padding: 1rem 0;
}

.navbar-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary) !important;
    letter-spacing: 0.5px;
}

.navbar-brand:hover {
    color: var(--accent) !important;
}

.navbar-toggler {
    border: 1px solid var(--primary);
    padding: 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 31, 84, 0.25);
}

.navbar-toggler svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary);
}

.nav-link {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 0.5rem 1rem !important;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary) !important;
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

/* Search in Navigation */
.nav-search {
    position: relative;
}

.search-form {
    position: relative;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.search-input {
    border: none !important;
    background: transparent !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.9rem;
    width: 180px;
    transition: width var(--transition-normal);
}

.search-input:focus {
    width: 220px;
    box-shadow: none !important;
}

.search-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 0.75rem;
    color: var(--warm-gray);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.search-btn:hover {
    color: var(--primary);
}

.search-btn svg {
    width: 18px;
    height: 18px;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 100;
}

.search-suggestions.show {
    display: block;
}

/* Language Dropdown */
.language-dropdown .nav-link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.language-dropdown svg {
    width: 18px;
    height: 18px;
}

.language-dropdown .dropdown-menu {
    min-width: 120px;
}

.language-dropdown .dropdown-item.active {
    background: var(--primary);
}

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
    padding: var(--section-spacing) 0;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.hero-content {
    animation: slideInLeft 0.8s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.eyebrow-icon {
    width: 18px;
    height: 18px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--primary);
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 400;
    font-style: italic;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 500px;
    line-height: 1.9;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Book Display */
.hero-book {
    animation: slideInRight 0.8s ease-out 0.2s backwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.book-display {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.book-cover {
    position: relative;
    width: 320px;
    height: 460px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: var(--shadow-xl);
    transform: perspective(1000px) rotateY(-10deg);
    transition: transform var(--transition-slow);
}

.book-cover:hover {
    transform: perspective(1000px) rotateY(-5deg) translateY(-10px);
}

.book-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-spine {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 100%;
    background: var(--primary-dark);
    border-radius: 2px 0 0 2px;
}

.book-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 2rem;
    text-align: center;
    margin-left: 20px;
}

.book-ornament {
    width: 60px;
    height: 2px;
    background: var(--accent);
}

.book-ornament.top {
    margin-bottom: 2rem;
}

.book-ornament.bottom {
    margin-top: 2rem;
}

.book-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-light);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.book-divider {
    width: 40px;
    height: 1px;
    background: var(--accent);
    margin: 1rem 0;
}

.book-author {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-style: italic;
    color: var(--accent-light);
}

.book-shadow {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 20px;
    background: rgba(0, 0, 0, 0.2);
    filter: blur(15px);
    border-radius: 50%;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--text-light) !important;
}

.btn-primary:hover {
    background: var(--primary-light) !important;
    border-color: var(--primary-light) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline-primary:hover {
    background: var(--primary) !important;
    color: var(--text-light) !important;
    transform: translateY(-2px);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ============================================
   Section Styles
   ============================================ */
.section-header {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Features Section
   ============================================ */
.features-section {
    padding: var(--section-spacing) 0;
    background: var(--bg-primary);
}

.feature-card {
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    background: var(--bg-primary);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--primary);
}

.feature-icon svg {
    width: 32px;
    height: 32px;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.feature-description {
    color: var(--text-secondary);
    font-size: 1.125rem;
    line-height: 1.8;
}

/* ============================================
   About Section
   ============================================ */
.about-section {
    padding: var(--section-spacing) 0;
    background: var(--bg-secondary);
}

.about-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.9;
}

.quote-card {
    background: var(--bg-primary);
    padding: 2.5rem;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.quote-icon {
    color: var(--accent);
    margin-bottom: 1rem;
}

.quote-icon svg {
    width: 32px;
    height: 32px;
}

.quote-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--primary);
    line-height: 1.6;
    margin: 0 0 1rem;
}

.quote-author {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
}

/* ============================================
   Read Book Section
   ============================================ */
.read-section {
    padding: var(--section-spacing) 0;
    background: var(--bg-primary);
}

.read-form-card {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.read-form .form-label {
    font-weight: 500;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.label-icon {
    width: 16px;
    height: 16px;
}

.read-form .form-control,
.read-form .form-select {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.read-form .form-control:focus,
.read-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 31, 84, 0.1);
}

/* ============================================
   Chapters Section
   ============================================ */
.chapters-section {
    padding: var(--section-spacing) 0;
    background: var(--bg-secondary);
}

.chapter-card-link {
    display: block;
    text-decoration: none;
    height: 100%;
}

.chapter-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--radius-md);
    border-left: 4px solid transparent;
    transition: all var(--transition-normal);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chapter-card:hover {
    border-left-color: var(--accent);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.chapter-number {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 300;
    color: var(--primary);
    opacity: 0.2;
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.chapter-description {
    color: var(--text-secondary);
    line-height: 1.7;
    flex-grow: 1;
}

.chapter-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: 1rem;
}

.chapter-link svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.chapter-card:hover .chapter-link svg {
    transform: translateX(4px);
}

.empty-chapters {
    color: var(--text-muted);
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

/* ============================================
   Author Section
   ============================================ */
.author-section {
    padding: var(--section-spacing) 0;
    background: var(--bg-primary);
}

.author-photo {
    position: relative;
}

.photo-placeholder {
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    opacity: 0.2;
}

.photo-placeholder svg {
    width: 80px;
    height: 80px;
}

.photo-decoration {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100%;
    height: 100%;
    max-width: 350px;
    border: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    z-index: -1;
}

.author-content p {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 2;
}

.author-contact-info {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 2rem;
    line-height: 1.8;
}

.author-email {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.author-email:hover {
    color: var(--accent);
}

/* ============================================
   Contact Section
   ============================================ */
.contact-section {
    padding: var(--section-spacing) 0;
    background: var(--primary);
}

.contact-form-card {
    background: var(--bg-primary);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.contact-form .form-label {
    font-weight: 500;
    color: var(--primary);
}

.contact-form .form-control,
.contact-form .form-select {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
}

.contact-form .form-control:focus,
.contact-form .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 31, 84, 0.1);
}

.alert-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
    padding: 4rem 0 2rem;
    background: var(--primary-dark);
    color: var(--text-light);
}

.footer-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.footer-description {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.7;
}

.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--transition-fast);
}

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

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

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: all var(--transition-fast);
}

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

.social-links svg {
    width: 18px;
    height: 18px;
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

.footer-bottom {
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin: 0;
}

/* ============================================
   Reading Page Styles
   ============================================ */
.reading-page {
    background: var(--bg-primary);
}

.reading-layout {
    display: flex;
    min-height: calc(100vh - 80px);
}

/* TOC Sidebar */
.toc-sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 80px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.toc-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.toc-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.toc-title svg {
    width: 18px;
    height: 18px;
}

.toc-close {
    display: none;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.toc-search {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.toc-search .input-group-text {
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-right: none;
}

.toc-search .input-group-text svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.toc-search .form-control {
    border-left: none;
    font-size: 0.9rem;
}

.toc-nav {
    padding: 1rem 0;
}

.toc-part {
    border-bottom: 1px solid var(--border-light);
}

.toc-part.active {
    background: rgba(0, 31, 84, 0.03);
}

.toc-part-toggle {
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

[dir="rtl"] .toc-part-toggle {
    text-align: right;
}

.toc-part-toggle:hover {
    background: rgba(0, 31, 84, 0.05);
}

.toc-toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.toc-part-toggle[aria-expanded="true"] .toc-toggle-icon {
    transform: rotate(90deg);
}

[dir="rtl"] .toc-part-toggle[aria-expanded="true"] .toc-toggle-icon {
    transform: rotate(-90deg);
}

.toc-part-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
}

.toc-chapters {
    list-style: none;
    padding: 0 0 0.5rem;
    margin: 0;
}

.toc-chapter {
    position: relative;
}

.toc-chapter-wrapper {
    display: flex;
    align-items: center;
}

.toc-expand-btn {
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
}

.toc-expand-placeholder {
    width: 28px;
    flex-shrink: 0;
}

.toc-chapter-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.toc-chapter-link:hover {
    color: var(--primary);
    background: rgba(0, 31, 84, 0.05);
}

.toc-chapter-link.active {
    color: var(--primary);
    background: rgba(0, 31, 84, 0.08);
    font-weight: 500;
}

.toc-chapter-number {
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 2rem;
}

.toc-subchapters {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-left: 1rem;
}

[dir="rtl"] .toc-subchapters {
    padding-left: 0;
    padding-right: 1rem;
}

/* TOC Mobile Toggle */
.toc-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    padding: 1rem;
    background: var(--primary);
    color: var(--text-light);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 99;
    align-items: center;
    gap: 0.5rem;
}

[dir="rtl"] .toc-mobile-toggle {
    left: auto;
    right: 2rem;
}

.toc-mobile-toggle svg {
    width: 20px;
    height: 20px;
}

.toc-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.toc-overlay.show {
    display: block;
}

/* Reading Content */
.reading-content {
    flex: 1;
    margin-left: 320px;
    padding: 2rem 3rem;
    max-width: calc(100% - 320px);
}

[dir="rtl"] .reading-content {
    margin-left: 0;
    margin-right: 320px;
}

/* Breadcrumb */
.reading-breadcrumb {
    margin-bottom: 2rem;
}

.reading-breadcrumb .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.reading-breadcrumb .breadcrumb-item {
    display: flex;
    align-items: center;
}

.reading-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
    width: 16px;
    height: 16px;
    background-size: contain;
    padding: 0;
    margin: 0 0.5rem;
}

[dir="rtl"] .reading-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    transform: rotate(180deg);
}

.reading-breadcrumb .breadcrumb-item a {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.reading-breadcrumb .breadcrumb-item a:hover {
    color: var(--primary);
}

.reading-breadcrumb .breadcrumb-item a svg {
    width: 14px;
    height: 14px;
}

.reading-breadcrumb .breadcrumb-item.active {
    color: var(--primary);
}

/* Chapter Content */
.chapter-content {
    max-width: 800px;
}

.chapter-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.chapter-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chapter-number {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    background: rgba(184, 92, 56, 0.1);
    border-radius: var(--radius-sm);
}

.chapter-part {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.chapter-content .chapter-title {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--primary);
}

.chapter-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.chapter-body {
    font-size: 1.25rem;
    line-height: 2;
    color: var(--text-primary);
}

.chapter-body h2 {
    font-size: 2rem;
    margin: 2.5rem 0 1rem;
}

.chapter-body h3 {
    font-size: 1.75rem;
    margin: 2rem 0 1rem;
}

.chapter-body p {
    margin-bottom: 1.5rem;
}

.chapter-body blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent);
    font-style: italic;
}

[dir="rtl"] .chapter-body blockquote {
    border-left: none;
    border-right: 4px solid var(--accent);
}

/* Subchapters List */
.subchapters-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.subchapters-title {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.subchapters-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.subchapters-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subchapters-list li {
    margin-bottom: 0.5rem;
}

.subchapters-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.subchapters-list a:hover {
    background: var(--primary);
    color: var(--text-light);
}

.subchapter-number {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 2.5rem;
}

.subchapters-list a:hover .subchapter-number {
    color: rgba(255, 255, 255, 0.7);
}

.subchapter-title {
    flex: 1;
}

.subchapters-list svg {
    width: 16px;
    height: 16px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.subchapters-list a:hover svg {
    opacity: 1;
}

/* Chapter Navigation */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.nav-prev,
.nav-next {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    text-decoration: none;
}

.nav-prev:hover,
.nav-next:hover {
    background: var(--primary);
    color: var(--text-light);
    transform: translateY(-2px);
}

.nav-prev svg,
.nav-next svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.nav-next {
    justify-content: flex-end;
    text-align: right;
}

[dir="rtl"] .nav-next {
    text-align: left;
}

.nav-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-title {
    font-family: var(--font-heading);
    font-weight: 500;
}

.nav-prev.disabled,
.nav-next.disabled {
    visibility: hidden;
}

/* Reading Overview */
.reading-overview {
    max-width: 900px;
}

.overview-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.overview-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.overview-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.parts-overview {
    display: grid;
    gap: 2rem;
}

.part-card {
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.part-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.part-title a {
    color: var(--primary);
}

.part-title a:hover {
    color: var(--accent);
}

.part-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.part-chapters {
    list-style: none;
    padding: 0;
    margin: 0;
}

.part-chapters li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.part-chapters li:last-child {
    border-bottom: none;
}

.part-chapters a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.part-chapters a:hover {
    color: var(--primary);
}

.chapter-num {
    color: var(--text-muted);
    min-width: 1.5rem;
}

.more-link a {
    color: var(--accent) !important;
    font-weight: 500;
}

/* ============================================
   Search Page Styles
   ============================================ */
.search-page {
    padding: 3rem 0 var(--section-spacing);
    min-height: calc(100vh - 200px);
}

.search-header {
    max-width: 700px;
    margin: 0 auto 3rem;
    text-align: center;
}

.search-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.search-title svg {
    width: 32px;
    height: 32px;
}

.search-form-large .input-group {
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.search-form-large .form-control {
    border: none;
    padding: 1rem 1.5rem;
}

.search-form-large .form-control:focus {
    box-shadow: none;
}

.search-form-large .btn {
    padding: 1rem 1.5rem;
    border-radius: 0;
}

.search-form-large .btn svg {
    width: 20px;
    height: 20px;
}

.search-summary {
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.results-list {
    max-width: 800px;
}

.result-group {
    margin-bottom: 2.5rem;
}

.result-group-title {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-muted);
}

.result-group-title svg {
    width: 18px;
    height: 18px;
}

.result-item {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.result-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.result-breadcrumb a {
    color: var(--text-muted);
}

.result-breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    width: 12px;
    height: 12px;
}

.result-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.result-title a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.result-title a:hover {
    color: var(--accent);
}

.result-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.result-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.result-excerpt mark {
    background: rgba(184, 92, 56, 0.2);
    color: inherit;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}

.result-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
}

.result-link svg {
    width: 14px;
    height: 14px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.no-results-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--text-muted);
}

.no-results-icon svg {
    width: 36px;
    height: 36px;
}

.no-results h3 {
    margin-bottom: 0.75rem;
}

.no-results p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.search-tips {
    text-align: left;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

[dir="rtl"] .search-tips {
    padding-left: 0;
    padding-right: 1.5rem;
}

.search-tips li {
    margin-bottom: 0.5rem;
}

/* Empty Search State */
.search-empty {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.search-empty-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--primary);
}

.search-empty-icon svg {
    width: 36px;
    height: 36px;
}

.suggested-searches {
    margin-top: 2rem;
}

.suggested-searches h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.suggested-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.suggested-tag {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.suggested-tag:hover {
    background: var(--primary);
    color: var(--text-light);
}

/* ============================================
   404 Page Styles
   ============================================ */
.error-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.error-content {
    max-width: 500px;
}

.error-code {
    font-family: var(--font-heading);
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.1;
    line-height: 1;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 991.98px) {
    :root {
        --section-spacing: 4rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    /* TOC Mobile */
    .toc-sidebar {
        transform: translateX(-100%);
        width: 300px;
    }
    
    [dir="rtl"] .toc-sidebar {
        transform: translateX(100%);
    }
    
    .toc-sidebar.open {
        transform: translateX(0);
    }
    
    .toc-close {
        display: block;
    }
    
    .toc-mobile-toggle {
        display: flex;
    }
    
    .reading-content {
        margin-left: 0;
        max-width: 100%;
        padding: 1.5rem;
    }
    
    [dir="rtl"] .reading-content {
        margin-right: 0;
    }
    
    .chapter-content .chapter-title {
        font-size: 2rem;
    }
    
    .chapter-navigation {
        flex-direction: column;
    }
    
    .nav-next {
        flex-direction: row-reverse;
        text-align: left;
    }
    
    [dir="rtl"] .nav-next {
        text-align: right;
    }
}

@media (max-width: 767.98px) {
    .hero-cta {
        flex-direction: column;
    }
    
    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }
    
    .book-cover {
        width: 260px;
        height: 380px;
    }
    
    .book-title {
        font-size: 1.5rem;
    }
    
    .search-input {
        width: 140px;
    }
    
    .search-input:focus {
        width: 180px;
    }
    
    .chapter-body {
        font-size: 1rem;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .site-header,
    .site-footer,
    .toc-sidebar,
    .toc-mobile-toggle,
    .chapter-navigation,
    .hero-cta {
        display: none !important;
    }
    
    .reading-content {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
    
    .chapter-content {
        max-width: 100%;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .chapter-body {
        font-size: 12pt;
    }
}

/* ============================================
   Accessibility Improvements
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
