/* Custom styles for patterns */

/* Typography Support for Burmese Script */
body, h1, h2, h3, h4, h5, h6, button, input, select, textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", "Padauk", "Noto Sans Myanmar", sans-serif;
}

.donate-panel, .newsletter-panel {padding:1rem;border:1px solid var(--global--color-secondary);border-radius:8px;margin-bottom:1rem;}
.schedule-calendar {padding:1rem;background:#F6FAFF;border-radius:8px;}
.featured-post-card, .bio-photo, .retreat-card, .related-post-card {border:1px solid var(--global--color-secondary);border-radius:8px;padding:1.5rem; background-color: #fff;}
.audio-card { background: #fff; padding: 1rem; border-radius: 8px; border-left: 4px solid var(--global--color-primary); }
.daily-routine-table { max-width: 600px; margin: 0 auto; }

/* Pali Quote Styling */
.pali-quote-container { border-top: 2px solid var(--global--color-accent); border-bottom: 2px solid var(--global--color-accent); padding: 2rem 1rem; margin: 2rem 0; }
.pali-text { color: var(--global--color-primary); margin-bottom: 0.5rem; }

/* Retreat Logistics */
.retreat-list-card { background: #fff; padding: 1.5rem; border-radius: 8px; border: 1px solid #eee; }

/* Resources */
.resource-card { background: #fff; border: 1px solid var(--global--color-secondary); border-radius: 8px; padding: 1.5rem; text-align: center; transition: transform 0.2s ease; }

/* Books */
.book-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 2rem; text-align: center; }
.book-cover img { box-shadow: 0 4px 8px rgba(0,0,0,0.15); margin-bottom: 1.5rem; max-height: 300px; width: auto; }

/* Published Books Pattern */
.published-books h2 {
    margin-bottom: 3rem !important;
    color: var(--global--color-primary);
}

/* Teacher's Bio Pattern */
.teacher-bio h1, .teacher-bio h2 {
    font-weight: 300; /* Lighter weight for a calm look */
    color: var(--global--color-primary);
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.teacher-bio h3, .teacher-bio h4 {
    font-weight: 400;
    color: var(--global--color-secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.teacher-bio p {
    font-size: 1.1rem;
    line-height: 1.8; /* Increased line height for readability */
    color: #444; /* Slightly softer than pure black */
    margin-bottom: 1.5rem;
}

/* Lineage / Teachers Pattern */
.lineage-pattern {
    padding: 3rem 0;
    border-top: 1px solid #eee;
    margin-top: 2rem;
}

.lineage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
    justify-content: center;
}

.lineage-card {
    text-align: center;
    padding: 1rem;
    transition: transform 0.3s ease;
}

.lineage-card:hover {
    transform: translateY(-3px);
}

.lineage-card img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 4px solid #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.lineage-card:hover img {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.lineage-card h3 {
    color: var(--global--color-primary);
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.lineage-card .lineage-title {
    color: var(--global--color-secondary);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 0.75rem;
    display: block;
}

.lineage-card p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
}

/* Social Connect */
.social-connect-section { background-color: #f0f4f8; padding: 2rem; border-radius: 8px; margin-top: 2rem; }

/* Newsletter */
.newsletter-panel { background-color: #f4f9f4; border: 1px solid var(--global--color-accent); padding: 3rem 1rem; }
.newsletter-form { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 1.5rem; width: 100%; }
.newsletter-form input[type="email"] { padding: 12px; border: 1px solid #ccc; border-radius: 4px; min-width: 280px; }

/* Print Styles for Schedules and Chants */
@media print {
    .site-header, .site-footer, .widget-area, .wp-block-buttons, .donate-panel, .newsletter-panel { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .daily-routine-table, .pali-quote-container { width: 100% !important; margin: 0; border: 1px solid #ccc; page-break-inside: avoid; }
    main { margin: 0 !important; padding: 0 !important; }
}

/* Chat Widget */
.dhamma-chat-toggle {
    position: fixed; bottom: 20px; right: 20px;
    background-color: var(--global--color-primary); color: #fff;
    border: none; border-radius: 50px; padding: 15px 25px;
    font-size: 1rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000; transition: transform 0.2s;
}
.dhamma-chat-toggle:hover { transform: scale(1.05); }

.dhamma-chat-widget {
    position: fixed; bottom: 80px; right: 20px;
    width: 350px; height: 500px;
    background: #fff; border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: none; flex-direction: column;
    z-index: 1000; overflow: hidden; border: 1px solid #e0e0e0;
    box-sizing: border-box;
    max-width: 90vw;
}
.dhamma-chat-widget.is-open { display: flex; }

.dhamma-chat-header {
    background: var(--global--color-primary); color: #fff;
    padding: 15px; display: flex; justify-content: space-between; align-items: center; font-weight: bold;
}
.dhamma-chat-header button { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0; }

.dhamma-chat-messages {
    flex: 1; padding: 15px; overflow-y: auto; background: #f9f9f9;
    display: flex; flex-direction: column; gap: 10px;
}
.message { 
    max-width: 80%; padding: 10px 15px; border-radius: 15px; 
    font-size: 0.95rem; line-height: 1.5; 
    font-weight: normal; /* Ensure no global bold */
}
.message p { margin: 0 0 0.5rem 0; }
.message p:last-child { margin-bottom: 0; }
.message ul, .message ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.message li { margin-bottom: 0.25rem; }
.bot-message { align-self: flex-start; background: #e9e9eb; color: #000; border-bottom-left-radius: 2px; }
.user-message { align-self: flex-end; background: var(--global--color-secondary); color: #fff; border-bottom-right-radius: 2px; }

.dhamma-chat-input-area {
    padding: 15px; border-top: 1px solid #eee; display: flex; gap: 10px; background: #fff;
    box-sizing: border-box;
}
.dhamma-chat-input-area input { flex: 1; min-width: 0; padding: 10px; border: 1px solid #ccc; border-radius: 20px; }
.dhamma-chat-input-area button { background: var(--global--color-primary); color: #fff; border: none; padding: 0 20px; border-radius: 20px; cursor: pointer; }

/* Chat Copy Button */
.chat-copy-btn {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--global--color-primary);
    background: transparent;
    border: 1px solid var(--global--color-primary);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.chat-copy-btn:hover { background-color: var(--global--color-primary); color: #fff; }

/* Announcement Bar */
.announcement-bar {
    position: relative;
    gap: 1rem;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    z-index: 9999;
}
.announcement-close {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: transparent !important;
    border: none;
    color: var(--global--color-background);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.announcement-close:hover { opacity: 0.8; }

@media (max-width: 600px) {
    .announcement-bar { padding-right: 3rem !important; }
    .announcement-close { top: 10px; right: 10px; transform: none; }
}

/* Scroll to Top */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 90px; /* Positioned to the left of the chat toggle */
    background-color: var(--global--color-secondary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.scroll-to-top.is-visible { opacity: 1; visibility: visible; }
.scroll-to-top:hover { transform: translateY(-3px); background-color: var(--global--color-primary); }

/* Gallery */
.retreat-gallery-section { padding: 2rem 0; }

/* Reading Progress Bar */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background-color: var(--global--color-accent);
    width: 0%;
    z-index: 10001;
    transition: width 0.1s ease-out;
}

/* Share This */
.share-this-section { gap: 1rem; margin-bottom: 2rem; }

/* Table of Contents */
.toc-container { border: 1px solid var(--global--color-secondary); border-radius: 8px; max-width: 400px; margin-bottom: 2rem; }
.toc-list { margin-top: 0.5rem; }

@media (min-width: 1024px) {
    .toc-container {
        float: right;
        margin-left: 2rem;
        width: 300px;
    }
}

/* Chat Markdown Styling */
.message h1, .message h2, .message h3, .message h4, .message h5, .message h6 { margin: 0.5rem 0; font-weight: bold; line-height: 1.2; }
.message h1 { font-size: 1.2rem; }
.message h2 { font-size: 1.1rem; }
.message h3 { font-size: 1rem; }
.message strong { font-weight: bold; }
.message em { font-style: italic; }

/* Navigation Menu Enhancements */
.site-header {
    position: sticky !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background-color: #ffffff !important;
    backdrop-filter: none;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    border-bottom: none !important;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
    padding-top: 0.5rem !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
    padding-left: max(2rem, calc(50% - 600px)) !important;
    padding-right: max(2rem, calc(50% - 600px)) !important;
}

.site-header.header-transparent {
    background-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

.site-branding {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Ensure logo background is transparent to show header color */
.site-branding, .custom-logo-link, .custom-logo {
    background-color: transparent !important;
}

.site-main {
    margin-top: 0 !important;
    padding-top: 1rem !important; /* Add small breathing room back */
}

.page-template-page-home .site-main {
    padding-top: 0 !important; /* Keep flush for Home Page Hero */
}

.primary-navigation > .primary-menu-container > ul > li > a {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.95rem;
    color: var(--global--color-primary);
    transition: all 0.2s ease;
}

.primary-navigation > .primary-menu-container > ul > li > a:hover {
    color: var(--global--color-secondary);
    text-decoration: none;
    background-color: rgba(77, 161, 169, 0.05); /* Subtle background on hover */
    border-radius: 4px;
}

.primary-navigation > .primary-menu-container > ul > li.current-menu-item > a {
    color: var(--global--color-secondary);
    font-weight: 700;
}

/* Home Page Layout: Center content to 2/3 width, allow full width blocks */
.page-template-page-home .entry-content > *:not(.alignwide):not(.alignfull) {
    width: 66.66% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

@media (max-width: 768px) {
    .page-template-page-home .entry-content > *:not(.alignwide):not(.alignfull) {
        width: 90% !important;
    }
}

/* Remove top spacing for content to touch header */
.entry-content, .entry-content > *:first-child {
    margin-top: 0;
    padding-top: 0;
}

/* Hero Image Adjustments */
.page-template-page-home .wp-block-cover {
    min-height: 90vh !important;
    padding-top: 0 !important;
}

@media (max-width: 1024px) {
    .page-template-page-home .wp-block-cover {
        min-height: 50vh !important;
    }
    .page-template-page-home .wp-block-cover img.wp-block-cover__image-background {
        object-fit: contain !important;
        object-position: center !important;
    }
}

/* Editor WYSIWYG Adjustments */
.editor-styles-wrapper .announcement-bar {
    z-index: 1 !important; /* Prevent overlaying editor UI */
    width: 100% !important;
    max-width: 100% !important;
}

.editor-styles-wrapper .wp-block-cover__inner-container {
    z-index: 10; /* Ensure content sits above background in editor */
}

/* Mimic Home Page Layout in Editor */
.editor-styles-wrapper .wp-block:not([data-align="full"]):not([data-align="wide"]):not(.announcement-bar) {
    width: 66.66% !important;
    max-width: 66.66% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

@media (max-width: 768px) {
    .editor-styles-wrapper .wp-block:not([data-align="full"]):not([data-align="wide"]):not(.announcement-bar) {
        width: 90% !important;
        max-width: 90% !important;
    }
}
