/* --- HLP Public CSS Start - v1.3.2 --- */

/* Basic Reset & Defaults */
.hlp-public-library-container *, .hlp-public-library-container *::before, .hlp-public-library-container *::after { box-sizing: border-box; }
.hlp-public-library-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.6; background-color: transparent; border: 1px solid #e9ecef; position: relative; display: flex; min-height: 500px; margin: 1.5em 0; border-radius: 0.3rem; overflow: hidden; }

/* Error/Notice Messages */
.hlp-public-library-container .hlp-error, .hlp-public-library-container .hlp-notice { padding: 15px; margin: 10px; border-radius: 4px; text-align: center; }
.hlp-public-library-container .hlp-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.hlp-public-library-container .hlp-notice { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* Sidebar */
.hlp-public-sidebar { width: 300px; background-color: #f8f9fa; color: #495057; padding: 0; display: flex; flex-direction: column; overflow-y: hidden; transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out, box-shadow 0.3s ease-in-out; flex-shrink: 0; align-self: stretch; border-right: 1px solid #e9ecef; }
.hlp-public-sidebar-header { padding: 1rem 1.25rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e9ecef; flex-wrap: wrap; gap: 0.75rem; position: relative; flex-shrink: 0; background-color: #ffffff; }
.hlp-public-sidebar-header h2 { margin: 0 0 0.5rem 0; flex-basis: 100%; color: #212529; font-size: 1.25rem; font-weight: 600; line-height: 1.3; order: 1; word-break: break-word; }
.hlp-search-form { flex-grow: 1; min-width: 120px; display: flex; order: 2; }
#hlp-public-search-box { padding: 0.5rem 0.75rem; border: 1px solid #ced4da; background-color: #ffffff; color: #495057; border-radius: 0.25rem; font-size: 0.9rem; width: 100%; line-height: 1.5; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; }
#hlp-public-search-box:focus { border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); }
.hlp-search-submit { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }

/* Subject & Chapter Lists */
.hlp-public-subject-list { flex-grow: 1; overflow-y: auto; padding: 0.75rem 0; }
.hlp-public-subject-list > p, .hlp-public-subject-list .hlp-no-chapters, .hlp-no-matches { padding: 0.75rem 1.25rem; margin: 0.5rem 1.25rem; color: #6c757d; font-style: italic; background-color: #f1f3f5; border: none; border-radius: 0.25rem; text-align: center; font-size: 0.9rem; }
.hlp-no-chapters { background-color: transparent; margin: 0; padding: 0.4rem 0.75rem; text-align: left; }

.hlp-public-subject-item { margin-bottom: 0.5rem; border-left: none; padding: 0 0.75rem; }
.hlp-public-subject-item.hlp-hidden { display: none; }
.hlp-public-subject-header { display: flex; justify-content: space-between; align-items: center; cursor: default; padding: 0.6rem 0.75rem; background-color: #ffffff; border-radius: 0.25rem; position: relative; border: 1px solid #e9ecef; margin-bottom: 0.25rem; }
.hlp-public-subject-title { font-weight: 500; flex-grow: 1; margin-right: 0.5rem; word-break: break-word; color: #495057; font-size: 0.95rem; }
.hlp-public-subject-controls { flex-shrink: 0; }
.hlp-public-subject-controls .hlp-public-toggle-subject-btn { background: none; border: none; color: #adb5bd; cursor: default; font-size: 1rem; margin-left: 0.5rem; padding: 0.2rem 0.3rem; line-height: 1; vertical-align: middle; }
.hlp-public-subject-controls .hlp-public-toggle-subject-btn i { font-weight: 900; font-family: "Font Awesome 6 Free"; transition: transform 0.2s ease-in-out; display: inline-block; }
.hlp-public-subject-item.hlp-collapsed .hlp-public-subject-controls .hlp-public-toggle-subject-btn i { transform: rotate(-90deg); }

.hlp-public-chapter-list { list-style: none; padding-left: 0.75rem; margin: 0.5rem 0 0 0; }
.hlp-public-chapter-list.hlp-subject-filtered-list { padding-left: 0; margin-left: 0; margin-top: 0; }
.hlp-public-subject-item.hlp-collapsed .hlp-public-chapter-list { display: none; }
.hlp-public-chapter-item { padding: 0; margin-bottom: 2px; }
.hlp-public-chapter-item.hlp-hidden { display: none; }
.hlp-public-chapter-link { color: #0d6efd; text-decoration: none; display: block; padding: 0.4rem 0.75rem; border-radius: 0.25rem; cursor: pointer; word-break: break-word; font-size: 0.9rem; transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out; border: 1px solid transparent; margin-left: -1px; }
.hlp-subject-filtered-list .hlp-public-chapter-link { margin-left: 0; padding-left: 0.5rem; }
.hlp-public-chapter-link:hover { background-color: #e9ecef; color: #0a58ca; text-decoration: none; }
.hlp-public-chapter-link.hlp-active { background-color: #0d6efd; color: white; font-weight: 500; text-decoration: none; border-color: #0d6efd; }
.hlp-public-chapter-link.hlp-active:hover { background-color: #0b5ed7; border-color: #0b5ed7; color: white; }

/* Content Pane */
.hlp-public-content-pane { flex-grow: 1; padding: 1.5rem 1.25rem; overflow-y: auto; background-color: #ffffff; align-self: stretch; }
#hlp-public-chapter-content { color: #343a40; font-size: 1rem; }

/* <<< UPDATED: Content Header & Title >>> */
.hlp-public-content-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 1.5rem; }
#hlp-public-content-title { margin-top: 0; flex-grow: 1; border-bottom: 1px solid #e9ecef; padding-bottom: 1rem; word-break: break-word; font-size: 1.75rem; line-height: 1.3; font-weight: 600; color: #212529; margin-bottom: 0; }


/* <<< Welcome Message Display Rules >>> */
#hlp-public-chapter-content .hlp-welcome-mobile { display: none; } /* Hide mobile message by default */
#hlp-public-chapter-content .hlp-welcome-desktop { display: block; } /* Show desktop message by default */
#hlp-public-chapter-content .hlp-welcome-mobile p, #hlp-public-chapter-content .hlp-welcome-desktop p { margin-bottom: 1em; }


/* Content Styling (Headings, p, code, etc.) */
#hlp-public-chapter-content h1, #hlp-public-chapter-content h2, #hlp-public-chapter-content h3, #hlp-public-chapter-content h4 { margin: 1.75em 0 0.75em 0; padding: 0; line-height: 1.3; font-weight: 600; color: #212529;}
#hlp-public-chapter-content h1 { font-size: 1.6rem; border-bottom: 1px solid #f1f3f5; padding-bottom: 0.4rem; } #hlp-public-chapter-content h2 { font-size: 1.4rem; } #hlp-public-chapter-content h3 { font-size: 1.2rem; } #hlp-public-chapter-content h4 { font-size: 1.0rem; text-transform: uppercase; color: #6c757d; letter-spacing: 0.5px;}
#hlp-public-chapter-content p { margin-bottom: 1.2em; }
#hlp-public-chapter-content code { background-color: #e9ecef; padding: 0.2em 0.4em; border-radius: 0.2rem; font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.875em; border: 1px solid #dee2e6; color: #d63384; }
#hlp-public-chapter-content pre { background-color: #f8f9fa; padding: 1rem; border: 1px solid #dee2e6; border-radius: 0.25rem; overflow-x: auto; font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; line-height: 1.45; font-size: 0.875em; margin-bottom: 1.2em; color: #212529; }
#hlp-public-chapter-content blockquote { border-left: 4px solid #adb5bd; padding: 0.75rem 1.25rem; margin: 1.5em 0; background-color: #f8f9fa; color: #495057; font-style: normal; }
#hlp-public-chapter-content blockquote p:last-child { margin-bottom: 0; }
#hlp-public-chapter-content ul, #hlp-public-chapter-content ol { margin: 0 0 1.2em 1.5em; padding-left: 1.25em; }
#hlp-public-chapter-content li { margin-bottom: 0.5em; }
#hlp-public-chapter-content a { color: #0d6efd; text-decoration: underline; }
#hlp-public-chapter-content a:hover { color: #0a58ca; }

/* Audio Player Container Styles */
.hlp-audio-players-container { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 1.5em; }
.hlp-audio-players-container .hlp-audio-player-wrapper { flex: 1 1 calc(50% - 10px); min-width: 280px; margin-bottom: 0; background-color: #f8f9fa; padding: 15px; border: 1px solid #e9ecef; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.hlp-audio-players-container .hlp-audio-player-wrapper:only-child { flex-basis: 100%; margin-bottom: 0; }
.hlp-audio-player-wrapper .hlp-audio-lang-label { font-size: 0.9em; font-weight: 600; color: #495057; margin: 0 0 8px 0; padding: 0; text-transform: uppercase; letter-spacing: 0.5px; }
.hlp-audio-player-wrapper audio { width: 100%; display: block; outline: none; }
.hlp-public-library-container .mejs-container { width: 100% !important; background: transparent; }
.hlp-public-library-container .mejs-controls { background: rgba(233, 236, 239, 0.9); }

/* Sidebar Toggles */
.hlp-sidebar-toggle { display: none; background: #f8f9fa; color: #495057; border: 1px solid #dee2e6; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 0.25rem; line-height: 1.5; position: absolute; top: 15px; left: 15px; z-index: 10; text-align: center; white-space: nowrap; transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, color 0.15s ease-in-out; }
.hlp-sidebar-toggle:hover { background-color: #e9ecef; color: #212529; border-color: #ced4da; }
#hlp-sidebar-toggle-close { position: static; background: none; border: none; padding: 0.2rem 0.5rem; margin-left: auto; order: 3; color: #6c757d; font-size: 1.75rem; font-weight: 400; line-height: 1; width: auto; height: auto; display: inline-block; border-radius: 50%; }
#hlp-sidebar-toggle-close:hover { background: #e9ecef; color: #212529; }

/* --- NEW: Presentation Mode --- */
.hlp-presentation-btn { background-color: #f8f9fa; border: 1px solid #dee2e6; color: #495057; padding: 0.5rem 1rem; border-radius: 0.25rem; cursor: pointer; font-size: 0.9rem; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; line-height: 1.5; transition: all 0.2s ease-in-out; }
.hlp-presentation-btn:hover { background-color: #e9ecef; border-color: #ced4da; color: #212529; }
.hlp-presentation-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(25, 28, 31, 0.95); z-index: 9999; padding: 40px; display: none; }
.hlp-presentation-close { position: absolute; top: 20px; right: 35px; font-size: 3rem; font-weight: 300; line-height: 1; color: #adb5bd; background: none; border: none; cursor: pointer; padding: 0; transition: color 0.2s ease; }
.hlp-presentation-close:hover { color: #ffffff; }
.hlp-presentation-content-wrapper { width: 100%; height: 100%; background-color: #ffffff; border-radius: 4px; overflow-y: auto; padding: 3rem 4rem; }
.hlp-presentation-content { font-size: 1.5rem; line-height: 1.7; }
.hlp-presentation-content h1 { font-size: 2.2em; } .hlp-presentation-content h2 { font-size: 1.9em; } .hlp-presentation-content h3 { font-size: 1.6em; } .hlp-presentation-content h4 { font-size: 1.3em; }
.hlp-presentation-content h1, .hlp-presentation-content h2, .hlp-presentation-content h3, .hlp-presentation-content h4 { margin-top: 1.5em; margin-bottom: 0.8em; }
.hlp-presentation-content p, .hlp-presentation-content li { font-size: 1em; }
.hlp-presentation-content pre, .hlp-presentation-content code { font-size: 0.8em; }
body.hlp-presentation-active { overflow: hidden; }

/* Responsive */
@media (max-width: 768px) {
     .hlp-public-library-container { display: block; overflow: hidden; border: none; }
     .hlp-public-sidebar { position: fixed; left: 0; top: 0; width: 300px; max-width: 85%; height: 100%; z-index: 100; margin-left: -310px; border-right: 1px solid #dee2e6; box-shadow: 2px 0 8px rgba(0,0,0,0.15); display: flex; flex-direction: column; overflow: hidden; background-color: #f8f9fa; }
     .hlp-public-sidebar.hlp-open { margin-left: 0; }
     .hlp-public-sidebar-header { flex-shrink: 0; background-color: #ffffff; }
     .hlp-public-subject-list { flex-grow: 1; overflow-y: auto; }
     .hlp-public-content-pane { width: 100%; margin-left: 0; height: auto; padding-top: 95px; transform: translateZ(0); }
    .hlp-audio-players-container { flex-direction: column; align-items: stretch; gap: 15px; }
    .hlp-audio-players-container .hlp-audio-player-wrapper { flex-basis: auto; width: 100%; min-width: unset; }
    #hlp-public-chapter-content .hlp-welcome-mobile { display: block; } #hlp-public-chapter-content .hlp-welcome-desktop { display: none; }
    .hlp-sidebar-toggle { display: inline-block; position: fixed; top: 50px; left: 12px; z-index: 101; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
    #hlp-sidebar-toggle-close { display: inline-block; position: absolute; top: 12px; right: 10px; z-index: 102; width: auto; height: auto; padding: 4px 8px; }
    .hlp-public-sidebar-header { padding-right: 45px; padding-top: 1rem; padding-bottom: 1rem; align-items: center; min-height: 50px; }
    .hlp-public-library-container::after { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 99; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out, visibility 0s linear 0.3s; }
    .hlp-public-library-container.hlp-sidebar-open::after { opacity: 1; visibility: visible; transition: opacity 0.3s ease-in-out, visibility 0s linear 0s; }
    .hlp-presentation-btn-text { display: none; }
    .hlp-presentation-btn { padding: 0.5rem 0.7rem; }
    .hlp-presentation-overlay { padding: 10px; }
    .hlp-presentation-content-wrapper { padding: 2rem 1.25rem; }
    .hlp-presentation-content { font-size: 1.2rem; }
}

/* Accessibility */
.screen-reader-text { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; word-wrap: normal !important; }

/* --- HLP Public CSS End --- */