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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #1a1a1a;
    color: #333;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Back to Home Button */
.back-home-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    z-index: 1001;
}

.back-home-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    transform: translateX(-3px);
}

.back-home-btn svg {
    flex-shrink: 0;
}

/* Reader Chrome (Top Bar) */
.reader-chrome {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
}

.chrome-left,
.chrome-center,
.chrome-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chrome-center {
    flex: 1;
    justify-content: center;
}

.chrome-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
}

.chrome-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.page-counter {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 400;
}

.zoom-level {
    font-size: 0.875rem;
}

/* Main Reader Container */
.reader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 100px 2rem 80px;
    position: relative;
}

/* Navigation Arrows */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-arrow:disabled:hover {
    transform: translateY(-50%) scale(1);
}

.nav-arrow-left {
    left: 2rem;
}

.nav-arrow-right {
    right: 2rem;
}

/* Book Wrapper */
.book-wrapper {
    position: relative;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
}

/* Book Page */
.book-page {
    background: #fdfcf8;
    border-radius: 2px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.15),
        0 16px 48px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 700px;
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.book-page::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.03));
    border-radius: 0 2px 2px 0;
}

.book-page.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.book-page.exiting {
    opacity: 0;
    transform: translateX(-30px);
}

/* Page Content */
.page-content {
    padding: 4rem 5rem;
    max-width: 100%;
}

/* Cover Page */
.cover-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 700px;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #C7D2FE 100%);
}

.cover-content {
    text-align: center;
    position: relative;
}

.cover-accent {
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, #6366F1, #818CF8, #A5B4FC);
    margin: 0 auto 2rem;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.cover-title {
    font-family: 'Playfair Display', serif;
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 50%, #818CF8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.cover-subtitle {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 400;
    color: #4F46E5;
    margin-bottom: 2rem;
    font-style: italic;
}

.cover-divider {
    width: 120px;
    height: 2px;
    background: linear-gradient(to right, #6366F1, #818CF8);
    margin: 2rem auto;
    border-radius: 1px;
}

.cover-author {
    font-size: 1rem;
    color: #6366F1;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Typography */
.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    border-bottom: 3px solid #6366F1;
    padding-bottom: 0.75rem;
}

.page-body {
    font-size: 1rem;
    line-height: 1.8;
    color: #444;
}

.page-body h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2a2a2a;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.page-body h4 {
    font-family: 'Inter', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.page-body p {
    margin-bottom: 1rem;
}

.intro-text {
    font-size: 1.25rem;
    font-style: italic;
    color: #555;
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* Lists */
.principle-list,
.grocery-list {
    list-style: none;
    margin: 1.5rem 0;
}

.principle-list li,
.grocery-list li {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.principle-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #6366F1;
    font-weight: 700;
}

.grocery-list li::before {
    content: '□';
    position: absolute;
    left: 0;
    color: #6366F1;
    font-size: 1.125rem;
}

/* Table of Contents */
.toc {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
}

.toc-item {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.08), rgba(129, 140, 248, 0.05));
    border-left: 4px solid #6366F1;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.toc-item:hover {
    background: linear-gradient(to right, rgba(99, 102, 241, 0.15), rgba(129, 140, 248, 0.1));
    transform: translateX(8px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    border-left-color: #818CF8;
}

.toc-number {
    font-weight: 700;
    color: #6366F1;
    font-size: 0.95rem;
}

.toc-title {
    font-weight: 500;
    color: #1F2937;
}

.toc-page {
    color: #6366F1;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Macro Sections */
.macro-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(165, 180, 252, 0.08));
    border-radius: 12px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.macro-section h3 {
    margin-top: 0;
    color: #6366F1;
    font-weight: 700;
}

.macro-detail p {
    margin-bottom: 0.5rem;
}

/* Timing Options */
.timing-option {
    margin: 1.5rem 0;
    padding: 1.2rem;
    padding-left: 1.5rem;
    border-left: 4px solid #6366F1;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.05), transparent);
    border-radius: 0 8px 8px 0;
}

.timing-option h4 {
    margin-top: 0;
}

/* Meal Tables */
.meal-plan {
    margin: 2rem 0;
}

.meal-plan h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.meal-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.meal-table tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.meal-table td {
    padding: 1rem 0.5rem;
    vertical-align: top;
}

.meal-label {
    font-weight: 700;
    color: #6366F1;
    width: 120px;
}

/* Weekly Table */
.weekly-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
}

.weekly-table th {
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    color: #ffffff;
    padding: 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
}

.weekly-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.weekly-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* Grocery Sections */
.grocery-section {
    margin: 2rem 0;
}

.grocery-section h3 {
    color: #6366F1;
    border-bottom: 3px solid #6366F1;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

/* Supplement Sections */
.supplement-tier {
    margin: 2rem 0;
}

.supplement-tier h3 {
    color: #6366F1;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.supplement-item {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(165, 180, 252, 0.08));
    border-radius: 12px;
    border: 2px solid rgba(99, 102, 241, 0.15);
}

.supplement-item h4 {
    margin-top: 0;
    color: #2a2a2a;
}

/* FAQ Items */
.faq-item {
    margin: 2rem 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item h4 {
    color: #6366F1;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

/* Callout Boxes */
.callout {
    background: linear-gradient(to right, rgba(99, 102, 241, 0.12), rgba(165, 180, 252, 0.08));
    border-left: 5px solid #6366F1;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 12px 12px 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.callout p {
    margin-bottom: 0;
}

/* Action Steps */
.action-steps {
    margin: 2rem 0;
}

.action-step {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 0;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366F1, #818CF8);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.step-content h4 {
    margin-top: 0;
}

/* CTA Section */
.cta-section {
    margin-top: 3rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(165, 180, 252, 0.1));
    border-radius: 16px;
    text-align: center;
    border: 2px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.cta-section h3 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #2a2a2a;
    margin-bottom: 1rem;
}

.cta-section ul {
    text-align: left;
    max-width: 500px;
    margin: 1.5rem auto;
    list-style: none;
}

.cta-section li {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    position: relative;
}

.cta-section li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #6366F1;
    font-weight: 700;
}

.cta-button {
    background: linear-gradient(135deg, #6366F1, #818CF8);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #4F46E5, #6366F1);
}

/* Final Page */
.final-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 700px;
}

.final-content {
    text-align: center;
    max-width: 600px;
}

.final-quote {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-style: italic;
    color: #2a2a2a;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.final-divider {
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, #6366F1, #818CF8);
    margin: 2rem auto;
    border-radius: 2px;
}

.final-text {
    font-size: 1.125rem;
    color: #666;
    margin-bottom: 1rem;
}

.final-signature {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-style: italic;
    color: #6366F1;
}

/* Progress Bar */
.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #6366F1, #818CF8, #A5B4FC);
    width: 8.33%;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 60px;
    right: -320px;
    width: 320px;
    height: calc(100vh - 60px);
    background: rgba(26, 26, 26, 0.98);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.sidebar-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-thumbnails {
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.thumbnail {
    aspect-ratio: 8.5 / 11;
    background: #fdfcf8;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.thumbnail:hover {
    transform: scale(1.05);
    border-color: #6366F1;
}

.thumbnail.active {
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.thumbnail-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    font-size: 0.75rem;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-arrow-left {
        left: 1rem;
    }
    
    .nav-arrow-right {
        right: 1rem;
    }
    
    .page-content {
        padding: 3rem 3rem;
    }
}

@media (max-width: 768px) {
    .back-home-btn {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .reader-chrome {
        padding: 0 1rem;
    }
    
    .chrome-left,
    .chrome-right {
        gap: 0.5rem;
    }
    
    .zoom-btn .zoom-level {
        display: none;
    }
    
    .reader-container {
        padding: 80px 1rem 60px;
    }
    
    .nav-arrow {
        width: 40px;
        height: 40px;
    }
    
    .nav-arrow-left {
        left: 0.5rem;
    }
    
    .nav-arrow-right {
        right: 0.5rem;
    }
    
    .page-content {
        padding: 2rem 1.5rem;
    }
    
    .cover-title {
        font-size: 3rem;
    }
    
    .cover-subtitle {
        font-size: 1.25rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .page-body {
        font-size: 0.95rem;
    }
    
    .sidebar {
        width: 280px;
        right: -280px;
    }
    
    .sidebar-thumbnails {
        grid-template-columns: 1fr;
    }
    
    .weekly-table {
        font-size: 0.8rem;
    }
    
    .weekly-table th,
    .weekly-table td {
        padding: 0.5rem;
    }
    
    .toc-item {
        grid-template-columns: 50px 1fr auto;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .cover-title {
        font-size: 2.25rem;
    }
    
    .cover-subtitle {
        font-size: 1rem;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-content {
        padding: 1.5rem 1rem;
    }
    
    .action-step {
        flex-direction: column;
        gap: 1rem;
    }
    
    .cta-section {
        padding: 1.5rem;
    }
    
    .cta-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Smooth scrolling for sidebar */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.5) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.7);
}