/* Main Styles for Daily Spiritual Practices Ebook */

/* Base Styles and Variables */
:root {
    --primary-color: #007bff;
    --secondary-color: #192380;
    --accent-color: #6610f2;
    --light-bg: #f8f9fa;
    --text-color: #333;
    --dark-text: #212529;
    --light-text: #6c757d;
    --link-color: #007bff;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --max-content-width: 800px;
    --header-font: 'Merriweather', Georgia, serif;
    --body-font: 'Open Sans', Arial, sans-serif;
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--body-font);
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--header-font);
    line-height: 1.3;
    color: var(--secondary-color);
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2.2rem;
}

h2 {
    font-size: 1.8rem;
    margin-top: 1.5em;
}

h3 {
    font-size: 1.4rem;
    margin-top: 1.2em;
}

p {
    margin-bottom: 1.2em;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Header Styles */
.book-header {
    background: linear-gradient(to right, #192380, #007bff);
    color: white;
    padding: 1.5rem 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    max-width: var(--max-content-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.logo {
    flex: 0 0 150px;
    margin-right: 1rem;
}

.header-right {
    flex: 1;
}

.tagline {
    font-style: italic;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Main Container */
.book-container {
    max-width: var(--max-content-width);
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Book Cover */
.book-cover {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.cover-image {
    max-width: 450px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border-radius: 5px;
    margin-bottom: 1rem;
}

.author-info {
    font-style: italic;
    color: var(--light-text);
}

.publication-date {
    font-size: 0.9rem;
}

/* Book Introduction */
.book-intro {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

/* App Promo */
.app-promo {
    background-color: var(--light-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.app-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 1rem;
}

.app-card {
    flex: 1 1 300px;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.app-icon {
    width: 150px;
    height: 80px;
    margin-bottom: 1rem;
}

.app-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    margin-top: 1rem;
    transition: background-color 0.3s;
}

.app-button:hover {
    background-color: var(--secondary-color);
    text-decoration: none;
}

/* Table of Contents */
.table-of-contents {
    background-color: var(--light-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.toc-list {
    list-style-type: none;
    margin: 1.5rem 0;
}

.toc-list li {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.toc-list li:last-child {
    border-bottom: none;
}

.toc-list a {
    display: block;
    padding: 0.3rem 0;
    color: var(--secondary-color);
    transition: padding 0.3s;
}

.toc-list a:hover {
    padding-left: 0.5rem;
    background-color: rgba(0,0,0,0.03);
    text-decoration: none;
}

.start-reading {
    text-align: center;
    margin-top: 2rem;
}

.start-button {
    display: inline-block;
    background-color: var(--success-color);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 5px;
    font-weight: bold;
    transition: transform 0.3s, background-color 0.3s;
}

.start-button:hover {
    background-color: #218838;
    transform: translateY(-3px);
    text-decoration: none;
}

/* Chapter Page Styles */
.chapter-container {
    max-width: var(--max-content-width);
    margin: 2rem auto;
    padding: 0 1rem;
}

.chapter-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chapter-content {
    margin-bottom: 3rem;
}

/* Chapter Navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.nav-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--light-bg);
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-button:hover {
    background-color: var(--border-color);
    text-decoration: none;
}

.toc-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: white;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

/* Reading Progress Bar */
.progress-container {
    width: 100%;
    height: 5px;
    background-color: var(--light-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.progress-bar {
    height: 5px;
    background-color: var(--primary-color);
    width: 0%;
}

/* Figures and Captions */
figure {
    margin: 2rem 0;
    text-align: center;
}

figcaption {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--light-text);
    margin-top: 0.5rem;
}

/* SVG Container Styles */
.svg-container {
    max-width: 100%;
    overflow-x: auto;
    margin: 2rem 0;
}

.svg-container svg {
    min-width: 700px; /* Ensures the chart remains readable on small screens by allowing horizontal scroll */
}

/* Template Styles */
.template-preview-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1rem;
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    background: #ffffff;
}

.template-preview-container svg {
    min-width: 760px; /* Ensures the tracker remains readable */
}

.download-label {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 5px;
    margin-top: 0.5rem;
    font-weight: bold;
    text-decoration: none;
}

.download-label:hover {
    background: var(--secondary-color);
    text-decoration: none;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--light-text);
}

/* Code Blocks */
pre {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

/* Highlight Box */
.highlight-box {
    background-color: var(--light-bg);
    border-left: 4px solid var(--accent-color);
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 5px 5px 0;
}

.highlight-box h4 {
    margin-top: 0;
    color: var(--accent-color);
}

/* App Integration Box */
.app-integration {
    background-color: #e6f7ff;
    border: 1px solid #bae7ff;
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 5px;
}

.app-integration h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.app-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    margin-top: 0.5rem;
    transition: background-color 0.3s;
}

.app-link:hover {
    background-color: var(--secondary-color);
    text-decoration: none;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 1rem;
}

/* Template Previews */
.template-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 2rem 0;
}

.template {
    flex: 1 1 300px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
}

.template-preview {
    width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.template-link {
    display: block;
    text-decoration: none;
    color: var(--text-color);
}

.template-link:hover .template-preview {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Further Resources Section */
.further-resources {
    background-color: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.further-resources h3 {
    margin-top: 0;
}

.further-resources ul {
    margin-left: 1.5rem;
}

/* Footer */
.book-footer {
    background-color: var(--light-bg);
    padding: 2rem 1rem;
    text-align: center;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.footer-nav {
    margin-bottom: 1rem;
}

.footer-nav a {
    margin: 0 0.5rem;
    color: var(--secondary-color);
}

.copyright {
    font-size: 0.9rem;
    color: var(--light-text);
}

/* Reader Settings Panel */
.reader-settings {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: white;
    border-radius: 50%;
    width: 60px;          /* Increased from 50px */
    height: 60px;         /* Increased from 50px */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 100;
    padding: 8px;         /* Added padding for larger touch area */
}

.settings-icon {
    width: 24px;
    height: 24px;
	pointer-events: none;
}

.settings-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background-color: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 100;
    display: none;
}

.settings-panel.active {
    display: block;
}

.font-size-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.font-button {
    background-color: var(--light-bg);
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    cursor: pointer;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Reading Prompt */
.reading-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}

.prompt-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.prompt-buttons button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.prompt-buttons button:first-child {
    background-color: var(--success-color);
}

/* Dark Theme */
body.dark-theme {
    background-color: #222;
    color: #f0f0f0;
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme h5,
body.dark-theme h6 {
    color: #a0c0ff;
}

body.dark-theme a {
    color: #80b0ff;
}

body.dark-theme .book-header {
    background: linear-gradient(to right, #131b50, #0055b3);
}

body.dark-theme .table-of-contents,
body.dark-theme .app-promo,
body.dark-theme .highlight-box,
body.dark-theme .further-resources {
    background-color: #333;
}

body.dark-theme .app-card {
    background-color: #444;
}

body.dark-theme .toc-list li {
    border-bottom-color: #444;
}

body.dark-theme .toc-list a:hover {
    background-color: rgba(255,255,255,0.05);
}

body.dark-theme .nav-button {
    background-color: #333;
}

body.dark-theme .nav-button:hover {
    background-color: #444;
}

body.dark-theme .toc-button {
    background-color: #333;
    border-color: #444;
}

body.dark-theme .progress-container {
    background-color: #333;
}

body.dark-theme .book-footer {
    background-color: #333;
    border-top-color: #444;
}

body.dark-theme blockquote {
    color: #d0d0d0;
}

body.dark-theme pre {
    background-color: #333;
}

body.dark-theme .reader-settings,
body.dark-theme .settings-panel,
body.dark-theme .reading-prompt {
    background-color: #333;
}

body.dark-theme .font-button {
    background-color: #444;
    color: #f0f0f0;
}

body.dark-theme .app-integration {
    background-color: #334a66;
    border-color: #4a6c94;
}

body.dark-theme .template {
    background-color: #333;
}

body.dark-theme .template-preview {
    border-color: #444;
}

/* Dark theme SVG adjustments */
body.dark-theme .svg-container svg rect[width="800"][height="500"],
body.dark-theme .svg-container svg rect[width="800"][height="600"] {
    fill: #333;
}

body.dark-theme .svg-container svg text {
    fill: #f0f0f0;
}

body.dark-theme .svg-container svg text[fill="#718096"],
body.dark-theme .svg-container svg text[fill="#6c757d"] {
    fill: #a0aec0;
}

body.dark-theme .svg-container svg rect[fill="#ffffff"] {
    fill: #444;
}

body.dark-theme .svg-container svg foreignObject div {
    color: #f0f0f0;
}

body.dark-theme .svg-container svg line,
body.dark-theme .svg-container svg rect[fill="none"] {
    stroke: #555;
}

/* Dark theme template tracker adjustments */
body.dark-theme .template-preview-container {
    background: #333;
    border-color: #444;
}

body.dark-theme .template-preview-container svg rect[width="800"][height="600"] {
    fill: #222;
}

body.dark-theme .template-preview-container svg rect[x="20"][y="20"] {
    fill: #333;
}

body.dark-theme .template-preview-container svg rect[fill="#ffffff"] {
    fill: #444;
}

body.dark-theme .template-preview-container svg text {
    fill: #f0f0f0;
}

body.dark-theme .template-preview-container svg text[fill="#212529"],
body.dark-theme .template-preview-container svg text[fill="#4a5568"],
body.dark-theme .template-preview-container svg text[fill="#6c757d"] {
    fill: #d0d0d0;
}

body.dark-theme .template-preview-container svg line {
    stroke: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    body {
        font-size: 16px;
    }
    
    .header-container {
        flex-direction: column;
        text-align: center;
    }
    
    .logo {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .chapter-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .nav-button, .toc-button {
        font-size: 0.9rem;
    }
    
    .template-previews {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .book-container, .chapter-container {
        padding: 0 0.8rem;
    }
    
    .table-of-contents {
        padding: 1.5rem 1rem;
    }
    
    .app-promo {
        padding: 1rem;
    }
    
    .reader-settings {
        bottom: 10px;
        right: 10px;
    }
    
    .settings-panel {
        bottom: 70px;
        right: 10px;
    }
    
    .button-group {
        flex-direction: column;
    }
}