:root {
    --bs-body-font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --bs-heading-font-family: 'Playfair Display', Georgia, serif;
    --bs-body-color: #1a1a1a;
    --bs-secondary-color: #4a5568;
}


body {
    font-family: var(--bs-body-font-family);
    line-height: 1.65;
    color: var(--bs-body-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6,
.card-title,
.modal-title,
.navbar-brand {
    font-family: var(--bs-heading-font-family);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

h1,
.h1 {
    font-size: clamp(1.75rem, 4vw + 1rem, 3rem);
}

h2,
.h2 {
    font-size: clamp(1.5rem, 3vw + 1rem, 2.5rem);
}

h3,
.h3 {
    font-size: clamp(1.25rem, 2vw + 1rem, 2rem);
}


.text-muted {
    color: var(--bs-secondary-color) !important;
}

.badge,
.fc-list-event-time,
.service-time,
.event-time-display,
.time-display {
    font-family: 'Inter', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0px;
}

.btn {
    line-height: 1.5;
}

.nav-link {
    font-family: var(--bs-body-font-family);
    font-weight: 500;
}

[data-bs-theme="dark"] {
    --bs-body-color: #e2e8f0;
    --bs-secondary-color: #a0aec0;
}

/* ========================================= */
/* COLOR PALETTE: MODERN SANCTUARY           */
/* ========================================= */

:root {
    /* PRIMARY: Burnt Terracotta (The "Orange") */
    /* Warm, inviting, and high visibility */
    --bs-primary: #EE6C4D;
    --bs-primary-rgb: 238, 108, 77;

    --bs-primary-bg-subtle: #FDE8E1; 
    /* A darker, readable orange for text on subtle backgrounds */
    --bs-primary-text-emphasis: #8F2C14; 
    /* A border color that sits between the background and the main color */
    --bs-primary-border-subtle: #F5BCAE;
    
    /* SECONDARY: Slate Blue (The "Blue") */
    /* Stable, cool backing color */
    --bs-secondary: #3D5A80;
    --bs-secondary-rgb: 61, 90, 128;

    /* ACCENT: Soft Cyan (unchanged) */
    --bs-info: #98C1D9;
    --bs-info-rgb: 152, 193, 217;

    /* BODY TEXT: Deep Blue-Black */
    --bs-body-color: #293241;
    --bs-body-bg: #eef2f6; /* Cool Gray Background */

    /* LINK COLORS */
    --bs-link-color: #EE6C4D; /* Links are now Orange */
    --bs-link-hover-color: #d65a3b; /* Darker Orange on hover */
}

/* ========================================= */
/* DARK MODE OVERRIDES                       */
/* ========================================= */

[data-bs-theme="dark"] {
    /* BACKGROUND: Gunmetal */
    --bs-body-bg: #1a202c;
    --bs-body-color: #E0E6ED;
    --bs-primary-bg-subtle: #45180D; 
    /* A light, pastel peach for text visibility on dark backgrounds */
    --bs-primary-text-emphasis: #FFD2C4; 
    /* A muted border color */
    --bs-primary-border-subtle: #8F2C14;

    /* CARDS */
    --bs-card-bg: #2d3748;
    --bs-card-border-color: #465366;

    /* PRIMARY IN DARK MODE: Keep it Orange (pops well on dark) */
    --bs-primary: #EE6C4D; 
    --bs-primary-rgb: 238, 108, 77;

    /* LINKS IN DARK MODE */
    --bs-link-color: #fabeb0; /* Lighter Orange/Peach for better contrast on dark */
    --bs-link-hover-color: #EE6C4D;

    /* SECONDARY BACKGROUNDS */
    --bs-secondary-bg: #3e4c5e; 
    --bs-tertiary-bg: #2d3748;
    
    /* BORDERS */
    --bs-border-color: #465366;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
}

/* --- COMPONENT TWEAKS FOR NEW COLORS --- */

/* Buttons: Add a subtle transition */
.btn-primary {
    background-color: var(--bs-primary);
    /* Gradient from Orange to a slightly peachy/lighter orange */
    background-image: linear-gradient(135deg, var(--bs-primary) 0%, #ff8c6b 100%);
    border: none;
    box-shadow: 0 4px 6px rgba(238, 108, 77, 0.3); /* Orange shadow */
    color: #fff; /* Ensure text is white */
}

.btn-primary:hover {
    /* Reverse/Darken gradient */
    background-image: linear-gradient(135deg, #d65a3b 0%, var(--bs-primary) 100%);
    box-shadow: 0 6px 12px rgba(238, 108, 77, 0.4);
}

/* Outline Buttons */
.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

/* Badges: Soft Orange Background */
.badge.bg-primary-subtle {
    background-color: rgba(238, 108, 77, 0.15) !important; /* Orange tint */
    color: #c44d32 !important; /* Darker Orange text for readability */
}

[data-bs-theme="dark"] .badge.bg-primary-subtle {
    background-color: rgba(238, 108, 77, 0.2) !important;
    color: #ffbca8 !important; /* Light Peach text */
}

/* Nav Link Active State */
.nav-pills .nav-link.active, 
.nav-pills .show > .nav-link {
    background-color: var(--bs-primary); /* Orange pill */
    color: white;
}

/* ========================================= */
/* VISUAL ENHANCEMENTS: THEMING & POLISH     */
/* ========================================= */

/* 1. Soft Backgrounds & Tinted Grays */
body {
    /* Slightly cooler/warmer than pure white to reduce eye strain */
    background-color: #eef2f6;
}

.text-muted,
.small,
small {
    /* Slate-gray instead of generic gray for better harmony with your primary color */
    color: #64748b !important;
}

/* 2. Selection Color (Highlighting text) */
::selection {
    background-color: rgba(61, 90, 128, 0.25);
    /* Primary color at 25% opacity */
    color: var(--bs-primary);
}

/* 3. Scrollbar Styling (Thin & Rounded) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    /* Light slate */
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--bs-primary);
}

/* 4. Gradient Accents for Primary Buttons */
.btn-primary {
    /* Subtle gradient from Slate Blue to a slightly lighter tone */
    background-image: linear-gradient(135deg, var(--bs-primary) 0%, #4a6d96 100%);
    border: none;
    box-shadow: 0 4px 6px rgba(61, 90, 128, 0.2);
}

.btn-primary:hover {
    background-image: linear-gradient(135deg, #2b405b 0%, var(--bs-primary) 100%);
    box-shadow: 0 6px 12px rgba(61, 90, 128, 0.3);
}

/* 5. Card Borders: Clean Look */
.card,
.group-card,
.church-card,
.contact-card {
    border: none !important;
    /* We rely on shadow for separation now */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* 6. Status Colors: Soft Pastels */
/* Overriding standard Bootstrap badges to be pastel with dark text */
.badge.bg-success {
    background-color: #d1fae5 !important;
    /* Pastel Mint */
    color: #065f46 !important;
    /* Dark Emerald */
    border: 1px solid rgba(6, 95, 70, 0.1) !important;
}

.badge.bg-danger {
    background-color: #fee2e2 !important;
    /* Pastel Rose */
    color: #991b1b !important;
    /* Dark Red */
    border: 1px solid rgba(153, 27, 27, 0.1) !important;
}

.badge.bg-warning {
    background-color: #fef3c7 !important;
    /* Pastel Amber */
    color: #92400e !important;
    /* Dark Amber */
}

/* 7. Glassmorphism for Sticky Elements */
.navbar.fixed-top,
.floating-controls,
#groups-sticky-wrapper {
    /* Translucent background */
    background-color: rgba(238, 242, 246, 0.85) !important;
    /* The blur effect */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* Subtle border to separate from content */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* 8. Dark Mode Polish */
[data-bs-theme="dark"] {
    body {
        background-color: #1a202c;
        /* Deep Slate for background */
    }

    /* Dark Mode Scrollbar */
    ::-webkit-scrollbar-thumb {
        background-color: #475569;
    }

    /* Dark Mode Glassmorphism */
    .navbar.fixed-top,
    .floating-controls,
    #groups-sticky-wrapper {
        background-color: rgb(33, 37, 41, 0.85) !important;
        /* Gunmetal with opacity */
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    /* Muted Text in Dark Mode (Cooler gray) */
    .text-muted,
    .small,
    small {
        color: #94a3b8 !important;
    }

    /* Lower Saturation for Badges in Dark Mode */
    .badge.bg-success {
        background-color: rgba(6, 95, 70, 0.4) !important;
        color: #d1fae5 !important;
        border: 1px solid rgba(209, 250, 229, 0.1) !important;
    }

    .badge.bg-danger {
        background-color: rgba(153, 27, 27, 0.4) !important;
        color: #fee2e2 !important;
    }



    .card,
    .group-card,
    .church-card,
    .contact-card,
    .recipe-card {
        background-color: #2d3748;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    }


}

/* ========================================= */
/* SECTION III: CARD UI ENHANCEMENTS         */
/* ========================================= */

/* 1. Deep Shadows & 2. Hover Lift & 3. Rounded Corners */
.card,
.group-card,
.church-card,
.contact-card,
.recipe-card {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 1rem !important;
    box-shadow: 0 4px 6px -1px rgba(50, 50, 93, 0.11), 0 1px 3px -1px rgba(0, 0, 0, 0.08); 
    overflow: hidden; 
    -webkit-tap-highlight-color: transparent;
}

/* Hover State */
.card:hover,
.group-card:hover,
.church-card:hover,
.contact-card:hover,
.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 4. Card Footer Separation */
/* Applies to the actions area at the bottom of cards */
.card-footer-custom {
    background-color: var(--bs-body-bg);
    /* Use page background for "cutout" effect, or darken slightly */
    border-top: 1px solid var(--bs-border-color-translucent);
    padding: 1rem;
    margin-top: auto;
    /* Ensures it pushes to the bottom in flex containers */
}

/* Alternative: Subtle background tint */
.card-footer-custom.tinted {
    background-color: rgba(0, 0, 0, 0.02);
}

/* 5. Badge Placement (Floating Overlay) */
.card-badge-top-right {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    /* Sit above the image */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    /* Lift the badge off the image */
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    padding: 0.5em 1em;
}

.status-pill-eyebrow {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.25rem 0.75rem;
    border-radius: 50rem;
    margin-bottom: 0.5rem;
    /* Space between badge and title */
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .status-pill-eyebrow {
    background-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.1);
}

/* 6. Inner Borders (Dark Mode) */
/* Adds a subtle rim to images so they don't blend into the dark card bg */
[data-bs-theme="dark"] .card-img-top,
[data-bs-theme="dark"] .business-logo {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Adjustments for specific card types */
.business-logo {
    padding: 1.5rem;
    /* Give logos breathing room */
    background-color: #fff;
    /* Ensure transparent logos look good */
}

[data-bs-theme="dark"] .business-logo {
    background-color: rgba(255, 255, 255, 0.05);
    /* Slight tint for logos in dark mode */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#main-content-container {
    animation: fadeIn 0.4s ease-out;
}

/* ---- General & Shared Styles ---- */
html {
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    padding-top: 70px;
    background-color: #f8f9fa;
}

@media (max-width: 767.98px) {
    body {
        padding-top: 5px !important;
    }
}

.container-fluid {
    max-width: 1200px;
}

.main-header h1 {
    font-weight: 700;
    color: #212529;
}

.page-content-wrapper {
    flex-grow: 1;
    /* overflow-y: auto;*/
    min-height: 0;
}

.navbar-toggler .navbar-menu-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.5;
    /* Add this line */
}

/* ---- Card Styles (for Groups & Churches) ---- */
.group-card,
.church-card {
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.group-card:hover,
.church-card:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.group-card .card-body,
.church-card .card-body {
    padding: 1.5rem;
}

.group-card .card-title,
.church-card .card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--bs-body-color);
    margin-bottom: 0.75rem;
}

.church-card .info-line {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--bs-text-muted);
}

.church-card .info-line .card-text,
.church-card .info-line .card-subtitle {
    color: var(--bs-text-muted) !important;
}

.church-card .info-line svg {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: -2px;
}

.church-card .card-actions {
    margin-top: 1rem;
}

.group-card .card-body .mt-auto {
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color-translucent);
    margin-top: 1rem;
}


.group-card .card-img-top {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* ---- Shared Modal & UI Element Styles ---- */
.search-controls,
.search-and-map-controls {
    margin: 2rem 0;
}

.section-heading {
    font-weight: 600;
    color: #343a40;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.contact-card {
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

.contact-card strong {
    font-size: 1.1rem;
}

/* --- Added for Cancellation Feature --- */
.cancelled-event .fc-event-title,
.cancelled-service-display {
    text-decoration: line-through;
}

.cancelled-service {
    background-color: #f8d7da;
    /* A light red to indicate cancellation */
    border-color: #f5c6cb;
}

[data-bs-theme="dark"] .cancelled-service {
    background-color: #4d282a;
    border-color: #582f32;
}

/* --- Inactive Group Styling --- */
.group-section-divider {
    display: flex;
    align-items: center;
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bs-secondary);
    letter-spacing: 1px;
    margin: 2rem 0 1rem 0;
}

.group-section-divider::before,
.group-section-divider::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--bs-border-color);
}

.group-section-divider span {
    padding: 0 1rem;
}

.group-card-inactive {
    opacity: 0.75;
    background-color: rgba(0, 0, 0, 0.02);
    /* Very subtle gray tint */
    border-style: dashed;
    /* Visual cue that it's "archived" */
}

[data-bs-theme="dark"] .group-card-inactive {
    background-color: rgba(255, 255, 255, 0.02);
}

.group-card-inactive img {
    filter: grayscale(100%);
    /* Black and white image */
    transition: filter 0.3s;
}

.group-card-inactive:hover {
    opacity: 1;
    border-style: solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.group-card-inactive:hover img {
    filter: grayscale(0%);
    /* Color returns on hover */
}

/* ---- Dark Mode Overrides ---- */
[data-bs-theme="dark"] {
    body {
        background-color: #212529;
        color: #dee2e6;
    }

    .fc-col-header-cell {
        background-color: var(--bs-body-bg) !important;
    }

    .main-header h1 {
        color: #f8f9fa;
    }

    .group-card,
    .church-card,
    .contact-card {
        border-color: #495057;
        background-color: #343a40;
    }

    .filter-controls-header {
        background-color: #343a40;
        border-color: #495057;
    }

    .section-heading,
    #servicesModalBody .section-heading,
    .modal-body .section-heading {
        color: #f8f9fa;
        border-bottom-color: #495057;
    }

    .text-muted,
    .event-details-small {
        color: #adb5bd !important;
    }

    /* Page-Specific Dark Mode Fixes */
    .fc-list-day-cushion {
        background-color: #343a40;
        color: #dee2e6;
    }

    .fc-list-event:hover td {
        background-color: #495057;
        /* A subtle, darker hover color */
    }

    #sermonsContainer .container {
        background-color: #2b3035;
    }

    #sermonsContainer .minister-name-toggler {
        background-color: #343a40;
        color: #58a6ff;
    }

    .sermons-page .container {
        background-color: #2b3035;
        border-color: #495057;
    }

    .sermons-page .minister-name-toggler {
        background-color: #343a40;
        color: #58a6ff;
        border-bottom-color: #495057;
    }

    .sermons-page .sermon-item {
        border-bottom-color: #343a40;
    }

    .sermons-page .sermon-title {
        color: #f0f6fc;
    }

    [data-bs-theme="dark"] .ts-dropdown,
    .ts-control,
    .ts-control input,
    .ts-dropdown-content,
    .ts-dropdown .create {
        background-color: #343a40;
        /* Dark background from your theme */
        color: #f8f9fa !important;
        /* Explicitly light text color for typing */
        border-color: #495057;
        /* Dark border from your theme */
    }

    /* Target the placeholder text specifically */
    [data-bs-theme="dark"] .ts-control input::placeholder {
        color: #adb5bd;
        /* Lighter placeholder text */
        opacity: 1;
        /* Ensure placeholder is not faded */
    }

    /* Style for the dropdown panel */
    [data-bs-theme="dark"] .ts-dropdown {
        background-color: #343a40;
        border-color: #495057;
    }

    /* Style for each option in the dropdown */
    [data-bs-theme="dark"] .ts-dropdown .option {
        color: #dee2e6;
        /* Light text for all options */
    }

    /* Style for the active/hovered option */
    [data-bs-theme="dark"] .ts-dropdown .option.active,
    [data-bs-theme="dark"] .ts-dropdown .option:hover {
        background-color: #495057;
        /* A slightly lighter hover background */
        color: #f8f9fa;
    }

    /* Style for the optgroup headers (e.g., "Ministers", "Groups") */
    [data-bs-theme="dark"] .ts-dropdown .optgroup-header {
        color: #adb5bd;
        /* A muted but readable header color */
        font-weight: bold;
    }

    /* Style for the selected items (pills) in the input */
    [data-bs-theme="dark"] .ts-control>.item {
        background-color: #0d6efd;
        /* Use Bootstrap primary color for contrast */
        color: #ffffff;
        /* White text on the pill */
    }


}

.fc .fc-button-primary {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
    text-shadow: none;
    /* Removes default text shadow */
}

/* Hover & Focus State */
.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-secondary-color);
}

/* Active/Selected Button State (e.g., the currently selected view) */
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background-color: var(--bs-primary);
    color: #fff;
    /* Ensures text is readable on primary background */
    border-color: var(--bs-primary);
}

/* "Today" Button */

.fc .fc-today-button:hover,
.fc .fc-today-button:disabled {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff !important;
}



:root {
    --fc-header-height: 45px;
    --mobile-nav-height: 65px;
}

.mobile-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    height: var(--mobile-nav-height);
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--bs-secondary-color);
    padding: 5px 2px;
    min-width: 60px;
    background: none;
    border: none;
    transition: color 0.2s ease-in-out;
}

.mobile-nav-item svg {
    margin-bottom: 4px;
}

.mobile-nav-label {
    font-size: 0.7rem;
    color: inherit;
}

.mobile-nav-item.active {
    color: var(--bs-primary);
}

.mobile-nav-item:hover {
    color: var(--bs-primary-text-emphasis);
}

/* Floating Search/Filter Bar */
.floating-controls {
    position: fixed;
    bottom: var(--mobile-nav-height);
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--bs-tertiary-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1020;
    border-top: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
}

.floating-controls>.d-flex {
    padding: 0.75rem;
}

/* Active Filter Container (inside floating bar) */
#activeFiltersContainerMobile {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 0.75rem;
}

#activeFiltersContainerMobile.visible {
    max-height: 70px;
    opacity: 1;
    overflow-y: auto;
    padding-bottom: 0.75rem;
}

/* More Menu (Off-canvas) Styling */
#moreOffcanvas .list-group-item a,
#moreOffcanvas .list-group-item .btn-link {
    color: var(--bs-body-color);
    transition: color 0.2s ease-in-out;
}

#moreOffcanvas .list-group-item a:hover,
#moreOffcanvas .list-group-item .btn-link:hover {
    color: var(--bs-primary);
}

#moreOffcanvas .active-page-link {
    color: var(--bs-primary) !important;
    font-weight: bold;
}

/* ---- TomSelect Autocomplete Fixes ---- */

body>.ts-dropdown {
    bottom: calc(var(--mobile-nav-height) + 65px) !important;
    top: auto !important;
}

@media (min-width: 992px) {
    /* Completely hide the mobile floating bar on desktop */
    .floating-controls {
        display: none !important;
    }
}

.mobile-time-display {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--bs-primary);
    margin-bottom: 4px;
    line-height: 1.2;
    display: none; /* Hidden on desktop */
}

/* ---- Layout Adjustments for Mobile --- */
@media (max-width: 991.98px) {
    #calendar {
        --sticky-toolbar-height: 70px;
    }

    #groupsTab {
        padding-top: 10px;
    }

    .ts-dropdown.ts-mobile-force-up {
        top: auto !important;
        bottom: calc(var(--mobile-nav-height) + 65px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
    }

    #navbar-placeholder,
    .site-footer.d-lg-block {
        display: none !important;
    }

    .mobile-time-display {
        display: block; /* Show on mobile */
    }

    .fc-list-event-time {
        display: none !important;
    }

    .fc .fc-list-event-graphic,
    .fc .fc-list-event-time {
        white-space: normal !important;
    }

    .fc-list-event-time {
        white-space: normal !important;
        min-width: 85px !important;
        text-align: center !important;
        vertical-align: top !important;
        padding-top: 0.75rem !important;
        line-height: 1.3 !important;
    }

    /* 2. Hide the dash if it wraps awkwardly (Optional, styling preference) */
    /* This makes "11:00 AM - 12:00 PM" look cleaner when wrapped */
    .fc-list-event-time {
        word-spacing: 100vw; /* Force break between words */
    }

    #calendar .fc-header-toolbar {
        position: sticky;
        top: 0;
        z-index: 101;
        background-color: var(--bs-body-bg);
        border-bottom: 1px solid var(--bs-border-color);
        min-height: var(--sticky-toolbar-height);
        display: flex;
        align-items: center;
        margin-bottom: 0 !important;
    }

    #calendar .fc-scroller {
        max-height: calc(100vh - 230px);
        overflow-y: auto !important;
    }

    #calendar .fc-listDay-view .fc-scroller,
    #calendar .fc-listWeek-view .fc-scroller,
    #calendar .fc-listMonth-view .fc-scroller,
    #calendar .fc-listYear-view .fc-scroller {
        padding-bottom: 100px;
    }

    #calendar .fc-view-harness {
        overflow: visible !important;
    }

    #calendar .fc-list-day {
        top: var(--sticky-toolbar-height) !important;
        z-index: 100;
    }

    .mt-4 {
        margin-top: 0px !important;
    }

}


#calendar .fc-list-event-title>a,
#calendar .fc-event-desc-list {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: break-all;
}



#eventDetailBody .list-group-item .text-center.me-3 {
    background-color: var(--bs-secondary-bg);
    border-radius: 6px;
    padding: 4px 8px;
    min-width: 50px !important;
}

.fc-event.past-event {
    opacity: 0.8; 
    filter: saturate(0.9); 
}


.fc-list-event.past-event td {
    padding: 4px 10px !important; 
    background-color: transparent !important;
}

/* --- SKELETON LOADING --- */
.skeleton {
    background-color: #e0e0e0;
    background-image: linear-gradient(90deg, #e0e0e0 0px, #f0f0f0 40px, #e0e0e0 80px);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 4px;
    display: inline-block;
}

/* Dark Mode Adjustment */
[data-bs-theme="dark"] .skeleton {
    background-color: #343a40;
    background-image: linear-gradient(90deg, #343a40 0px, #495057 40px, #343a40 80px);
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Specific Element Shapes */
.skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 14px;
    width: 90%;
    margin-bottom: 0.5rem;
}

.skeleton-text-short {
    height: 14px;
    width: 40%;
    margin-bottom: 0.5rem;
}

.skeleton-badge {
    height: 20px;
    width: 60px;
    border-radius: 12px;
    display: inline-block;
    margin-left: 5px;
}

.skeleton-btn {
    height: 30px;
    width: 100px;
    border-radius: 4px;
}


/* --- Modern Card Back Styles (Merged & Optimized) --- */

/* 1. Scroll Wrapper (Keeps header/footer fixed) */
.card-back-content {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
    margin-bottom: 10px;
}

/* Custom Scrollbar */
.card-back-content::-webkit-scrollbar {
    width: 4px;
}

.card-back-content::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

[data-bs-theme="dark"] .card-back-content::-webkit-scrollbar-thumb {
    background-color: #555;
}

/* Container for the dashboard elements */
.card-back-dashboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 2. Info/Rules Box (Used for Monthly Rules & Weekly Schedule) */
.rules-container {
    background-color: var(--bs-tertiary-bg);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--bs-border-color-translucent);
}

/* DARK MODE: Use subtle transparency instead of solid gray */
[data-bs-theme="dark"] .rules-container {
    background-color: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.08);
}

.rule-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.rule-row:last-child {
    margin-bottom: 0;
}

.rule-icon {
    width: 28px;
    /* Slightly larger for better visibility */
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-body-bg);
    border-radius: 50%;
    margin-right: 12px;
    color: var(--bs-primary);
    border: 1px solid var(--bs-border-color-translucent);
    flex-shrink: 0;
}

[data-bs-theme="dark"] .rule-icon {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #6ea8fe;
    /* Softer Blue */
}

.rule-text {
    display: flex;
    flex-direction: column;
}

.rule-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--bs-secondary);
    line-height: 1;
    margin-bottom: 2px;
}

[data-bs-theme="dark"] .rule-label {
    color: #adb5bd;
}

.rule-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bs-body-color);
    line-height: 1.2;
}

/* 3. Weekly Schedule Grid (Optional View) */
.schedule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.service-pill {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

[data-bs-theme="dark"] .service-pill {
    background-color: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.08);
}

.service-day {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--bs-primary);
    margin-bottom: 2px;
}

[data-bs-theme="dark"] .service-day {
    color: #6ea8fe;
}

.service-time {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bs-body-color);
}

/* 4. Revival Highlight (Warning Color) */
.revival-highlight {
    background-color: rgba(255, 193, 7, 0.15);
    /* Transparent Yellow */
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
}

[data-bs-theme="dark"] .revival-highlight {
    background-color: rgba(255, 193, 7, 0.08);
    /* Lower opacity for dark mode */
    border-color: rgba(255, 193, 7, 0.2);
}

/* --- 1. ENABLE SCROLL SNAP --- */
.page-content-wrapper {
    scroll-behavior: smooth;
}

/* --- 2. STICKY DATE HEADERS --- */
.fc-list-day th {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    
}

/* --- 3. MOBILE ADJUSTMENTS --- */
@media (max-width: 991.98px) {
    .fc-list-day th {
        /* CHANGED: Reduced from 70px to 45px. 
           Adjust this number up/down by 5px until it sits perfectly under your search bar. */
        top: 0px !important;

        /* Ensure the header is solid so events don't show through it */
        background-color: var(--bs-body-bg) !important;
        opacity: 1 !important;

        /* Ensure it sits ON TOP of the event cards */
        z-index: 10 !important;

        /* Add a small shadow to separate it from the content */
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    /* Ensure the Toolbar above it stays on top */
    #calendar .fc-header-toolbar {
        position: sticky;
        top: 0;
        z-index: 20 !important;
        background-color: var(--bs-body-bg);
    }
}

/* --- 4. DARK MODE FIX --- */
[data-bs-theme="dark"] .fc-list-day th {
    background-color: #212529 !important;
    border-bottom-color: #495057;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}


/* ========================================= */
/* CALENDAR EMPTY STATE (NATIVE & CENTERED)  */
/* ========================================= */

/* 1. Target the Table Cell - Force Flexbox Centering */
.fc-list-empty {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 60vh !important;
    background-color: var(--bs-body-bg) !important;
}
.fc-list-empty-cushion {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 3. Style our Custom Content */
.empty-state-content {
    text-align: center;
    animation: fadeIn 0.3s ease-out;
    width: 100%;
}

.empty-state-icon {
    font-size: 3.5rem;
    color: var(--bs-secondary); 
    opacity: 0.5;
    margin-bottom: 1rem;
    display: inline-block;
}

.empty-state-title {
    font-family: var(--bs-heading-font-family);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--bs-secondary-color);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* 4. LOADING STATE: Hide the empty message while spinner is active */
#calendar.is-loading .fc-list-empty {
    display: none !important;
}

#calendar.is-loading .fc-view-harness {
    min-height: 200px; /* Keep space for the spinner */
}

/* 5. Dark Mode Support */
[data-bs-theme="dark"] .fc-list-empty {
    background-color: #212529 !important;
}

/* ========================================= */
/* CUSTOM EVENT CARD LAYOUT                  */
/* ========================================= */

/* 1. Global Hide: Remove default list dots and time columns */
.fc-list-event-graphic,
.fc-list-event-time {
    display: none !important;
}

/* 2. Custom Time Styling (Stand Out) */
.event-custom-time {
    font-family: var(--bs-body-font-family);
    font-size: 1.1rem;       /* Larger than body text */
    font-weight: 700;        /* Bold */
    color: var(--bs-primary); /* Brand Blue/Slate */
    margin-top: 4px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

/* 3. Event Type Badge (Top Right) */
.event-type-badge {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.35em 0.8em;
    border-radius: 50rem; /* Pill shape */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--bs-body-bg); /* White/Dark bg */
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    gap: 6px; /* Space between icon and text */
    margin-left: 6px;
    flex-shrink: 0; /* Prevent badge from squishing */
}

/* Dark Mode Tweaks */
[data-bs-theme="dark"] .event-type-badge {
    background-color: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}
.modal-location-header {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between Name and Badge */
    flex-wrap: wrap;
}
#printEventDetailButton {
    display: none !important;
}

/* ========================================= */
/* CALENDAR DATE HEADER STYLING              */
/* ========================================= */

/* 1. Default State: Use Slate Blue (Professional & Readable) */
.fc-list-day-text,
.fc-list-day-side-text {
    color: var(--bs-primary) !important; 
    font-family: var(--bs-heading-font-family); /* Playfair Display */
    font-weight: 700;
    text-decoration: none !important; /* Remove underline */
}

/* 2. Hover State: Use Brand Orange (Interactive feel) */
/* When hovering anywhere on the gray date bar, change text to orange */
.fc-list-day-cushion:hover .fc-list-day-text,
.fc-list-day-cushion:hover .fc-list-day-side-text {
    color: var(--bs-primary) !important; /* #EE6C4D */
    transition: color 0.2s ease-in-out;
}

/* 3. Dark Mode Adjustments */
[data-bs-theme="dark"] .fc-list-day-text,
[data-bs-theme="dark"] .fc-list-day-side-text {
    color: var(--bs-primary) !important; 
}

[data-bs-theme="dark"] .fc-list-day-cushion:hover .fc-list-day-text,
[data-bs-theme="dark"] .fc-list-day-cushion:hover .fc-list-day-side-text {
    color: #fabeb0 !important; /* Light Peach on hover */
}

/* ========================================= */
/* QUICK NAV & FLOATING ACTION GROUP         */
/* ========================================= */

/* --- 1. The Container (Holds both buttons) --- */
.floating-action-group {
    position: fixed;
    bottom: 85px; /* Default: Above mobile nav */
    right: 15px;
    z-index: 1030;
    display: flex;
    flex-direction: column-reverse; /* Stack bottom-up */
    gap: 15px; /* Space between buttons */
    align-items: center;
    pointer-events: none; /* Allow clicks through the empty space */
}

/* AUTOMATIC LIFT: If Search Bar (.floating-controls) exists, move buttons up */
.floating-controls ~ .floating-action-group {
    /* 65px (Nav) + 60px (Search) + 20px (Gap) */
    bottom: 150px !important; 
}

/* --- 2. Common Button Styles --- */
.fab-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.3s, visibility 0.3s;
    color: white;
    cursor: pointer;
    margin: 0 !important;
    pointer-events: auto; /* Re-enable clicks */
    position: relative;   /* Ensure it stays in flow, NOT fixed */
}

.fab-btn:hover {
    transform: scale(1.1);
    color: white;
}

/* --- 3. Scroll To Top Button --- */
#scrollToTopBtn {
    background-color: var(--bs-primary);
    opacity: 0;
    visibility: hidden;
    display: none; 
}

#scrollToTopBtn.show {
    opacity: 1;
    visibility: visible;
    display: flex;
}

/* --- 4. Quick Nav Button --- */
#quickNavBtn {
    background-color: var(--bs-secondary);
    display: none; /* JS toggles this to 'flex' */
}

#quickNavBtn:hover {
    background-color: var(--bs-primary);
}

/* --- 5. The Jump Menu (Pill Grid) --- */
.jump-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 10px !important;
}

.jump-item {
    border-radius: 50rem !important;
    padding: 8px 20px !important;
    min-width: 50px !important;
    text-align: center !important;
    background-color: var(--bs-body-bg) !important; 
    border: 1px solid var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
    
    /* Flex alignment for text */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    user-select: none;
}

.jump-item:hover {
    background-color: var(--bs-primary) !important;
    color: white !important;
    border-color: var(--bs-primary) !important;
    transform: translateY(-2px);
}

.jump-item.disabled {
    opacity: 0.3 !important;
    pointer-events: none !important;
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* Dark Mode Support */
[data-bs-theme="dark"] .jump-item {
    background-color: #2b3035 !important;
    border-color: #495057 !important;
    color: #e9ecef !important;
}

/* --- 6. Desktop Adjustments --- */
@media (min-width: 992px) {
    .floating-action-group {
        bottom: 40px; 
        right: 30px;
    }
    
    /* On desktop, search isn't floating at bottom, so reset override */
    .floating-controls ~ .floating-action-group {
        bottom: 40px !important; 
    }
}
/* ========================================= */
/* MAP: USER LOCATION PULSE                  */
/* ========================================= */

.user-location-dot {
    width: 18px;
    height: 18px;
    background-color: #4285F4; /* "Google Blue" */
    border: 3px solid #ffffff;
    border-radius: 50%;
    /* The pulse animation */
    animation: location-pulse 2s infinite;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes location-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
    }
    70% {
        /* Expand the shadow ring and fade it out */
        box-shadow: 0 0 0 20px rgba(66, 133, 244, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
    }
}
/* ========================================= */
/* CUSTOM MAP MARKERS & CLUSTERS             */
/* ========================================= */

/* 1. The Pin Shape (Teardrop) */
.custom-map-pin {
    background-color: var(--bs-primary); /* Terracotta */
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0; /* Creates the teardrop point */
    transform: rotate(-45deg);    /* Tilts it to point down */
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    border: 2px solid white;
    transition: transform 0.2s ease, background-color 0.2s;
}

/* 2. The Content Wrapper (Counter-Rotate to be Upright) */
.custom-map-pin .pin-content {
    transform: rotate(45deg); /* KEY FIX: Rotates back to 0deg (Vertical) */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* 3. The Icon Inside */
.custom-map-pin svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* 4. Hover Effect */
.custom-map-pin:hover {
    transform: rotate(-45deg) scale(1.1); /* Keep angle, just grow */
    background-color: var(--bs-primary-text-emphasis);
    z-index: 1000 !important;
}

/* 5. Custom Clusters (Slate Blue) */
.marker-cluster-custom {
    background-color: rgba(61, 90, 128, 0.2); 
    border-radius: 50%;
}

.marker-cluster-custom div {
    width: 36px;
    height: 36px;
    margin: 4px;
    background-color: var(--bs-secondary); 
    color: white;
    text-align: center;
    border-radius: 50%;
    font-family: var(--bs-body-font-family);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.user-location-dot {
    z-index: 400 !important;
}
/* ========================================= */
/* SMART TOOLTIPS & ZOOM                     */
/* ========================================= */

/* 1. The Zoom Frame */
.zoom-frame {
    width: 100%;
    height: 60vh;
    overflow: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background-color: var(--bs-tertiary-bg);
    position: relative;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    cursor: grab;
}

.zoom-frame:active {
    cursor: grabbing;
}

/* 2. The Image Container */
.image-container {
    width: 100%; 
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: block !important; 
    margin: 0 auto;
    position: relative;
    /* Headroom to prevent tooltip clipping */
    margin-top: 80px; 
    margin-bottom: 80px;
    pointer-events: auto; 
}

/* 3. The Hotspot */
.face-hotspot {
    position: absolute;
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.0); 
    transition: background-color 0.2s;
}

/* 4. The Smart Tooltip (Div) */
.hotspot-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%); /* Centered by default */
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    opacity: 0;
    animation: tooltip-pop 0.2s forwards;
    /* Important: The JS will overwrite 'transform' to handle counter-scaling */
}

/* Modifier classes for edge detection */
.hotspot-tooltip.align-left {
    left: 0;
    transform: translateX(0);
}
.hotspot-tooltip.align-right {
    left: auto;
    right: 0;
    transform: translateX(0);
}

@keyframes tooltip-pop {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 5. Zoom Controls */
.zoom-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    background: var(--bs-body-bg);
    padding: 8px;
    border-radius: 50rem;
    border: 1px solid var(--bs-border-color);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background-color: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* --- Modern Church Card Image Styles --- */
.church-card-img-wrapper {
    height: 150px;
    width: 100%;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    background-color: var(--bs-secondary-bg);
    flex-shrink: 0;
}

.church-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.4s ease, transform 0.5s ease;
}

.church-card:hover .church-card-img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

[data-bs-theme="dark"] .church-card-img {
    filter: grayscale(100%) brightness(0.8);
}
[data-bs-theme="dark"] .church-card:hover .church-card-img {
    filter: grayscale(0%) brightness(1);
}