/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem 0;
    text-align: center;
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    text-align: center;
}

.back-link {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    color: white;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo i {
    font-size: 2.2rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main {
    padding: 3rem 0;
}

/* Cards */
.upload-card,
.chapter-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    text-align: center;
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1.5rem;
}

.upload-card h2,
.chapter-card h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.upload-card p {
    color: #666;
    margin-bottom: 1rem;
}

.upload-info {
    margin-bottom: 2rem;
}

.upload-limits {
    display: block;
    color: #666;
    font-size: 0.9rem;
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 3px solid #007bff;
}

.upload-limits i {
    color: #007bff;
    margin-right: 0.5rem;
}

/* Error Information Display */
.error-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.error-icon {
    color: #dc3545;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.error-content h4 {
    color: #721c24;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.error-content p {
    color: #721c24;
    margin-bottom: 0.5rem;
}

.error-note {
    font-style: italic;
    font-size: 0.9rem;
    opacity: 0.8;
}

.error-message {
    color: #dc3545;
    font-style: italic;
    text-align: center;
    padding: 1rem;
    background: #f8d7da;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Admin Controls */
.admin-controls {
    margin-left: auto;
}

.admin-controls .btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.admin-delete-btn {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    margin-left: 0.5rem;
}

.admin-delete-btn:hover {
    background: #c82333;
    border-color: #bd2130;
}

.admin-delete-btn:disabled {
    background: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
}

/* Login Page Styles */
.login-section {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 0.95rem;
}

.login-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.login-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
}

.login-info p {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.login-info ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #666;
}

.login-info li {
    margin-bottom: 0.25rem;
}

/* Alert Styles */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert i {
    font-size: 1.1rem;
}

/* Browse Page Styles */
.browse-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.browse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.browse-header h2 {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

.browse-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 1rem;
    color: #666;
    z-index: 1;
}

.search-box input {
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    width: 300px;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls label {
    font-weight: 500;
    color: #666;
}

.sort-controls select {
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.browse-stats {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.browse-stats span {
    font-weight: 500;
    color: #666;
}

/* AI Disclaimer Styles */
.ai-disclaimer {
    margin: 1.5rem 0;
    padding: 0 1rem;
}

.disclaimer-content {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #f39c12;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.1);
}

.disclaimer-content i {
    color: #f39c12;
    font-size: 1.2rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.disclaimer-text {
    color: #8b4513;
    font-size: 0.9rem;
    line-height: 1.5;
}

.disclaimer-text strong {
    color: #d35400;
}

/* About Page AI Disclaimer */
.ai-disclaimer-section {
    margin: 2rem 0;
    padding: 0 1rem;
}

.ai-disclaimer-section .disclaimer-content {
    background: linear-gradient(135deg, #ffe6e6 0%, #ffcccc 100%);
    border: 1px solid #e74c3c;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.1);
}

.ai-disclaimer-section .disclaimer-content i {
    color: #e74c3c;
    font-size: 1.5rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.ai-disclaimer-section .disclaimer-text h4 {
    color: #c0392b;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.ai-disclaimer-section .disclaimer-text p {
    color: #8b0000;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.ai-disclaimer-section .disclaimer-text p:last-child {
    margin-bottom: 0;
}

.ai-disclaimer-section .disclaimer-text strong {
    color: #a93226;
}

.study-guides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.study-guide-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.study-guide-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.study-guide-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.study-guide-cover {
    flex: 0 0 auto;
    width: 80px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.study-guide-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.study-guide-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.study-guide-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.study-guide-author,
.study-guide-year {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

.study-guide-author i,
.study-guide-year i {
    color: #667eea;
}

.study-guide-details {
    margin-bottom: 1rem;
}

.study-guide-isbn,
.study-guide-publisher,
.study-guide-chapters,
.study-guide-no-isbn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.study-guide-isbn i,
.study-guide-publisher i,
.study-guide-chapters i,
.study-guide-no-isbn i {
    color: #667eea;
    width: 16px;
}

.study-guide-no-isbn {
    color: #999;
    font-style: italic;
}

.study-guide-summary {
    color: #666;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.view-more-link {
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.view-more-link:hover {
    color: #5a6fd8;
    text-decoration: none;
}

/* SweetAlert2 Book Details Modal Styling */
.book-details-popup {
    font-family: 'Inter', sans-serif;
}

.book-details-modal {
    text-align: left;
}

.book-details-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1rem;
}

.book-details-header h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.book-author {
    color: #666;
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-author i {
    color: #667eea;
}

.book-details-meta {
    margin-bottom: 1.5rem;
}

.book-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #666;
    font-size: 0.95rem;
}

.book-meta-item i {
    color: #667eea;
    width: 16px;
}

.book-details-summary h4 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.summary-content {
    color: #666;
    line-height: 1.6;
}

.summary-content p {
    margin-bottom: 1rem;
    color: #666;
    line-height: 1.6;
}

.summary-content p:last-child {
    margin-bottom: 0;
}

.summary-content strong {
    color: #333;
    font-weight: 600;
}

.summary-content em {
    color: #555;
    font-style: italic;
}

.study-guide-actions {
    display: flex;
    justify-content: flex-end;
}

.add-to-library-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-to-library-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.added-to-library {
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
    cursor: default;
    opacity: 0.9;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.added-to-library i {
    margin-right: 0.5rem;
}

.empty-browse,
.loading-browse {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-browse i,
.loading-browse i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-browse h3,
.loading-browse p {
    margin-bottom: 0.5rem;
}

.loading-browse i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e1e5e9;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 40px;
    justify-content: center;
}

.pagination-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-btn:disabled:hover {
    background: white;
    color: #667eea;
    border-color: #e1e5e9;
}

.pagination-ellipsis {
    padding: 0.5rem;
    color: #6c757d;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .browse-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .browse-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Responsive disclaimer */
    .disclaimer-content {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .disclaimer-content i {
        align-self: center;
        margin-top: 0;
    }
    
    .disclaimer-text {
        text-align: center;
        font-size: 0.85rem;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .study-guides-grid {
        grid-template-columns: 1fr;
    }
    
    /* Responsive pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.75rem;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        min-width: 35px;
    }
    
    .pagination-btn span {
        display: none;
    }
    
    .pagination-btn i {
        margin: 0;
    }
    
    .study-guide-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    /* Smaller screen pagination */
    .pagination {
        gap: 0.2rem;
        padding: 0.5rem;
    }
    
    .pagination-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-width: 30px;
    }
}

/* File Input */
.file-input-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: #f8f9fa;
    border: 2px dashed #667eea;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #667eea;
}

.file-input-label:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.file-name {
    display: block;
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e9ecef;
}

.btn-secondary:hover:not(:disabled) {
    background: #e9ecef;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

/* Progress Bar */
.upload-progress {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
}

/* Chapter Selection */
.book-title {
    font-size: 1.2rem;
    color: #667eea;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.chapter-list {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chapter-item:hover {
    background: #e9ecef;
}

.chapter-item.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.chapter-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.chapter-info {
    flex: 1;
}

.chapter-number {
    font-weight: 600;
    color: #667eea;
}

.chapter-item.selected .chapter-number {
    color: white;
}

.chapter-title {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
}

.chapter-item.selected .chapter-title {
    color: rgba(255, 255, 255, 0.9);
}

.chapter-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Library */
.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.library-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    text-decoration: none;
}

.library-header h2 {
    font-size: 2rem;
    color: white;
    font-weight: 600;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.book-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-height: 450px;
    position: relative;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Book Cover Container */
.book-cover-container {
    width: 120px;
    height: 160px;
    margin: 0 auto 1rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-cover-placeholder {
    opacity: 1;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #333;
}

.book-author {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.book-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.book-summary {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    max-height: 4.5em; /* Approximately 3 lines of text */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Full summary for modal view - no height restrictions */
.modal .book-summary {
    max-height: none;
    overflow: visible;
    display: block;
    -webkit-line-clamp: none;
    -webkit-box-orient: initial;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* Chapter summary content with proper paragraph spacing */
.chapter-summary-content {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.chapter-summary-content p {
    margin-bottom: 1rem;
    color: #555;
}

.chapter-summary-content p:last-child {
    margin-bottom: 0;
}

.book-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.book-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    gap: 1rem;
}

.study-guide-status {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* View Button */
.view-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.view-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.view-btn:active {
    transform: translateY(0);
}

/* Status Indicators */
.status-pending {
    color: #ffc107;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: default;
}

.status-error {
    color: #dc3545;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-error:hover {
    color: #c82333;
    text-decoration: underline;
}

.status-processing {
    color: #17a2b8;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: default;
}

/* Study Guide Modal Styles */
.qa-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.qa-item h6 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.qa-item p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Section spacing */
.modal-body h5 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.modal-body h5:first-of-type {
    margin-top: 1rem;
}

/* Key Terms Section */
.key-terms-section {
    margin-bottom: 1.5rem;
}

.key-term-item {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #28a745;
    line-height: 1.5;
}

.key-term-item strong {
    color: #28a745;
    font-weight: 600;
}

.term-context {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
    border-left: 2px solid #28a745;
    font-style: italic;
    color: #495057;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Key Concepts */
.modal-body ul {
    margin-bottom: 1.5rem;
}

.modal-body ul li {
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #17a2b8;
    line-height: 1.5;
}

/* Practical Applications */
.modal-body ul li:last-child {
    margin-bottom: 0;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.difficulty-badge.easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-badge.hard {
    background: #f8d7da;
    color: #721c24;
}

/* Regenerate Link */
.regenerate-link {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 400;
    transition: all 0.2s ease;
    display: inline-block;
    margin-top: 0.25rem;
}

.regenerate-link:hover {
    color: #495057;
    text-decoration: underline;
}


.empty-library {
    text-align: center;
    color: white;
    padding: 3rem;
}

.empty-library i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-library h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-library p {
    opacity: 0.8;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #333;
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
}

/* Chapter Content */
.chapters-container h3 {
    margin-bottom: 1rem;
    color: #333;
}

.chapters-list {
    display: grid;
    gap: 0.75rem;
}

.chapter-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.chapter-link:hover {
    background: #667eea;
    color: white;
}

.chapter-link i {
    font-size: 1.2rem;
    color: #667eea;
}

.chapter-link:hover i {
    color: white;
}

.chapter-link-info {
    flex: 1;
}

.chapter-link-number {
    font-weight: 600;
    color: #667eea;
}

.chapter-link:hover .chapter-link-number {
    color: white;
}

.chapter-link-title {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
}

.chapter-link:hover .chapter-link-title {
    color: rgba(255, 255, 255, 0.9);
}

/* Study Guide */
.chapter-summary {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #667eea;
}

.chapter-summary h4 {
    color: #333;
    margin-bottom: 0.5rem;
}

.study-guide {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
}

.study-guide h4 {
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.key-concepts {
    margin-bottom: 2rem;
}

.key-concepts h5 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.concept-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.concept-tag {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.questions {
    margin-bottom: 2rem;
}

.question-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid #28a745;
}

.question {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.answer {
    color: #555;
    line-height: 1.6;
}

.difficulty {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.difficulty.easy {
    background: #d4edda;
    color: #155724;
}

.difficulty.medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty.hard {
    background: #f8d7da;
    color: #721c24;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1.2rem;
    font-weight: 500;
}

.loading-explanation {
    font-size: 0.9rem !important;
    font-weight: 400 !important;
    opacity: 0.8;
    margin-top: 0.5rem;
    max-width: 400px;
    line-height: 1.4;
    text-align: center;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 3000;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #28a745;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .upload-card,
    .chapter-card {
        padding: 1.5rem;
    }
    
    .library-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .library-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .chapter-actions {
        flex-direction: column;
    }
    
    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        min-width: auto;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .header,
    .modal-header,
    .modal-footer {
        display: none;
    }
    
    .modal {
        position: static;
        background: white;
    }
    
    .modal-content {
        box-shadow: none;
        border: none;
    }
    
    .modal-body {
        max-height: none;
        overflow: visible;
    }
    
    .study-guide {
        border: 1px solid #333;
    }
    
    .question-item {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* About Page Styles */
.about-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
}

.about-header {
    text-align: center;
    margin-bottom: 3rem;
}

.about-header h2 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 1rem;
}

.about-intro {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto 2rem auto;
    line-height: 1.6;
}

/* About Page Navigation */
.about-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.nav-link {
    padding: 0.75rem 1.5rem;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link i {
    font-size: 0.9rem;
    opacity: 0.8;
}

.nav-link:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-decoration: none;
}

/* Section IDs for smooth scrolling */
#our-story,
#perfect-for,
#key-features,
#privacy-local,
#technical-specs,
#how-it-works,
#important-notes {
    scroll-margin-top: 100px;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.about-content h3 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.about-content h3 i {
    color: #667eea;
}

.about-story,
.about-features,
.about-privacy,
.about-technical,
.about-how-it-works,
.about-purpose,
.about-footer {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.about-story p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 1.5rem;
}

.about-story ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.about-story li {
    margin-bottom: 0.5rem;
    color: #555;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.feature-card h4 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: #666;
    line-height: 1.5;
}

.privacy-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.privacy-point {
    padding: 1.5rem;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.privacy-point h4 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.privacy-point h4 i {
    color: #667eea;
}

.privacy-point p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.privacy-point ul {
    margin: 0;
    padding-left: 1.5rem;
}

.privacy-point li {
    margin-bottom: 0.5rem;
    color: #555;
}

/* Technical Specifications Styles */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.spec-card {
    padding: 1.5rem;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.spec-card h4 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spec-card h4 i {
    color: #667eea;
}

.spec-details p {
    margin-bottom: 0.75rem;
    color: #555;
    line-height: 1.5;
}

.spec-details strong {
    color: #333;
}

/* Compatibility Check Styles */
.compatibility-check {
    margin-top: 0.5rem;
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.check-label {
    font-weight: 500;
    color: #333;
}

.check-status {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compatibility-info {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.compatibility-message {
    margin: 0 0 1rem 0;
    font-weight: 500;
    line-height: 1.5;
}

.compatibility-tips {
    background: #fff3cd;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #ffeaa7;
}

.compatibility-tips h5 {
    margin: 0 0 0.75rem 0;
    color: #856404;
    font-size: 1rem;
}

.tips-list {
    margin: 0;
    padding-left: 1.5rem;
}

.tips-list li {
    margin-bottom: 0.5rem;
    color: #856404;
    line-height: 1.4;
}

.optimization-tips {
    margin-bottom: 2rem;
}

.optimization-tips h4 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.optimization-tips h4 i {
    color: #f39c12;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    padding: 1.5rem;
    background: #fff8e1;
    border-radius: 8px;
    border: 1px solid #ffecb3;
    transition: all 0.3s ease;
}

.tip-card:hover {
    background: #fff3c4;
    transform: translateY(-2px);
}

.tip-icon {
    font-size: 2rem;
    color: #f39c12;
    margin-bottom: 1rem;
}

.tip-card h5 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 1rem;
}

.tip-card ul {
    margin: 0;
    padding-left: 1.5rem;
}

.tip-card li {
    margin-bottom: 0.75rem;
    color: #555;
    line-height: 1.5;
}

.tip-card li strong {
    color: #333;
}

.performance-notes {
    background: #e8f5e8;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #4caf50;
}

.performance-notes h4 {
    font-size: 1.3rem;
    color: #2d5a2d;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.performance-notes h4 i {
    color: #4caf50;
}

.notes-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.note-item {
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #4caf50;
}

.note-item h5 {
    font-size: 1.1rem;
    color: #2d5a2d;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-item h5 i {
    color: #4caf50;
}

.note-item p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9ff;
    border-radius: 8px;
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.step-content h4 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.step-content p {
    color: #666;
    line-height: 1.5;
}

.purpose-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.purpose-item {
    text-align: center;
    padding: 1.5rem;
    background: #f8f9ff;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.purpose-item:hover {
    background: #e8edff;
    transform: translateY(-2px);
}

.purpose-item i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.purpose-item h4 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.75rem;
}

.purpose-item p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.about-footer {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.footer-note {
    padding: 1.5rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
}

.footer-note h4 {
    font-size: 1.2rem;
    color: #856404;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-note h4 i {
    color: #f39c12;
}

.footer-note p {
    color: #856404;
    line-height: 1.6;
}

.footer-contact {
    text-align: center;
    padding: 1.5rem;
    background: #e8f5e8;
    border-radius: 8px;
}

.footer-contact p {
    color: #2d5a2d;
    margin-bottom: 0.5rem;
}

.footer-contact em {
    color: #4a7c59;
    font-style: italic;
}

/* About Page Responsive Design */
@media (max-width: 768px) {
    .about-section {
        padding: 1rem;
    }
    
    .about-header h2 {
        font-size: 2rem;
    }
    
    .about-intro {
        font-size: 1.1rem;
    }
    
    .about-nav {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .nav-link {
        text-align: center;
        padding: 0.75rem 1rem;
    }
    
    /* Responsive About page disclaimer */
    .ai-disclaimer-section .disclaimer-content {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.25rem;
    }
    
    .ai-disclaimer-section .disclaimer-content i {
        align-self: center;
        margin-top: 0;
        font-size: 1.3rem;
    }
    
    .ai-disclaimer-section .disclaimer-text {
        text-align: center;
    }
    
    .ai-disclaimer-section .disclaimer-text h4 {
        font-size: 1rem;
    }
    
    .ai-disclaimer-section .disclaimer-text p {
        font-size: 0.85rem;
    }
    
    .about-content {
        gap: 2rem;
    }
    
    .about-story,
    .about-features,
    .about-privacy,
    .about-technical,
    .about-how-it-works,
    .about-purpose,
    .about-footer {
        padding: 1.5rem;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .notes-content {
        gap: 1rem;
    }
    
    .check-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .check-status {
        align-self: flex-end;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .purpose-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .step {
        flex-direction: column;
        text-align: center;
    }
    
    .step-number {
        align-self: center;
    }
}
