/* Additional styles for prayers page */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;500;600&display=swap');

:root {
    --prayer-ink: #0f1f4f;
    --prayer-soft: #f4f7ff;
    --prayer-border: #dbe7ff;
    --prayer-accent: #2563eb;
}

.prayers-compact .daily-inspiration-card {
    padding: 0.5rem 1rem;
}

/* Ensure community status bar displays properly on prayers page */
#community-status-bar {
    padding: 0.5rem 0;
}

#community-status-content {
    padding: 0 1rem;
}

.status-leading-dot {
    width: 8px;
    height: 8px;
}

.status-section {
    display: flex;
    align-items: center;
}

.status-section--with-divider {
    position: relative;
    padding-left: 1rem;
    margin-left: 1rem;
}

.status-section--with-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    width: 1px;
    background: #cbd5e1;
}

.prayer-finder-sticky {
    position: sticky;
    top: 16px;
    z-index: 30;
    backdrop-filter: blur(10px);
    margin-top: -0.5rem;
}

.category-card {
    background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    border: 2px solid #d0e3ff;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.category-title {
    font-weight: 700;
    color: #1e40af;
    font-size: 1.2rem;
}

.category-description {
    color: #1e3a8a;
    font-size: 0.95rem;
    line-height: 1.6;
}

.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.category-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    border: 1px solid #93c5fd;
    color: #1e40af;
    font-weight: 600;
    font-size: 0.9rem;
    background: white;
    text-decoration: none;
    transition: all 0.2s ease;
}

.category-link:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}

#prayer-finder {
    border-left: 4px solid #3b82f6;
}

.finder-header {
    margin-bottom: 1rem;
}

.finder-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 1.25rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1e3a8a;
    font-weight: 700;
}

.filter-input {
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    background: #f8fbff;
    color: #1e3a8a;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.filter-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #ffffff;
}

.filter-helper {
    font-size: 0.85rem;
    color: #475569;
}

.prayer-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2563eb;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
    z-index: 1000;
    margin-top: -10px;
}

.prayer-autocomplete.hidden {
    display: none;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #eff6ff;
}

.autocomplete-item-title {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 0.25rem;
}

.autocomplete-item-category {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.finder-languages {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.toggle-pill {
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: #1e40af;
    background: #f8fbff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-pill.active {
    border-color: #2563eb;
    background: #e0edff;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.15);
}

.toggle-pill input {
    accent-color: #2563eb;
    width: 1rem;
    height: 1rem;
}

.finder-footer {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.prayer-count {
    color: #1e3a8a;
    font-weight: 600;
}

.reset-button {
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.3rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: white;
    box-shadow: 0 10px 24px rgba(30, 64, 175, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reset-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(30, 64, 175, 0.3);
}

.reset-button.ghost {
    background: white;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
    box-shadow: none;
}

.reset-button.ghost:hover {
    background: #e0edff;
    transform: none;
}

.directory-link {
    display: block;
    padding: 1rem 1.25rem;
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e40af;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.4;
}

.directory-link:hover {
    background: #e0edff;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.quick-access-bar {
    background: #ffffff;
    border: 1px solid var(--prayer-border);
    border-radius: 18px;
    padding: 1rem 1.5rem 1rem 1.5rem;
    margin-top: 4.75rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 8px 22px rgba(15, 31, 79, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.quick-access-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.quick-access-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #1e3a8a;
}

.quick-access-subtitle {
    color: #475569;
    font-weight: 500;
}

.quick-access-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid #c7d2fe;
    color: #1e3a8a;
    background: #f1f5ff;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.18s ease;
}

.quick-link:hover {
    border-color: #6366f1;
    background: #e0e7ff;
    transform: translateY(-1px);
}

.nav-hub {
    position: relative;
}

.nav-hub-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.nav-hub-tabs {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hub-tab {
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-weight: 700;
    color: #1e40af;
    background: #f8fbff;
    transition: all 0.2s ease;
}

.hub-tab.active {
    background: #e0edff;
    border-color: #3b82f6;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.18);
}

.nav-hub-panels {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .nav-hub-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .nav-hub-tabs {
        justify-content: flex-end;
    }
}

.nav-hub-panel {
    background: var(--prayer-soft);
    border: 1px solid var(--prayer-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-hub-panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.category-nav-item {
    text-align: left;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    padding: 0.75rem 0.95rem;
    background: #ffffff;
    color: #1e3a8a;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.category-nav-item:hover {
    border-color: #60a5fa;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.category-nav-item.active {
    border-color: #2563eb;
    background: #e0edff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.category-nav-title {
    font-weight: 700;
    color: #1e40af;
    font-size: 0.98rem;
}

.category-nav-desc {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.directory-index {
    color: #1d4ed8;
    font-weight: 700;
    margin-right: 0.35rem;
}

.directory-empty {
    padding: 1rem;
    border-radius: 10px;
    border: 1px dashed #c7d2fe;
    color: #1e3a8a;
    background: #eef2ff;
    font-weight: 600;
}

.prayer-section {
    background: white;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(15, 31, 79, 0.08);
    margin-bottom: 2.25rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    scroll-margin-top: 160px; /* Account for sticky header + finder */
}

.prayer-section summary {
    list-style: none;
}

.prayer-section summary::-webkit-details-marker {
    display: none;
}

.prayer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.6rem 1.8rem;
    cursor: pointer;
}

.prayer-section[open] .prayer-header {
    background: #f8fbff;
    border-bottom: 1px solid #e2e8f0;
}

.prayer-header-main {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.prayer-title {
    color: var(--prayer-ink);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.prayer-index {
    color: #60a5fa;
    font-weight: 700;
    margin-right: 0.5rem;
}

.prayer-meta {
    margin-top: 0;
    margin-bottom: 0;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    background: #e0edff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-weight: 600;
    font-size: 0.9rem;
}

.prayer-summary {
    background: #f4f7ff;
    border-left: 3px solid #3b82f6;
    padding: 0.75rem 0.95rem;
    border-radius: 8px;
    color: #1e3a8a;
    font-size: 1rem;
    margin-bottom: 0;
}

.prayer-toggle-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #1e40af;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.prayer-toggle-icon {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease;
}

.prayer-section[open] .prayer-toggle-icon {
    transform: rotate(180deg);
}

.prayer-body {
    padding: 0 1.8rem 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.prayer-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: #f8fbff;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    color: #1e3a8a;
    line-height: 1.5;
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 0.35rem;
}

.text-section {
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.english-section {
    background: linear-gradient(to right, #f0f9ff 0%, #ffffff 5%);
    border-left-color: #3b82f6;
}

.hebrew-section {
    background: linear-gradient(to right, #eff6ff 0%, #ffffff 5%);
    border-left-color: #2563eb;
    direction: rtl;
    text-align: right;
}

.transliteration-section {
    background: linear-gradient(to right, #dbeafe 0%, #ffffff 5%);
    border-left-color: #60a5fa;
}

.section-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e40af;
    margin-bottom: 0.75rem;
}

.section-text {
    color: #1e3a8a;
    line-height: 1.8;
    font-size: 1.05rem;
}

.english-section .section-text {
    font-family: 'Crimson Pro', 'Georgia', serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: #1a2559;
}

.hebrew-section .section-text {
    font-family: 'SBL Hebrew', 'Ezra SIL', 'Frank Ruehl CLM', 'David CLM', 'Times New Roman', serif;
    font-size: 1.35rem;
    line-height: 2.3;
}

.language-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.65rem;
    margin-top: 2rem;
    border-radius: 12px;
    background: #f1f5ff;
    border: 1px solid #dbe7ff;
}

.prayer-details + .language-switcher {
    margin-top: 1.25rem;
}

.language-tab {
    border: none;
    background: transparent;
    color: #1e40af;
    font-weight: 700;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.language-tab.active {
    background: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.25);
}

.prayer-content {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

.prayer-section[data-language-view="english"] [data-language-block="hebrew"],
.prayer-section[data-language-view="english"] [data-language-block="transliteration"] {
    display: none;
}

.prayer-section[data-language-view="hebrew"] [data-language-block="english"],
.prayer-section[data-language-view="hebrew"] [data-language-block="transliteration"] {
    display: none;
}

.prayer-section[data-language-view="transliteration"] [data-language-block="english"],
.prayer-section[data-language-view="transliteration"] [data-language-block="hebrew"] {
    display: none;
}

.prayer-section[data-language-view="both"] [data-language-block="transliteration"] {
    display: none;
}

.prayer-section[data-language-view="both"] .prayer-content {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

#back-to-top {
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

#back-to-top.visible {
    opacity: 1;
    pointer-events: all;
}

.empty-state {
    border: 2px dashed #bfdbfe;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: #f8fbff;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.empty-copy {
    color: #1e3a8a;
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Prayer Finder Adjustments */
    #prayer-finder {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .finder-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .finder-header {
        margin-bottom: 0.75rem;
    }

    .finder-header h3 {
        font-size: 1.25rem;
    }

    .finder-header p {
        font-size: 0.875rem;
    }

    .filter-input {
        font-size: 0.95rem;
        padding: 0.65rem 0.8rem;
    }

    .finder-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .prayer-count {
        text-align: center;
    }

    .reset-button {
        width: 100%;
        padding: 0.7rem 1.3rem;
    }

    /* Quick Access Bar */
    .quick-access-bar {
        padding: 1rem;
        margin-top: 1rem;
        margin-bottom: 1.5rem;
    }

    .quick-access-pills {
        gap: 0.5rem;
    }

    .quick-link {
        padding: 0.45rem 0.85rem;
        font-size: 0.875rem;
    }

    /* Navigation Hub */
    .nav-hub {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    .nav-hub-header h2 {
        font-size: 1.5rem;
    }

    .nav-hub-header p {
        font-size: 0.875rem;
        margin-top: 0.5rem;
    }

    .nav-hub-panel {
        padding: 1rem;
    }

    .category-nav-item {
        padding: 0.65rem 0.85rem;
    }

    .category-nav-title {
        font-size: 0.9rem;
    }

    .category-nav-desc {
        font-size: 0.8rem;
    }

    .directory-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .directory-link {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }

    /* Prayer Sections */
    .prayer-section {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        overflow: visible;
    }

    .prayer-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem 1rem;
        gap: 1rem;
    }

    .prayer-title {
        font-size: 1.25rem;
        line-height: 1.4;
    }

    .prayer-index {
        font-size: 1.15rem;
    }

    .category-chip {
        font-size: 0.85rem;
        padding: 0.2rem 0.7rem;
    }

    .prayer-summary {
        font-size: 0.95rem;
        padding: 0.65rem 0.85rem;
    }

    .prayer-toggle-indicator {
        align-self: flex-start;
        font-size: 0.85rem;
    }

    .prayer-body {
        padding: 0 1rem 1.25rem;
    }

    .prayer-details {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .detail-item {
        padding: 0.75rem 0.85rem;
        font-size: 0.95rem;
    }

    .detail-label {
        font-size: 0.7rem;
    }

    /* Text Sections */
    .text-section {
        padding: 1rem;
        border-radius: 6px;
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 0.6rem;
    }

    .section-text {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .english-section .section-text {
        font-size: 1rem;
        line-height: 1.8;
    }

    .hebrew-section .section-text {
        font-size: 1.15rem;
        line-height: 2.1;
    }

    /* Language Switcher */
    .language-switcher {
        position: sticky;
        bottom: 0;
        z-index: 10;
        border-radius: 12px;
        background: #ffffff;
        box-shadow: 0 -8px 20px rgba(15, 31, 79, 0.15);
        padding: 0.65rem;
        margin-top: 1.5rem;
        gap: 0.5rem;
    }

    .language-tab {
        flex: 1 1 calc(50% - 0.25rem);
        text-align: center;
        padding: 0.55rem 0.7rem;
        font-size: 0.875rem;
    }

    /* Prayer Finder Sticky Positioning */
    .prayer-finder-sticky {
        position: sticky;
        top: 60px;
        margin-top: 0;
    }

    /* Back to Top Button */
    #back-to-top {
        bottom: 5rem;
        right: 1rem;
        padding: 0.75rem;
    }

    #back-to-top svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

@media (max-width: 900px) {
    .nav-hub-panels {
        grid-template-columns: 1fr;
    }

    .nav-hub-panel {
        display: none;
    }

    .nav-hub[data-hub-view="categories"] .nav-hub-panel[data-hub-panel="categories"],
    .nav-hub[data-hub-view="directory"] .nav-hub-panel[data-hub-panel="directory"] {
        display: flex;
    }
}

/* Additional mobile improvements for smaller screens */
@media (max-width: 640px) {
    /* Even more compact spacing for small phones */
    #prayer-finder {
        padding: 0.85rem;
    }

    .finder-header h3 {
        font-size: 1.1rem;
    }

    .finder-header p {
        font-size: 0.8rem;
    }

    .filter-input {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }

    .filter-helper {
        font-size: 0.8rem;
    }

    /* Quick access more compact */
    .quick-access-bar {
        padding: 0.85rem;
    }

    .quick-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.825rem;
    }

    /* Prayer sections even more compact */
    .prayer-header {
        padding: 1rem 0.85rem;
    }

    .prayer-title {
        font-size: 1.15rem;
    }

    .prayer-body {
        padding: 0 0.85rem 1rem;
    }

    .text-section {
        padding: 0.85rem;
    }

    .section-title {
        font-size: 0.95rem;
    }

    /* Ensure prayer content doesn't overflow */
    .prayer-content {
        overflow-x: hidden;
    }

    .section-text {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Make language switcher more touch-friendly */
    .language-tab {
        padding: 0.6rem 0.5rem;
        font-size: 0.825rem;
        min-height: 44px;
    }

    /* Category cards more compact */
    .category-card {
        padding: 1rem;
    }

    .category-title {
        font-size: 1.05rem;
    }

    .category-description {
        font-size: 0.875rem;
    }

    /* Hub tabs wrap better */
    .hub-tab {
        padding: 0.4rem 0.85rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   SEARCH-ACTIVE REORDERING (replaces DOM manipulation)
   ======================================== */

/* When searching/filtering, use CSS order to visually move prayers up
   instead of moving DOM elements which breaks mobile layout */
main.container.prayers-searching .quick-access-bar {
    order: 10;
}

main.container.prayers-searching #navigation-hub {
    order: 11;
}

main.container.prayers-searching #prayers-container {
    order: 2;
}

main.container.prayers-searching #prayer-finder {
    order: 1;
}

main.container.prayers-searching #bracha-finder {
    order: 20;
}

main.container.prayers-searching #back-to-top {
    order: 21;
}

/* Enable flexbox on main when searching so order properties work */
main.container.prayers-searching {
    display: flex;
    flex-direction: column;
}

/* ========================================
   MOBILE-SPECIFIC PRAYER PAGE FIXES
   ======================================== */

@media (max-width: 768px) {
    /* Ensure main container doesn't overflow */
    main.container {
        overflow-x: hidden;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Fix the prayer finder sticky so it doesn't overlap header */
    .prayer-finder-sticky {
        position: sticky;
        top: 0;
        z-index: 20;
        margin-top: 0;
        border-radius: 0 0 0.75rem 0.75rem;
        border-left-width: 3px;
    }

    /* Fix Navigation Hub - ensure clean panel switching */
    #navigation-hub {
        padding: 1rem;
        margin-bottom: 1.25rem;
        border-radius: 1rem;
        overflow: hidden;
    }

    /* Navigation Hub header - stack on mobile */
    .nav-hub-header {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .nav-hub-header h2 {
        font-size: 1.35rem;
        line-height: 1.3;
    }

    .nav-hub-header p {
        font-size: 0.825rem;
        margin-top: 0.25rem;
        line-height: 1.5;
    }

    /* Hub tabs - full width row on mobile for easy tapping */
    .nav-hub-tabs {
        display: flex;
        width: 100%;
        gap: 0.4rem;
    }

    .hub-tab {
        flex: 1;
        text-align: center;
        padding: 0.55rem 0.75rem;
        font-size: 0.875rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Panels - single column, only active one shows */
    .nav-hub-panels {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .nav-hub-panel {
        display: none;
        padding: 0.85rem;
        border-radius: 0.75rem;
    }

    /* Only show the active panel */
    .nav-hub[data-hub-view="categories"] .nav-hub-panel[data-hub-panel="categories"],
    .nav-hub[data-hub-view="directory"] .nav-hub-panel[data-hub-panel="directory"] {
        display: flex;
    }

    /* Category nav items - proper touch targets */
    .category-nav {
        gap: 0.5rem;
    }

    .category-nav-item {
        padding: 0.7rem 0.85rem;
        min-height: 44px;
        border-radius: 0.6rem;
    }

    .category-nav-title {
        font-size: 0.875rem;
    }

    .category-nav-desc {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    /* Directory grid - single column on mobile */
    .directory-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .directory-link {
        padding: 0.75rem 0.85rem;
        font-size: 0.9rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        border-radius: 0.5rem;
    }

    /* Prayer sections - prevent overflow */
    .prayer-section {
        border-radius: 0.75rem;
        overflow: hidden;
        margin-bottom: 1rem;
        scroll-margin-top: 80px;
    }

    /* Prayer header - clean mobile layout */
    .prayer-header {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
    }

    .prayer-header-main {
        gap: 0.5rem;
    }

    .prayer-title {
        font-size: 1.15rem;
        line-height: 1.35;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .prayer-toggle-indicator {
        align-self: flex-end;
        font-size: 0.8rem;
    }

    /* Prayer body - compact padding */
    .prayer-body {
        padding: 0 0.85rem 1rem;
        gap: 1rem;
    }

    /* Prayer content - prevent horizontal overflow */
    .prayer-content {
        grid-template-columns: 1fr;
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Text sections - prevent overflow */
    .text-section {
        padding: 0.85rem;
        max-width: 100%;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .section-text {
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .hebrew-section .section-text {
        font-size: 1.1rem;
        line-height: 2;
    }

    /* Language switcher - fixed at bottom for easy access */
    .language-switcher {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0.5rem;
        border-radius: 0.6rem;
        margin-top: 1rem;
    }

    .language-tab {
        flex: 1 1 calc(50% - 0.2rem);
        text-align: center;
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0.5rem;
    }

    /* "Both" view - always single column on mobile */
    .prayer-section[data-language-view="both"] .prayer-content {
        grid-template-columns: 1fr;
    }

    /* Autocomplete dropdown - full width on mobile */
    .prayer-autocomplete {
        max-height: 250px;
        border-radius: 0 0 0.5rem 0.5rem;
    }

    .autocomplete-item {
        padding: 0.65rem 0.85rem;
        min-height: 44px;
    }

    /* Quick access - compact */
    .quick-access-bar {
        margin-top: 0.75rem;
        margin-bottom: 1rem;
        padding: 0.85rem;
        border-radius: 0.75rem;
    }

    .quick-access-pills {
        gap: 0.4rem;
    }

    .quick-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        min-height: 36px;
        border-radius: 0.5rem;
    }

    /* Finder footer - stack on mobile */
    .finder-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .prayer-count {
        text-align: center;
        font-size: 0.875rem;
    }

    .reset-button {
        width: 100%;
        text-align: center;
        min-height: 44px;
    }

    /* Back to top - don't overlap content */
    #back-to-top {
        bottom: 1rem;
        right: 0.75rem;
        width: 44px;
        height: 44px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Detail items */
    .prayer-details {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .detail-item {
        padding: 0.65rem 0.75rem;
    }

    /* Category chip */
    .category-chip {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }

    .prayer-summary {
        font-size: 0.875rem;
        padding: 0.6rem 0.75rem;
    }
}

/* Extra small phone screens */
@media (max-width: 400px) {
    main.container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    #navigation-hub {
        padding: 0.75rem;
    }

    .nav-hub-header h2 {
        font-size: 1.2rem;
    }

    .prayer-header {
        padding: 0.85rem;
    }

    .prayer-title {
        font-size: 1.05rem;
    }

    .prayer-body {
        padding: 0 0.65rem 0.85rem;
    }

    .text-section {
        padding: 0.65rem;
    }

    .section-title {
        font-size: 0.9rem;
    }

    .section-text {
        font-size: 0.875rem;
    }

    .hebrew-section .section-text {
        font-size: 1rem;
        line-height: 1.9;
    }

    .language-tab {
        font-size: 0.75rem;
        padding: 0.45rem 0.3rem;
    }

    .hub-tab {
        font-size: 0.8rem;
        padding: 0.45rem 0.6rem;
    }

    .quick-link {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
    }
}

/* ========================================
   RIGHT-SIDE ANCHOR MENU (In-Page Navigation)
   ======================================== */

.prayers-anchor-menu {
    position: fixed;
    right: 0;
    top: 120px;
    z-index: 60;
    width: 100px;
    max-height: 74vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(30, 58, 138, 0.13);
    border-right: none;
    border-radius: 10px 0 0 10px;
    box-shadow:
        -4px 6px 24px rgba(30, 58, 138, 0.10),
        inset 0 1px 0 rgba(255,255,255,0.7);
    padding: 0.5rem 0.35rem;
    scroll-behavior: smooth;
}

.prayers-anchor-menu::-webkit-scrollbar { width: 3px; }
.prayers-anchor-menu::-webkit-scrollbar-track { background: transparent; }
.prayers-anchor-menu::-webkit-scrollbar-thumb {
    background: rgba(30, 58, 138, 0.18);
    border-radius: 3px;
}

.prayers-anchor-menu__title {
    margin: 0 0 0.35rem;
    padding: 0 0.3rem 0.3rem;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #2563eb;
    border-bottom: 1px solid rgba(37, 99, 235, 0.15);
}

.prayers-anchor-cat {
    margin: 0.5rem 0 0.15rem;
    padding: 0 0.3rem;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #1e40af;
    opacity: 0.65;
}

.prayers-anchor-cat:first-of-type {
    margin-top: 0.2rem;
}

.prayers-anchor-link {
    display: block;
    text-decoration: none;
    color: #374e6e;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 0.26rem 0.32rem;
    border-radius: 7px;
    transition: background 0.14s, color 0.14s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prayers-anchor-link:hover {
    background: rgba(37, 99, 235, 0.09);
    color: #1e3a8a;
}

.prayers-anchor-link.active {
    background: rgba(37, 99, 235, 0.13);
    color: #1e3a8a;
    font-weight: 700;
}

@media (max-width: 960px) {
    .prayers-anchor-menu { display: none; }
}

/* ========================================
   FOOD BLESSING FINDER (Bracha Calculator)
   ======================================== */

.bracha-finder {
    background: linear-gradient(135deg, #f0f5ff 0%, #e8effe 60%, #f5f8ff 100%);
    border: 1px solid #dbeafe;
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(15, 31, 79, 0.10);
    margin-top: 3rem;
    overflow: hidden;
    scroll-margin-top: 120px;
}

.bracha-finder__inner {
    padding: 2.5rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.bracha-finder__head {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bracha-finder__eyebrow {
    font-family: 'SBL Hebrew', 'Ezra SIL', 'Frank Ruehl CLM', 'Times New Roman', serif;
    font-size: 2.2rem;
    color: #2563eb;
    margin: 0;
    line-height: 1;
}

.bracha-finder__title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f1f4f;
    margin: 0;
    padding: 0;
    border: none;
}

.bracha-finder__sub {
    color: #475569;
    font-size: 1rem;
    margin: 0;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.bracha-finder__form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.bracha-finder__input-wrap {
    display: flex;
    gap: 0.75rem;
}

.bracha-finder__input {
    flex: 1;
    border: 2px solid #bfdbfe;
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    background: #ffffff;
    color: #1e3a8a;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

.bracha-finder__input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bracha-finder__input::placeholder {
    color: #94a3b8;
}

.bracha-finder__btn {
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1.4rem;
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bracha-finder__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.34);
}

.bracha-finder__examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.bracha-finder__ex-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.bracha-ex-pill {
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    background: white;
    color: #1e40af;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bracha-ex-pill:hover {
    background: #e0e7ff;
    border-color: #6366f1;
}

/* Result card */
.bracha-finder__result {
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.bracha-finder__result[hidden] { display: none; }

.bracha-result-card {
    border-radius: 16px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 2px solid;
    animation: brachaFadeIn 0.3s ease;
}

@keyframes brachaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bracha-result-card--amber {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fbbf24;
}
.bracha-result-card--yellow {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-color: #facc15;
}
.bracha-result-card--purple {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-color: #a78bfa;
}
.bracha-result-card--green {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #4ade80;
}
.bracha-result-card--brown {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-color: #d97706;
}
.bracha-result-card--blue {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #60a5fa;
}

.bracha-result__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #374151;
}

.bracha-result__food {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
}

.bracha-result__name-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bracha-result__name-en {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1e3a8a;
}

.bracha-result__name-he {
    font-family: 'SBL Hebrew', 'Ezra SIL', 'Frank Ruehl CLM', 'Times New Roman', serif;
    font-size: 1.4rem;
    color: #1e40af;
    direction: rtl;
}

.bracha-result__hebrew-text {
    font-family: 'SBL Hebrew', 'Ezra SIL', 'Frank Ruehl CLM', 'Times New Roman', serif;
    font-size: 1.45rem;
    line-height: 2;
    color: #0f1f4f;
    direction: rtl;
    text-align: right;
    background: rgba(255,255,255,0.6);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.bracha-result__translit {
    font-style: italic;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
}

.bracha-result__english {
    color: #1e3a8a;
    font-size: 1rem;
    line-height: 1.65;
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.05rem;
}

.bracha-result__note {
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
    color: #374151;
    border-left: 3px solid rgba(0,0,0,0.12);
    line-height: 1.55;
}

.bracha-result__not-found {
    background: #f8fbff;
    border: 2px dashed #bfdbfe;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    color: #1e3a8a;
}

.bracha-result__not-found strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}

/* Reference guide cards */
.bracha-finder__guide {
    border-top: 1px dashed #dbeafe;
    padding-top: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bracha-guide__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e3a8a;
    text-align: center;
    margin: 0;
}

.bracha-guide__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.bracha-guide-card {
    border-radius: 12px;
    padding: 0.85rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
    border: 1px solid;
    cursor: default;
}

.bracha-guide-card--amber { background: #fffbeb; border-color: #fbbf24; }
.bracha-guide-card--yellow { background: #fefce8; border-color: #facc15; }
.bracha-guide-card--purple { background: #f5f3ff; border-color: #a78bfa; }
.bracha-guide-card--green { background: #f0fdf4; border-color: #4ade80; }
.bracha-guide-card--brown { background: #fefce8; border-color: #d97706; }
.bracha-guide-card--blue { background: #eff6ff; border-color: #60a5fa; }

.bgc-hebrew {
    font-family: 'SBL Hebrew', 'Ezra SIL', 'Frank Ruehl CLM', 'Times New Roman', serif;
    font-size: 1.35rem;
    color: #0f1f4f;
    direction: rtl;
    line-height: 1.4;
}

.bgc-name {
    font-weight: 700;
    font-size: 0.82rem;
    color: #1e3a8a;
}

.bgc-desc {
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .bracha-finder__inner { padding: 1.5rem 1rem 1.5rem; gap: 1.5rem; }
    .bracha-finder__eyebrow { font-size: 1.6rem; }
    .bracha-finder__title { font-size: 1.35rem; }
    .bracha-finder__input-wrap { flex-direction: column; }
    .bracha-finder__btn { width: 100%; }
    .bracha-guide__grid { grid-template-columns: repeat(3, 1fr); }
    .bgc-hebrew { font-size: 1.15rem; }
}

/* Print Styles */
@media print {
    .category-card,
    .category-link,
    .directory-link,
    .nav-hub,
    .quick-access-bar,
    #prayer-finder,
    #back-to-top,
    header,
    footer {
        display: none !important;
    }
    
    .prayer-section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}
