@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Inter:wght@300;400;500;600;700&family=Mandali&family=NTR&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    /* Color Palette - Minimalist Light Theme */
    --bg-dark: #f8f9fa; /* Map variables to avoid breaking existing PHP style links */
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    
    /* Elegant Accents - Clean Modern Bronze/Amber & Saffron */
    --gold: #854d0e; /* Warm bronze */
    --gold-bright: #b45309; /* Warm amber */
    --gold-glow: rgba(180, 83, 9, 0.05);
    --saffron: #ea580c; /* Modern bright orange */
    --saffron-dark: #c2410c;
    --saffron-glow: rgba(234, 88, 12, 0.05);
    --vermilion: #dc2626; /* Crimson accent */
    
    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-gold: #854d0e;
    
    /* Fonts */
    --font-heading: 'Inter', sans-serif; /* Clean sans-serif for UI */
    --font-body: 'Inter', sans-serif;
    --font-telugu: 'Mandali', 'NTR', sans-serif;
    
    /* Transition */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 60px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.telugu-text {
    font-family: var(--font-telugu);
    font-size: 1.15rem;
    line-height: 1.8;
}

/* Premium Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--saffron), var(--gold-bright), var(--vermilion));
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-section i {
    font-size: 1.8rem;
    color: var(--saffron);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Layout & Flex Utility Classes */
.d-flex {
    display: flex !important;
}
.align-items-center {
    align-items: center !important;
}
.justify-content-between {
    justify-content: space-between !important;
}
.flex-wrap {
    flex-wrap: wrap !important;
}
.gap-2 {
    gap: 8px !important;
}
.gap-3 {
    gap: 16px !important;
}
.gap-4 {
    gap: 24px !important;
}

/* User Badge Compact Header Sizing */
header .content-card {
    padding: 8px 16px !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    margin-bottom: 0 !important;
}

.nav-links {
    display: flex;
    gap: 12px;
}

/* Responsive grid utility class for forms to avoid layout break on mobile */
.grid-form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.grid-form-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .grid-form-2col, .grid-form-3col {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--saffron);
    color: white;
}

.btn-primary:hover {
    background: var(--saffron-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-gold {
    background: var(--gold-bright);
    color: white;
}

.btn-gold:hover {
    background: var(--gold);
    transform: translateY(-1px);
}

.btn-danger {
    background: #fef2f2;
    color: var(--vermilion);
    border-color: #fca5a5;
}

.btn-danger:hover {
    background: var(--vermilion);
    color: white;
    border-color: transparent;
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--saffron);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Grid & Dashboard layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
}

@media(max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

.sidebar-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Sacred Reader Container & Bottom Actions Panel */
.sacred-reader-container {
    max-width: 1000px;
    margin: 0 auto;
}

.sacred-bottom-panel {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
    margin-top: 30px;
}

@media(max-width: 992px) {
    .sacred-bottom-panel {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--saffron);
    box-shadow: 0 0 0 3px var(--saffron-glow);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control option {
    background: #ffffff;
    color: var(--text-primary);
}

/* Category Selection Grid */
.category-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.category-option {
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: 8px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.category-option:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.category-option.active {
    background: var(--saffron-glow);
    border-color: var(--saffron);
}

.category-option i {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.category-option.active i {
    color: var(--saffron);
}

.category-option span {
    font-size: 0.8rem;
    font-weight: 600;
    display: block;
    color: var(--text-primary);
}

/* Category Filter Menu */
.category-menu {
    list-style: none;
}

.category-menu-item {
    margin-bottom: 8px;
}

.category-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.category-menu-link:hover, .category-menu-item.active .category-menu-link {
    background: var(--saffron-glow);
    border-color: var(--saffron);
    color: var(--saffron-dark);
}

.category-menu-link span.count {
    background: rgba(234, 88, 12, 0.1);
    color: var(--saffron-dark);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Content List Card */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.content-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.festival-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.festival-list-item:last-child {
    border-bottom: none;
}

.festival-list-item:hover {
    padding-left: 10px;
}

.festival-item-info h4 {
    font-family: var(--font-telugu);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.festival-item-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.festival-item-info span.tag {
    background: #f3f4f6;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 8px;
    font-weight: 500;
}

.festival-item-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 600px) {
    .festival-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .festival-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Minimalist Loading Spinner */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.chakra-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--saffron);
    border-radius: 50%;
    position: relative;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Hide old sacred sub-elements of spinner */
.chakra-spinner::before, .chakra-spinner::after {
    display: none !important;
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-align: center;
}

.loading-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 400px;
    text-align: center;
    line-height: 1.5;
    padding: 0 20px;
}

/* Minimal Reader Layout for View page */
.sacred-view {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 35px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Remove ॐ ornament pseudo-element */
.sacred-view::before {
    display: none !important;
}

.sacred-title-block {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.sacred-title-block h1 {
    font-family: var(--font-telugu);
    font-size: 2.2rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.sacred-title-block h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.sacred-section {
    margin-bottom: 30px;
    border-left: 3px solid var(--saffron);
    padding-left: 16px;
}

.sacred-section-title {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.sacred-section-title span.telugu-label {
    font-family: var(--font-telugu);
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.sacred-content {
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.8;
}

.sacred-content ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.sacred-content li {
    margin-bottom: 6px;
}

/* Beautiful Sloka Display Panel */
.sloka-box {
    background: #fdfbf7;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid var(--saffron);
}

.sloka-text {
    font-family: var(--font-telugu);
    font-size: 1.25rem;
    color: #431407; /* Deep warm brown */
    text-align: center;
    line-height: 1.9;
    white-space: pre-line;
    margin-bottom: 0;
    font-weight: 500;
}

.sloka-meaning {
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    margin-top: 12px;
    line-height: 1.6;
}

/* Image Visual Card styling */
.image-visual-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.visual-display {
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #f3f4f6;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}

/* Remove mandala-bg spins */
.visual-display i.mandala-bg {
    display: none !important;
}

.visual-display-content {
    z-index: 2;
    text-align: center;
    padding: 20px;
}

.visual-display-content i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.visual-display-content h3 {
    font-family: var(--font-telugu);
    font-size: 1.4rem;
    color: var(--text-primary);
}

.image-prompt-box {
    padding: 20px;
    background: #f9fafb;
}

.image-prompt-box h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.image-prompt-box p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #ffffff;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: monospace;
    line-height: 1.4;
}

/* Book Builder selection list */
.book-builder-list {
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: #f9fafb;
}

.book-builder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.book-builder-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.book-builder-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--saffron);
    cursor: pointer;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 10000;
}

.toast {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--gold);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Compiled Book Preview Minimal Styling */
.compiled-book {
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-dark);
}

.compiled-book .cover-page,
.compiled-book .toc-page,
.compiled-book .compiled-chapter {
    background: #ffffff;
    color: #111827;
    width: 210mm;
    min-height: 297mm;
    margin: 40px auto;
    padding: 25mm 20mm;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: relative;
    box-sizing: border-box;
    display: block;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Suppress double borders and corners */
.compiled-book .page-border-outer,
.compiled-book .page-border-inner,
.compiled-book .corner-ornament,
.compiled-book .print-border-corner {
    display: none !important;
}

/* 1. Cover Page Screen Styles */
.cover-page .cover-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 235mm;
    text-align: center;
    box-sizing: border-box;
}

.cover-page .mandala-container {
    display: none !important;
}

.cover-page .sanskrit-greetings {
    margin-bottom: 20px;
}

.cover-page .sanskrit-greeting {
    font-family: 'Lora', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.cover-page .sanskrit-greeting-telugu {
    font-family: var(--font-telugu);
    font-size: 1.1rem;
    color: var(--text-muted);
}

.cover-page .book-title-telugu {
    font-family: var(--font-telugu);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.35;
}

.cover-page .book-title-english {
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
    letter-spacing: 0.5px;
}

.cover-page .separator {
    width: 100px;
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

.cover-page .category-badge {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 4px;
    background: #f9fafb;
}

.cover-page .publish-credit {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 40px;
}

/* 2. Table of Contents Styles */
.toc-page .toc-header {
    font-family: var(--font-telugu);
    font-size: 2rem;
    color: var(--text-primary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 30px;
}

.toc-page .toc-list {
    list-style: none;
    margin-top: 10px;
}

.toc-page .toc-part-header {
    font-family: var(--font-telugu);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--saffron-dark);
    margin-top: 25px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.toc-page .toc-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.toc-page .toc-item-title {
    font-family: var(--font-telugu);
    font-size: 1.1rem;
    color: var(--text-primary);
    flex-shrink: 0;
    max-width: 80%;
}

.toc-page .toc-item-dots {
    flex-grow: 1;
    border-bottom: 1px dotted var(--border-hover);
    margin: 0 8px;
    position: relative;
    top: -4px;
}

.toc-page .toc-item-page {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* 3. Chapter Layout Styles */
.compiled-chapter .sacred-page-content {
    box-sizing: border-box;
}

.compiled-chapter .sacred-view {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.compiled-chapter .sacred-title-block {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 25px;
}

.compiled-chapter .chapter-meta {
    font-size: 0.8rem;
    color: var(--saffron-dark);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 600;
}

.compiled-chapter .chapter-title-text {
    font-family: var(--font-telugu);
    font-size: 2.1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.35;
}

.compiled-chapter .chapter-subtitle-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.compiled-chapter .chapter-part-name {
    font-family: var(--font-telugu);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.compiled-chapter .sacred-section {
    margin-bottom: 25px;
    border-left: 2px solid var(--saffron);
    padding-left: 14px;
}

.compiled-chapter .sacred-section-title {
    font-family: var(--font-telugu);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compiled-chapter .sacred-section-title i {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.compiled-chapter .sacred-content {
    color: var(--text-primary);
    font-family: var(--font-telugu);
    font-size: 1.15rem;
    line-height: 1.85;
}

.compiled-chapter .sacred-content p,
.compiled-chapter .sacred-content li {
    font-size: 1.15rem !important;
    line-height: 1.85 !important;
    margin-bottom: 1rem;
    text-align: justify;
    text-justify: inter-word;
}

.compiled-chapter .sacred-content > p:first-of-type::first-letter {
    font-size: 3rem;
    float: left;
    line-height: 0.9;
    margin-right: 6px;
    margin-top: 4px;
    color: var(--text-primary);
    font-weight: 700;
}

/* Beautiful Sloka Display Panel */
.compiled-chapter .sloka-box {
    background: #fdfbf7;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    max-width: 90%;
    text-align: center;
    box-shadow: none;
}

.compiled-chapter .sloka-text {
    font-family: var(--font-telugu);
    font-size: 1.25rem;
    color: #431407;
    text-align: center;
    line-height: 1.9;
    font-weight: 500;
    white-space: pre-line;
    margin-bottom: 0;
}

.compiled-chapter .sloka-meaning {
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--border-color);
    padding-top: 10px;
    margin-top: 10px;
    line-height: 1.6;
    text-align: left;
}

/* ==========================================================================
   PRINT MEDIA MEDIA QUERY (Clean Minimalist A4 Layout)
   ========================================================================== */
@media print {
    @page {
        size: A4;
        margin: 15mm;
    }

    body {
        background: white !important;
        color: black !important;
        padding: 0;
        font-family: var(--font-body);
    }

    /* Suppress screen elements completely */
    header, 
    .sidebar-panel, 
    .btn, 
    .no-print, 
    .nav-links, 
    .app-container > *:not(.compiled-book) {
        display: none !important;
    }

    .app-container {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .compiled-book {
        display: block !important;
        padding: 0 !important;
        background: white !important;
    }

    /* Reset page containers for layout flow */
    .compiled-book .cover-page,
    .compiled-book .toc-page,
    .compiled-book .compiled-chapter {
        background: transparent !important;
        color: black !important;
        width: 100% !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        page-break-after: always !important;
        break-after: page !important;
        box-sizing: border-box;
    }

    .compiled-book .compiled-chapter:last-child {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    /* Disable print decorations and borders */
    .no-screen,
    .print-decorations,
    .print-border-outer,
    .print-border-inner,
    .print-corner,
    .print-border-corner {
        display: none !important;
    }

    .cover-page .cover-content {
        height: 250mm;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .toc-page,
    .compiled-chapter .sacred-page-content {
        padding: 5mm;
    }

    /* Typography adjustments for print */
    .cover-page .book-title-telugu,
    .toc-page .toc-header,
    .compiled-chapter .chapter-meta,
    .compiled-chapter .chapter-title-text,
    .compiled-chapter .sacred-section-title {
        color: black !important;
    }

    .toc-page .toc-item-title,
    .compiled-chapter .sacred-content {
        color: black !important;
    }

    .toc-page .toc-item-dots {
        border-bottom: 1px dotted #888888 !important;
    }

    .sacred-section {
        page-break-inside: avoid;
        break-inside: avoid;
        border-left: 2px solid #888888 !important;
    }

    .compiled-chapter .sloka-box {
        background: #fdfbf7 !important;
        border: 1px solid #888888 !important;
        padding: 15px !important;
        margin: 15px auto !important;
        max-width: 90%;
        text-align: center !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .compiled-chapter .sloka-text {
        color: black !important;
        font-size: 1.2rem !important;
        line-height: 1.8 !important;
    }

    .compiled-chapter .sloka-meaning {
        color: #333333 !important;
        border-top: 1px dashed #888888 !important;
    }
}

/* Generating Pulse Animation for Book Projects */
@keyframes card-glow-pulse {
    0%, 100% { border-color: var(--border-color); box-shadow: none; }
    50% { border-color: var(--gold); box-shadow: 0 0 12px rgba(212, 175, 55, 0.15); }
}
.generating-pulse {
    animation: card-glow-pulse 2s infinite ease-in-out;
}

/* ==========================================================================
   MOBILE & VIEWPORT RESPONSIVENESS OVERRIDES (Sleek, Premium UI for Phones & Tablets)
   ========================================================================== */
@media (max-width: 992px) {
    .books-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    /* Style category menu as an elegant horizontal scrolling tab bar */
    .category-menu {
        display: flex !important;
        overflow-x: auto !important;
        gap: 8px !important;
        padding: 5px 2px 10px 2px !important;
        margin-bottom: 15px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    .category-menu::-webkit-scrollbar {
        display: none !important;
    }
    .category-menu-item {
        margin-bottom: 0 !important;
        flex-shrink: 0 !important;
    }
    .category-menu-link {
        padding: 8px 14px !important;
        font-size: 0.85rem !important;
        border-radius: 20px !important;
    }
    
    /* Header layout wraps and navigation stacking */
    header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    .logo-section {
        justify-content: center !important;
        width: 100% !important;
    }
    header .d-flex {
        width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    header .content-card {
        width: 100% !important;
        justify-content: center !important;
    }
    .nav-links {
        flex-direction: column !important;
        width: 100% !important;
        gap: 12px !important;
    }
    .nav-icons-row {
        width: 100% !important;
        justify-content: space-between !important;
    }
    .nav-icons-row .btn {
        width: 44px !important;
        height: 44px !important;
        flex: 1 1 auto !important;
        max-width: 23% !important;
        justify-content: center !important;
        padding: 0 !important;
    }
    .nav-links .btn-primary {
        width: 100% !important;
        justify-content: center !important;
        height: 44px !important;
    }

    /* Responsive Book Toolbar on mobile screens */
    .book-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 12px 15px !important;
        gap: 12px !important;
    }
    .book-toolbar-title {
        font-size: 0.95rem !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
    }
    .book-toolbar-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* Elegant 2x2 grid of buttons on mobile */
        gap: 8px !important;
    }
    .btn-toolbar {
        width: 100% !important;
        justify-content: center !important;
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
        margin: 0 !important;
    }

    /* Fluid, fully responsive A4 preview pages on mobile screens */
    .compiled-book .cover-page,
    .compiled-book .toc-page,
    .compiled-book .compiled-chapter,
    .book-page {
        width: 100% !important;
        min-height: auto !important;
        height: auto !important;
        margin: 15px 0 !important;
        padding: 25px 15px !important;
        border-radius: 8px !important;
    }

    .book-page::before, .book-page::after {
        display: none !important;
    }

    .book-pages {
        padding: 10px !important;
    }
    
    /* Cover Page adjustments */
    .cover-page .cover-content {
        min-height: auto !important;
        padding: 40px 10px !important;
    }
    
    .cover-page .book-title-telugu {
        font-size: 1.8rem !important;
    }
    
    .cover-page .book-title-english {
        font-size: 1.1rem !important;
    }
    
    /* TOC adjustments */
    .toc-page .toc-header {
        font-size: 1.5rem !important;
        margin-bottom: 20px !important;
    }
    
    .toc-page .toc-item-title {
        max-width: 70% !important;
        font-size: 0.95rem !important;
    }
    
    /* Chapter adjustments */
    .compiled-chapter .chapter-title-text {
        font-size: 1.5rem !important;
    }
    
    .compiled-chapter .sacred-content p,
    .compiled-chapter .sacred-content li {
        font-size: 1rem !important;
        line-height: 1.7 !important;
    }
    
    .compiled-chapter .sacred-content > p:first-of-type::first-letter {
        font-size: 2.2rem !important;
    }
    
    .compiled-chapter .sloka-box {
        max-width: 100% !important;
        padding: 12px !important;
    }
    
    .compiled-chapter .sloka-text {
        font-size: 1.05rem !important;
        line-height: 1.7 !important;
    }
}

@media (max-width: 480px) {
    /* Responsive buttons inside card on extremely small screens */
    .app-container {
        padding: 10px !important;
    }
    .book-project-card {
        padding: 15px !important;
    }
    .book-actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
    }
    .book-actions .btn {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }
}

/* Utility Spacing, Borders & Display Classes */
.border-top {
    border-top: 1px solid var(--border-color) !important;
}
.border-color {
    border-color: var(--border-color) !important;
}
.pt-4 { padding-top: 1.5rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.d-flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: end !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.btn-block {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 10px;
}

/* Premium Mobile Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: nowrap !important; /* Prevent wrapping to preserve single line on mobile */
}

@media (max-width: 576px) {
    .pagination-container {
        gap: 4px !important;
    }
    .pagination-container .btn {
        padding: 6px 10px !important;
        font-size: 0.8rem !important;
        min-width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px !important;
    }
    .pagination-container .btn-arrow-text {
        display: none !important; /* Hide text on mobile for premium minimalist look */
    }
    .pagination-container span.btn-secondary {
        padding: 6px 4px !important;
        min-width: 20px;
        height: 36px;
        line-height: 24px;
        background: transparent !important;
        border-color: transparent !important;
    }
}

/* Prevent header actions wrapper from wrapping on desktop */
@media (min-width: 993px) {
    header .d-flex.align-items-center.gap-3.flex-wrap {
        flex-wrap: nowrap !important;
    }
}

