/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* General Styles */
body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

/* Main Navigation Bar */
.main-navbar {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.nav-home, .nav-switch {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-home:hover, .nav-switch:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
}

.nav-title {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Breadcrumb Navigation */
.breadcrumb {
    background-color: #e9ecef;
    padding: 10px 20px;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    margin-bottom: 0;
}

.breadcrumb.hidden {
    display: none !important;
}

.breadcrumb.hidden * {
    display: none !important;
}

.breadcrumb-item {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

.breadcrumb-item:hover {
    color: #0056b3;
    text-decoration: underline;
}

.breadcrumb-current {
    color: #6c757d;
    font-weight: bold;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: #6c757d;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

header h1 {
    color: #8b4513;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.section.hidden {
    display: none;
}

/* Navigation Header */
.navigation-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.back-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.back-button:hover {
    background-color: #5a6268;
}

.chapter-navigation {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

/* Back Navigation Buttons */
.back-button {
    background-color: #fd7e14;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 5px;
}

.back-button:hover {
    background-color: #e8650e;
}

.back-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Chapter Navigation Buttons */
.nav-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin: 5px;
}

.nav-button:hover {
    background-color: #1e7e34;
}

.nav-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Commentaries Grid */
.commentaries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.commentary-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.commentary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.commentary-card h3 {
    color: #8b4513;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.commentary-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 500;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.book-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.book-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.book-introduction {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.book-introduction.truncated::after {
    content: '...';
    position: absolute;
    bottom: 0;
    right: 0;
    background: white;
    padding-left: 10px;
}

.book-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #6c757d;
}

.open-book-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    transition: background-color 0.3s;
}

.open-book-button:hover {
    background-color: #218838;
}

/* Chapters Grid */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.chapter-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.chapter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.chapter-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.chapter-stats {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Chapter Content */
.chapter-introduction {
    background-color: #f8f9fa;
    border-left: 4px solid #8b4513;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 0 4px 4px 0;
}

.chapter-introduction h3 {
    color: #8b4513;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.chapter-content {
    line-height: 1.8;
}

/* Verse styling */
.verse {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

.verse-number {
    font-weight: bold;
    color: #007bff;
    margin-right: 10px;
    font-size: 1.1rem;
}

.verse-text {
    font-size: 1rem;
    color: #2c3e50;
    line-height: 1.7;
}

/* Verse controls */
.verse-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.control-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.control-btn:hover {
    background-color: #218838;
}

.verse-count {
    color: #6c757d;
    font-size: 0.9rem;
    margin-left: auto;
}

/* Collapsible verse styling */
.verse.collapsible {
    margin-bottom: 5px;
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.verse.collapsible:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.verse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    user-select: none;
}

.verse-header:hover {
    background-color: #e9ecef;
}

.verse-toggle {
    font-size: 1rem;
    color: #6c757d;
    transition: transform 0.3s ease;
}

.verse-content {
    padding: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.verse-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

/* Commentary heading styling */
.commentary-heading {
    font-size: 1.3rem;
    color: #8b4513;
    margin: 25px 0 15px 0;
    font-weight: 600;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #8b4513;
}

/* Loading and Error States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px;
}

.error.hidden {
    display: none;
}

.error-content {
    text-align: center;
    background-color: #f8d7da;
    color: #721c24;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    max-width: 400px;
}

.error-content h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.retry-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 15px;
    transition: background-color 0.3s;
}

.retry-button:hover {
    background-color: #c82333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .nav-container {
        padding: 0 10px;
    }
    
    .nav-title {
        font-size: 1.2rem;
    }
    
    .nav-home, .nav-switch {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .commentaries-grid,
    .books-grid {
        grid-template-columns: 1fr;
    }
    
    .chapters-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .navigation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .chapter-navigation {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
}