/* ================================================================== */
/* =====                    BULLETIN STYLES                     ===== */
/* ================================================================== */

/* --- Highlighting & Search Styles --- */
/* --- Mobile Style --- */
/* --- MOBILE STYLES (Vertical Stack) --- */
/* When the screen is 768px wide or less... */
h1 {
    font-size: 2em;
}
h2 {
    font-size: 1.7em;
}
h3 {
    font-size: 1.4em;
}
h4 {
    font-size: 1.3em;
}
/* Download PDF */
.pdf-download {
    position: absolute;
    z-index: 10000;
    top: 20%;
    right: 10px;
    transform: translateY(-50%);
    text-align: right;
    transition: opacity 0.5s;
}

.pdf-cover {
    width: 100px;
    height: auto;
    display: block;
    margin-bottom: 5px;
}

.download-button {
    background-color: #4b006e;
    color: white;
    padding: 11px 11px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    width: 100px;
}

.download-button:hover {
    background-color: #6e005a;
}

.pdf-download .hidden {
    opacity: 0;
}
.mark-yellow {
    /* General matches */
    background-color: yellow;
    color: black;
}
#cd-vertical-nav ul {
    list-style: none;
    margin-left: 0;
    line-height: 1;
    margin-bottom: 0;
}
.mark-orange {
    /* Currently selected/active match */
    background-color: orange;
    color: black;
    font-weight: bold;
}
.search-highlight {
    /* Legacy class, can be used or removed */
    background-color: yellow;
    font-weight: bold;
}

/* --- Search Results Popup Styles --- */
.search-results-popup {
    position: fixed;
    top: 7.5rem;
    right: 1.25rem;
    width: 18.75rem;
    max-height: 70vh;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
    z-index: 1050;
    border-radius: 0.3125rem;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
}
.search-results-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: #eee;
    border-bottom: 1px solid #ccc;
    border-top-left-radius: 0.3125rem;
    border-top-right-radius: 0.3125rem;
}
.search-results-popup .popup-header #popupMatchStats {
    font-weight: bold;
}
.search-results-popup .popup-nav-button {
    background: none;
    border: 1px solid #aaa;
    border-radius: 0.1875rem;
    padding: 0.125rem 0.375rem;
    cursor: pointer;
    margin-left: 0.3125rem;
}
.search-results-popup .popup-nav-button:hover {
    background-color: #ddd;
}
.search-results-popup .popup-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#popupResultsList {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
}
#popupResultsList li {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
#popupResultsList li:hover {
    background-color: #e9e9e9;
}
#popupResultsList li.active-result-item {
    background-color: #ede6f7;
    font-weight: bold;
}

/* --- Collapsible Section Styles --- */
.collapsible-trigger,
.inner-collapsible-trigger {
    cursor: pointer;
    padding: 1rem 1.25rem;
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}
.pastor-section {
    background-color: #f7f7f7;
    color: #333;
}
.collapsible-trigger:hover,
.inner-collapsible-trigger:hover {
    color: #333;
}
.collapsible-trigger.collapsed,
.inner-collapsible-trigger.collapsed {
    border-radius: 0.25rem; /* All corners rounded when collapsed */
}
.collapsible-trigger .toggle-icon,
.inner-collapsible-trigger .toggle-icon {
    font-size: 1.2rem;
    font-weight: bold;
}
.collapsible-content,
.inner-collapsible-content {
    padding: 1.25rem;
    border: 1px solid #dee2e6;
    border-top: 0;
    border-radius: 0 0 0.25rem 0.25rem;
    box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.4);
}

/* --- General Header & Utility Styles --- */
.img-fullwidth {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}
.full-width-image-wrapper {
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
    max-width: 100vw;
}
.full-width-image-wrapper img {
    width: 100vw;
    display: block;
}
.text-4xl {
    font-size: 2.25rem;
}
.text-2xl {
    font-size: 1.5rem;
}
.text-l {
    font-size: 1.125rem;
}
.font-bold {
    font-weight: 700;
}
.text-center {
    text-align: center;
}
.mb-4 {
    margin-bottom: 1rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.text-title {
    color: #4b006e;
}
.text-end {
    text-align: end;
}
.px-1 {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}
.py-0 {
    padding-top: 0;
    padding-bottom: 0;
}
.p-4 {
    padding: 1rem;
}
.border {
    border: 1px solid #dee2e6;
}

/* Responsive table styles */
th,
td {
    line-height: 1.5;
    font-size: 1rem;
}

/* Back to Top Button */
#page-button {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    right: 1.875rem;
    z-index: 99;
    background-color: #4a0072;
    color: white;
    cursor: pointer;
    width: 3.125rem;
    height: 3.125rem;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.5rem;
    box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.3);
    border: none;
    outline: none;
    align-items: center;
    justify-content: center;
}
#page-button:hover {
    background-color: #600092;
}

/* ========== General Header Layout (Mostly Unchanged) ========== */
header {
    background-color: #fff;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-family: Arial, sans-serif;
}
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}
.logo-area {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    flex-shrink: 0;
}
.logo-image {
    height: 4rem;
}
.header-main-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem; /* This creates space between the date links and the PDF button */
}

/* ========== MODIFIED CSS ========== */

/* 1. Date links are now stacked vertically */
.date-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row; /* This is the key change to stack them */
    align-items: flex-start; /* Aligns text to the left */
    gap: 4px; /* Adjusts the vertical gap between links */
}
.date-links a {
    text-decoration: none;
    color: #555;
    font-size: 0.75rem;
    white-space: nowrap;
}
.date-links a:hover {
    color: #000;
}

/* --- Header Component Styles: Search & Font --- */
.search-container {
    display: flex;
    align-items: center;
    flex-grow: 0;
    flex-shrink: 1;
    max-width: 25rem;
    min-width: 20rem;
}
#searchInput {
    flex-grow: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d1d1;
    border-radius: 1.25rem 0 0 1.25rem;
    font-size: 0.8125rem;
    outline: none;
    min-width: 9.375rem;
}
#searchInput:focus {
    border-color: #4a0e4e;
}
#searchButton {
    padding: 0.5rem 1.25rem;
    background-color: #4a0e4e;
    color: white;
    border: 1px solid #4a0e4e;
    border-left: none;
    border-radius: 0 1.25rem 1.25rem 0;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: bold;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}
#searchButton:hover {
    background-color: #3a0b3e;
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.font-size-button {
    background-color: transparent;
    border: 1px solid #d1d1d1;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}
.font-size-button.small {
    font-size: 0.75rem;
}
.font-size-button.medium {
    font-size: 0.9375rem;
}
.font-size-button.large {
    font-size: 1.125rem;
}
.font-size-button:hover {
    border-color: #4a0e4e;
    color: #4a0e4e;
}
.font-size-button.active {
    background-color: #4a0e4e;
    color: white;
    border-color: #4a0e4e;
}

/* --- Responsive Header --- */
@media (max-width: 992px) {
    /* Adjust breakpoint as needed */
    .header-top-row {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    .header-main-actions {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
        justify-content: center;
    }
    .date-links ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 0.75rem;
    }
    #searchStats {
        display: block !important;
        width: 100%;
        text-align: center;
        margin-top: 0.3125rem;
    }
}
small {
    font-size: 0.75em;
}
@media (max-width: 768px) {
    .date-links ul {
        /* THIS IS THE KEY PART THAT STACKS THEM VERTICALLY */
        flex-direction: column; /* Change direction from row to column */
        align-items: center; /* Center the stacked items */
        gap: 0.1rem 0.75rem; /* Adjust gap for vertical layout */
    }

    .date-links li {
        margin: 0; /* Adjust spacing for vertical layout */
    }
}
.pdf-link-mobile {
    display: none; /* Hidden by default, shown on mobile */
}

.footer-image {
    height: 2.5rem;
    max-width: 100%;
}

@media (max-width: 768px) {
    /* 1. Use CSS Grid */
    .header-top-row {
        display: grid;
        grid-template-columns: auto 1fr auto; /* logo | center space | pdf */
        grid-template-rows: auto auto auto; /* 3 rows */
        gap: 15px;
        padding: 0 15px;
    }

    /* 2. Logo - row 1, left */
    .logo-area {
        grid-column: 1;
        grid-row: 1;
        max-width: 80px;
    }

    /* 3. Date links - row 1, CENTER */
    .date-links {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .date-links ul {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    /* 4. PDF - row 1, right */
    .pdf-link-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        text-decoration: none;
        font-weight: bold;
        font-size: 1.5rem;
        width: 80px;
        height: 80px;
        grid-column: 3;
        grid-row: 1;
    }
    .pdf-link-mobile .pdf-cover {
        max-width: 80px;
    }

    .pdf-link-mobile .download-button {
        max-width: 80px;
        font-size: 12px;
    }

    /* 5. Font-size controls - row 2, centered */
    .font-size-controls {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        justify-content: center;
    }

    /* 6. Search - row 3, centered */
    .search-container {
        grid-column: 1 / -1;
        grid-row: 3;
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .search-container input {
        flex: 1;
        max-width: 300px;
    }

    /* 7. Hide floating PDF */
    .pdf-download {
        display: none;
    }

    /* 8. Make children direct grid items */
    .header-main-actions {
        display: contents;
    }
}
