/* Booksmap - Shared Styles */
/* Common CSS for all book mind maps */

/* CSS Custom Properties for Theming */
:root {
    /* Default theme - can be overridden per book */
    --accent-color: #ff6b35;
    --accent-color-dark: #e55a25;
    --accent-gradient: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    --section-title-bg: #4a5568;
    --key-box-color: #38b2ac;
    --key-box-bg: #e6fffa;
    --verse-bg: #fff5e6;
    --intro-bg: #fff5e6;

    /* Common colors */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-dark: #2d3748;
    --text-medium: #4a5568;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --white: #ffffff;
    --highlight-color: #fef3c7;
    --highlight-hover: #fde68a;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    padding: 20px;
    min-height: 100vh;
}

/* Container Styles */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.container-narrow {
    max-width: 900px;
}

/* Typography */
h1 {
    color: var(--accent-color);
    margin-bottom: 10px;
    font-size: 2.5em;
}

h1.chapter-title {
    font-size: 2.2em;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
    font-style: italic;
}

.authors {
    color: var(--text-dark);
    margin-bottom: 20px;
    font-weight: 600;
}

/* Book Header Variants */
.book-hero {
    margin-bottom: 26px;
}

.book-hero--option1 {
    text-align: center;
    padding: 8px 0 12px;
}

.book-hero--option2 {
    text-align: center;
    padding: 8px 0 14px;
}

.book-title-main {
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.book-tagline {
    color: var(--text-light);
    font-size: 1.28em;
    font-style: italic;
    line-height: 1.45;
    max-width: 900px;
    margin: 0 auto 12px;
}

.book-author-line {
    color: var(--text-dark);
    font-size: 1.02em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.book-hero-divider {
    width: 96px;
    height: 3px;
    margin: 6px auto 14px;
    border-radius: 999px;
    background: var(--accent-gradient);
}

.book-meta-line {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 1.08em;
    line-height: 1.45;
    flex-wrap: wrap;
}

.book-meta-line--option1 {
    margin-top: 2px;
}

.book-tagline-inline {
    font-style: italic;
    color: var(--text-light);
}

.book-meta-dot {
    color: var(--accent-color);
    font-weight: 700;
}

.book-author-inline {
    color: var(--text-dark);
    font-weight: 700;
    font-style: normal;
}

.chapter-meta {
    color: var(--text-light);
    margin-bottom: 30px;
    font-style: italic;
}

/* Navigation */
.back-button {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: 600;
}

.back-button:hover {
    text-decoration: underline;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 0.95em;
    color: var(--text-medium);
}

.breadcrumb-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.breadcrumb-link:hover {
    text-decoration: underline;
    color: var(--accent-color-dark);
}

.breadcrumb-separator {
    color: var(--text-light);
    font-weight: 300;
    user-select: none;
}

.breadcrumb-current {
    color: var(--text-medium);
    font-weight: 600;
}

/* Introduction Box */
.intro {
    background: var(--intro-bg);
    padding: 24px 28px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-left: 5px solid var(--accent-color);
}

.intro h2 {
    color: var(--accent-color);
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 1.25em;
}

.intro h2:first-child {
    margin-top: 0;
}

.intro p {
    color: var(--text-medium);
    line-height: 1.8;
    margin-bottom: 14px;
}

.intro p:last-child {
    margin-bottom: 0;
}

/* Epigraph / Philosophy Quote */
.philosophy {
    text-align: center;
    margin: 0 auto 28px;
    max-width: 780px;
    padding: 0 16px;
    border: none;
    background: none;
    font-style: italic;
    color: var(--text-medium);
    line-height: 1.75;
    font-size: 1em;
}

.philosophy cite {
    display: block;
    margin-top: 8px;
    font-style: normal;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-light);
    letter-spacing: 0.02em;
}

/* Central Node (Mindmap) */
.central-node {
    background: var(--accent-gradient);
    color: var(--white);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Mindmap Layout */
.mindmap {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Section Styles */
.section {
    margin: 30px 0;
}

.section-title {
    background: var(--section-title-bg);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 15px;
}

.section h2 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.section p {
    color: var(--text-medium);
    line-height: 1.8;
    margin-bottom: 15px;
    text-align: justify;
}

/* Chapters Grid */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Chapter Cards */
.chapter-card {
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.chapter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-color: var(--accent-color);
}

.chapter-number {
    display: inline-block;
    background: var(--accent-color);
    color: var(--white);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.chapter-name {
    color: var(--text-dark);
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.chapter-sanskrit,
.chapter-subtitle {
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.chapter-description {
    color: var(--text-medium);
    line-height: 1.6;
    font-size: 0.95em;
}

.verse-count,
.skill-count {
    color: #805ad5;
    font-size: 0.85em;
    margin-top: 10px;
    font-weight: 600;
}

/* Verse Styles (for Bhagavad Gita and similar) */
.verse {
    background: var(--verse-bg);
    border-left: 4px solid var(--accent-color);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.verse-number {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 8px;
    display: block;
    background: none;
    padding: 0;
    border-radius: 0;
}

.verse-text {
    font-style: italic;
    color: var(--text-medium);
    line-height: 1.8;
}

/* Technique Box (for How to Talk) */
.technique {
    background: var(--verse-bg);
    border-left: 4px solid var(--accent-color);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.technique-name {
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 8px;
    display: block;
}

.technique-description {
    color: var(--text-medium);
    line-height: 1.8;
}

/* Example Dialogue */
.example-dialogue {
    background: #f0f4f8;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.example-dialogue h4 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1em;
}

.dialogue-line {
    margin: 10px 0;
    padding-left: 15px;
    border-left: 3px solid transparent;
}

.dialogue-line.parent {
    border-left-color: var(--accent-color);
}

.dialogue-line.child {
    border-left-color: #805ad5;
}

.dialogue-line .speaker {
    font-weight: 600;
    margin-right: 8px;
}

.dialogue-line.parent .speaker {
    color: var(--accent-color);
}

.dialogue-line.child .speaker {
    color: #805ad5;
}

/* Instead vs. Instead of comparison */
.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.comparison-item {
    padding: 15px;
    border-radius: 8px;
}

.comparison-item.dont {
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
}

.comparison-item.do {
    background: #f0fff4;
    border-left: 4px solid #38a169;
}

.comparison-item h4 {
    margin-bottom: 10px;
    font-size: 0.9em;
}

.comparison-item.dont h4 {
    color: #e53e3e;
}

.comparison-item.do h4 {
    color: #38a169;
}

/* Skill Box */
.skill-box {
    background: linear-gradient(135deg, #f6f9fc 0%, #edf2f7 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.skill-box h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

.skill-steps {
    list-style: none;
    counter-reset: step;
}

.skill-steps li {
    position: relative;
    padding-left: 40px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.skill-steps li::before {
    content: counter(step);
    counter-increment: step;
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: var(--accent-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85em;
}

/* Key Points / Teachings Box */
.key-points,
.key-teachings {
    background: var(--key-box-bg);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid var(--key-box-color);
    margin: 20px 0;
}

.key-points h3,
.key-teachings h3 {
    color: var(--key-box-color);
    margin-bottom: 15px;
}

.key-points ul,
.key-teachings ul {
    color: var(--text-dark);
    line-height: 1.8;
    margin-left: 20px;
}

.key-teachings ul {
    list-style-position: inside;
    margin-left: 0;
}

/* Highlight Text */
.highlight {
    background: var(--highlight-color);
    padding: 2px 5px;
    border-radius: 3px;
}

/* Chapter Content (markdown-generated pages) */
/* The CSS reset strips all default browser styles, so we re-apply readable
   typography for every element that markdown-it can produce inside .chapter-content */
.chapter-content {
    color: var(--text-medium);
    line-height: 1.8;
    font-size: 1em;
}

.chapter-content h2 {
    color: var(--text-dark);
    font-size: 1.5em;
    margin-top: 36px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.chapter-content h3 {
    color: var(--text-dark);
    font-size: 1.2em;
    margin-top: 24px;
    margin-bottom: 10px;
}

.chapter-content h4 {
    color: var(--text-dark);
    font-size: 1.05em;
    margin-top: 18px;
    margin-bottom: 8px;
}

.chapter-content p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--text-medium);
}

.chapter-content ul,
.chapter-content ol {
    margin: 0 0 16px 28px;
    line-height: 1.8;
    color: var(--text-medium);
}

.chapter-content li {
    margin-bottom: 6px;
}

.chapter-content li > ul,
.chapter-content li > ol {
    margin-top: 6px;
    margin-bottom: 0;
}

.chapter-content blockquote {
    border-left: 4px solid var(--accent-color);
    background: var(--intro-bg);
    margin: 24px 0;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    color: var(--text-dark);
    font-style: italic;
}

.chapter-content blockquote p {
    margin-bottom: 0;
    line-height: 1.7;
}

.chapter-content strong {
    color: var(--text-dark);
    font-weight: 700;
}

.chapter-content em {
    font-style: italic;
}

.chapter-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 32px 0;
}

/* Chapter Navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.chapter-nav a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.chapter-nav a:hover {
    background: var(--accent-color);
    color: var(--white);
}

.chapter-nav a.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* User Highlights */
.user-highlight {
    background: var(--highlight-color);
    padding: 1px 0;
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-highlight:hover {
    background: var(--highlight-hover);
}

/* Highlight Action Button */
#highlight-btn {
    position: absolute;
    display: none;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: var(--accent-color);
    color: var(--white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

#highlight-btn:hover {
    transform: scale(1.05);
    background: var(--accent-color-dark);
}

/* Remove Highlight Tooltip */
#highlight-tooltip {
    position: absolute;
    display: none;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 8px;
    z-index: 1001;
}

.remove-highlight-btn {
    background: #ef4444;
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.remove-highlight-btn:hover {
    background: #dc2626;
}

/* Common Mistake Box */
.common-mistake {
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.common-mistake h4 {
    color: #e53e3e;
    margin-bottom: 10px;
}

/* Success Story Box */
.success-story {
    background: #f0fff4;
    border-left: 4px solid #38a169;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 5px;
}

.success-story h4 {
    color: #38a169;
    margin-bottom: 10px;
}

/* Quick Reference Card */
.quick-reference {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 2px solid #d6bcfa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.quick-reference h4 {
    color: #805ad5;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    h1.chapter-title {
        font-size: 1.6em;
    }

    .book-tagline {
        font-size: 1.05em;
        margin-bottom: 10px;
    }

    .book-author-line {
        font-size: 0.9em;
        letter-spacing: 0.06em;
    }

    .book-meta-line {
        font-size: 0.98em;
        gap: 8px;
        line-height: 1.35;
    }

    .book-meta-dot {
        display: none;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
    }

    .chapter-nav {
        flex-direction: column;
        gap: 10px;
    }

    .chapter-nav a {
        text-align: center;
    }

    .comparison {
        grid-template-columns: 1fr;
    }

    #highlight-btn {
        padding: 10px 18px;
        font-size: 16px;
    }
}
