/* ============================================================
   Ministry App — Worship Theme
   A rich, contemporary church-friendly design
   ============================================================ */

/* --- Color Palette --- */
:root {
    /* Primary: deep sacred navy / indigo */
    --m-primary: #1B2A4A;
    --m-primary-light: #2D4373;
    --m-primary-dark: #0F1B33;

    /* Accent: warm liturgical gold */
    --m-gold: #C9A84C;
    --m-gold-light: #E2C97E;
    --m-gold-dark: #A68A2E;

    /* Warm neutrals */
    --m-cream: #FAF7F2;
    --m-sand: #F0EBE3;
    --m-stone: #D5CFC5;

    /* Spiritual accent — soft wine / communion */
    --m-wine: #7B2D3B;
    --m-wine-light: #A34455;

    /* Text */
    --m-text: #2E2E2E;
    --m-text-muted: #6B6B6B;
    --m-text-light: #9A9A9A;

    /* Functional */
    --m-success: #3D8B5E;
    --m-danger: #C0392B;
    --m-warning: #D4A017;
    --m-info: #2980B9;

    /* Typography */
    --m-font-heading: 'Playfair Display', Georgia, serif;
    --m-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing & Radius */
    --m-radius: 12px;
    --m-radius-lg: 20px;
    --m-radius-sm: 8px;
    --m-shadow: 0 2px 12px rgba(27, 42, 74, 0.08);
    --m-shadow-lg: 0 8px 32px rgba(27, 42, 74, 0.12);
    --m-shadow-hover: 0 12px 40px rgba(27, 42, 74, 0.18);

    /* Gradients */
    --m-gradient-nav: linear-gradient(135deg, var(--m-primary-dark) 0%, var(--m-primary) 50%, var(--m-primary-light) 100%);
    --m-gradient-hero: linear-gradient(160deg, var(--m-primary-dark) 0%, var(--m-primary) 40%, var(--m-wine) 100%);
    --m-gradient-gold: linear-gradient(135deg, var(--m-gold-dark) 0%, var(--m-gold) 50%, var(--m-gold-light) 100%);
    --m-gradient-card: linear-gradient(180deg, #ffffff 0%, var(--m-cream) 100%);
}

/* --- Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--m-font-body);
    color: var(--m-text);
    background-color: var(--m-cream);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--m-font-heading);
    color: var(--m-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1, .h1 { font-weight: 700; }

a {
    color: var(--m-primary-light);
    text-decoration: none;
    transition: color 0.25s ease;
}

a:hover {
    color: var(--m-gold-dark);
}

::selection {
    background: var(--m-gold-light);
    color: var(--m-primary-dark);
}

/* --- Navbar --- */
.ministry-navbar {
    background: var(--m-gradient-nav) !important;
    border-bottom: 3px solid var(--m-gold);
    padding: 0.6rem 0;
    z-index: 1050;
    position: relative;
    box-shadow: 0 4px 20px rgba(15, 27, 51, 0.25);
    backdrop-filter: blur(10px);
}

.ministry-navbar .navbar-brand {
    font-family: var(--m-font-heading);
    font-weight: 700;
    font-size: 1.35rem;
    color: #fff !important;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ministry-navbar .navbar-brand .brand-icon-inline {
    font-size: 1.3rem;
    color: var(--m-gold);
}

.ministry-navbar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.85rem !important;
    border-radius: var(--m-radius-sm);
    transition: all 0.25s ease;
    position: relative;
}

.ministry-navbar .nav-link:hover,
.ministry-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
}

.ministry-navbar .nav-link i {
    font-size: 1rem;
    margin-right: 0.25rem;
    opacity: 0.8;
}

.ministry-navbar .dropdown-menu {
    background: #fff;
    border: 1px solid var(--m-sand);
    border-radius: var(--m-radius);
    box-shadow: var(--m-shadow-lg);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.ministry-navbar .dropdown-item {
    border-radius: var(--m-radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.ministry-navbar .dropdown-item:hover {
    background: var(--m-cream);
    color: var(--m-primary);
}

.ministry-navbar .dropdown-divider {
    border-color: var(--m-sand);
    margin: 0.25rem 0;
}

/* --- Main Content --- */
main {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* --- Footer --- */
.ministry-footer {
    background: var(--m-gradient-nav) !important;
    border-top: 3px solid var(--m-gold);
    color: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 0;
}

.ministry-footer a {
    color: var(--m-gold-light);
}

.ministry-footer a:hover {
    color: var(--m-gold);
}

/* --- Cards --- */
.card {
    border: 1px solid rgba(213, 207, 197, 0.5);
    border-radius: var(--m-radius);
    box-shadow: var(--m-shadow);
    background: var(--m-gradient-card);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--m-shadow-hover);
    transform: translateY(-4px);
}

.card-header {
    background: var(--m-cream);
    border-bottom: 1px solid var(--m-sand);
    font-family: var(--m-font-heading);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* --- Dashboard Cards --- */
.dashboard-card {
    position: relative;
    border: none;
    border-radius: var(--m-radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--m-shadow);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--m-gradient-gold);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.dashboard-card:hover {
    box-shadow: var(--m-shadow-hover);
    transform: translateY(-6px);
}

.dashboard-card:hover::before {
    opacity: 1;
}

.dashboard-card .card-body {
    padding: 2rem 1.5rem;
}

.dashboard-card .card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    transition: all 0.35s ease;
}

.dashboard-card:hover .card-icon {
    transform: scale(1.1);
}

/* Icon color variants */
.icon-navy    { background: rgba(27, 42, 74, 0.1);  color: var(--m-primary); }
.icon-gold    { background: rgba(201, 168, 76, 0.15); color: var(--m-gold-dark); }
.icon-wine    { background: rgba(123, 45, 59, 0.1);  color: var(--m-wine); }
.icon-sage    { background: rgba(61, 139, 94, 0.1);  color: var(--m-success); }
.icon-sky     { background: rgba(41, 128, 185, 0.1); color: var(--m-info); }

.dashboard-card .card-title {
    font-family: var(--m-font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--m-primary);
    margin-bottom: 0.35rem;
}

.dashboard-card .card-text {
    font-size: 0.825rem;
    color: var(--m-text-muted);
    line-height: 1.5;
}

/* --- Buttons --- */
.btn {
    font-weight: 500;
    border-radius: var(--m-radius-sm);
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--m-primary);
    border-color: var(--m-primary);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--m-primary-light);
    border-color: var(--m-primary-light);
    box-shadow: 0 4px 15px rgba(27, 42, 74, 0.3);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--m-primary);
    border-color: var(--m-primary);
}

.btn-outline-primary:hover {
    background: var(--m-primary);
    border-color: var(--m-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(27, 42, 74, 0.3);
}

.btn-accent {
    background: var(--m-gradient-gold);
    border: none;
    color: var(--m-primary-dark);
    font-weight: 600;
}

.btn-accent:hover {
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.4);
    transform: translateY(-1px);
    color: var(--m-primary-dark);
}

.btn-outline-secondary {
    border-color: var(--m-stone);
    color: var(--m-text-muted);
}

.btn-outline-secondary:hover {
    background: var(--m-sand);
    border-color: var(--m-stone);
    color: var(--m-text);
}

.btn-danger {
    background: var(--m-danger);
    border-color: var(--m-danger);
}

.btn-success {
    background: var(--m-success);
    border-color: var(--m-success);
}

.btn-lg {
    padding: 0.7rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--m-radius);
}

/* --- Forms --- */
.form-control, .form-select {
    border: 1.5px solid var(--m-stone);
    border-radius: var(--m-radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    background-color: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--m-gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
    background-color: #fff;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--m-primary);
    margin-bottom: 0.35rem;
}

.form-check-input:checked {
    background-color: var(--m-primary);
    border-color: var(--m-primary);
}

/* --- Flash / Alert Messages --- */
.ministry-alert {
    border: none;
    border-radius: var(--m-radius);
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid transparent;
    animation: slideDown 0.4s ease-out;
}

.ministry-alert.alert-success {
    background: rgba(61, 139, 94, 0.1);
    color: #2D6B47;
    border-left-color: var(--m-success);
}

.ministry-alert.alert-danger {
    background: rgba(192, 57, 43, 0.1);
    color: #8B2920;
    border-left-color: var(--m-danger);
}

.ministry-alert.alert-warning {
    background: rgba(212, 160, 23, 0.1);
    color: #8B6914;
    border-left-color: var(--m-warning);
}

.ministry-alert.alert-info {
    background: rgba(41, 128, 185, 0.1);
    color: #1A5276;
    border-left-color: var(--m-info);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Tables --- */
.table {
    font-size: 0.9rem;
}

.table thead th {
    background: var(--m-cream);
    color: var(--m-primary);
    font-family: var(--m-font-heading);
    font-weight: 600;
    font-size: 0.825rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--m-gold);
    padding: 0.75rem;
}

.table tbody td {
    padding: 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--m-sand);
}

.table tbody tr {
    transition: background 0.2s ease;
}

.table tbody tr:hover {
    background: rgba(201, 168, 76, 0.05);
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1.5px solid var(--m-stone) !important;
    border-radius: var(--m-radius-sm) !important;
    padding: 0.4rem 0.75rem !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--m-gold) !important;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2) !important;
}

.dataTables_wrapper .dataTables_length select {
    border: 1.5px solid var(--m-stone) !important;
    border-radius: var(--m-radius-sm) !important;
}

.page-item.active .page-link {
    background-color: var(--m-primary);
    border-color: var(--m-primary);
}

.page-link {
    color: var(--m-primary);
}

/* --- Badges --- */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.75em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* --- Auth Pages --- */
.auth-wrapper {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.auth-card {
    border: none;
    border-radius: var(--m-radius-lg);
    box-shadow: var(--m-shadow-lg);
    overflow: hidden;
    background: #fff;
    max-width: 440px;
    width: 100%;
}

.auth-card .auth-header {
    background: var(--m-gradient-hero);
    padding: 2rem;
    text-align: center;
    color: #fff;
}

.auth-card .auth-header h2 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-card .auth-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin: 0;
}

.auth-card .auth-header .auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    backdrop-filter: blur(10px);
}

.auth-card .card-body {
    padding: 2rem;
}

/* --- Hero / Home Page --- */
.hero-section {
    background: var(--m-gradient-hero);
    padding: 6rem 0;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(201, 168, 76, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.hero-section h1 {
    color: #fff;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
}

.hero-section .lead {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    position: relative;
}

.hero-section .hero-cross {
    font-size: 2.5rem;
    color: var(--m-gold);
    margin-bottom: 1rem;
    display: block;
}

.hero-section .btn-accent {
    font-size: 1.05rem;
    padding: 0.75rem 2rem;
}

.hero-section .btn-outline-light {
    border-width: 2px;
    font-weight: 500;
    padding: 0.75rem 2rem;
}

.hero-section .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
}

/* --- Dashboard Welcome --- */
.dashboard-welcome {
    background: var(--m-gradient-hero);
    border-radius: var(--m-radius-lg);
    padding: 1.25rem 1.75rem;
    margin-bottom: 1.5rem;
    position: relative;
    box-shadow: var(--m-shadow);
    overflow: hidden;
}

.dashboard-welcome::after {
    content: '\2728';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.08;
    color: var(--m-gold);
}

.dashboard-welcome h1 {
    color: #fff;
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.dashboard-welcome p {
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
    font-size: 0.875rem;
}

/* --- Page Headers --- */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--m-sand);
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

/* --- Scroll animations --- */
.animate-in {
    opacity: 0;
    transform: translateY(20px);
}

.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* Stagger children */
.stagger-children .animate-in:nth-child(1)  { transition-delay: 0.05s; }
.stagger-children .animate-in:nth-child(2)  { transition-delay: 0.10s; }
.stagger-children .animate-in:nth-child(3)  { transition-delay: 0.15s; }
.stagger-children .animate-in:nth-child(4)  { transition-delay: 0.20s; }
.stagger-children .animate-in:nth-child(5)  { transition-delay: 0.25s; }
.stagger-children .animate-in:nth-child(6)  { transition-delay: 0.30s; }
.stagger-children .animate-in:nth-child(7)  { transition-delay: 0.35s; }
.stagger-children .animate-in:nth-child(8)  { transition-delay: 0.40s; }
.stagger-children .animate-in:nth-child(9)  { transition-delay: 0.45s; }
.stagger-children .animate-in:nth-child(10) { transition-delay: 0.50s; }
.stagger-children .animate-in:nth-child(11) { transition-delay: 0.55s; }
.stagger-children .animate-in:nth-child(12) { transition-delay: 0.60s; }

/* --- Utility --- */
.text-gold { color: var(--m-gold) !important; }
.text-wine { color: var(--m-wine) !important; }
.bg-cream  { background-color: var(--m-cream) !important; }
.bg-sand   { background-color: var(--m-sand) !important; }
.divider-gold {
    height: 3px;
    width: 60px;
    background: var(--m-gradient-gold);
    border: none;
    border-radius: 2px;
}

/* --- Verse of the Day card --- */
.votd-card {
    background: var(--m-gradient-hero) !important;
    color: #fff !important;
    border: none !important;
}

.votd-card .card-body,
.votd-card h6,
.votd-card blockquote,
.votd-card cite {
    color: #fff !important;
}

/* --- Bible styles --- */
.bible-book-link {
    color: var(--m-text);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}
.bible-book-link:hover {
    background: var(--m-cream);
    border-color: var(--m-gold);
    color: var(--m-primary);
}
.bible-chapter-btn {
    font-weight: 600;
    transition: all 0.2s ease;
}
.bible-chapter-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--m-shadow-sm);
}
.bible-text {
    font-family: var(--m-font-heading), Georgia, serif;
    color: var(--m-text);
}
.bible-verse {
    display: inline;
}
.bible-verse-num {
    font-family: var(--m-font-body);
    font-weight: 700;
    color: var(--m-gold);
    font-size: 0.75em;
    margin-right: 2px;
    cursor: default;
}
.bible-verse:target {
    background: rgba(201, 168, 76, 0.15);
    border-radius: 3px;
    padding: 2px 4px;
}

/* --- Scripture hover popover --- */
.scripture-hover {
    position: relative;
    transition: all 0.2s ease;
}
.scripture-hover:hover {
    background-color: var(--m-cream) !important;
    border-color: var(--m-gold) !important;
    transform: translateY(-1px);
}
.scripture-popover {
    position: fixed;
    width: 400px;
    max-width: 90vw;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border: 1px solid var(--m-gold);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 14px 16px;
    z-index: 1060;
    font-size: 0.9rem;
    line-height: 1.7;
    font-family: Georgia, serif;
    color: var(--m-text);
    pointer-events: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.scripture-popover::after {
    display: none;
}
.scripture-popover-title {
    font-family: var(--m-font-body);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--m-primary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.scripture-popover-verse-num {
    font-family: var(--m-font-body);
    font-weight: 700;
    color: var(--m-gold);
    font-size: 0.75em;
    margin-right: 2px;
}
.scripture-popover-loading {
    text-align: center;
    color: var(--m-muted);
    padding: 8px 0;
}
.scripture-popover-error {
    text-align: center;
    color: var(--m-danger, #dc3545);
    font-style: italic;
    font-size: 0.85rem;
}
.scripture-popover-link {
    display: block;
    text-align: right;
    font-family: var(--m-font-body);
    font-size: 0.75rem;
    margin-top: 8px;
    color: var(--m-primary);
    text-decoration: none;
}
.scripture-popover-link:hover {
    text-decoration: underline;
}

/* --- Auth card transition (for JS animation) --- */
.auth-card {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* --- Form focus parent highlight --- */
.focused {
    transition: all 0.25s ease;
}

/* --- Scripture Accordion --- */
#scriptureAccordion .accordion-item {
    border-radius: var(--m-radius-sm);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

#scriptureAccordion .accordion-button {
    font-family: var(--m-font-body);
    font-size: 1rem;
    padding: 0.85rem 1.25rem;
    background: var(--m-cream);
    color: var(--m-text);
    box-shadow: none;
}

#scriptureAccordion .accordion-button:not(.collapsed) {
    background: var(--m-primary);
    color: #fff;
}

#scriptureAccordion .accordion-button:not(.collapsed) .text-primary {
    color: var(--m-gold-light) !important;
}

#scriptureAccordion .accordion-button::after {
    filter: none;
}

#scriptureAccordion .accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

#scriptureAccordion .accordion-body {
    padding: 1.25rem 1.5rem;
    background: #fff;
    font-size: 1.05rem;
    color: var(--m-text);
}

#scriptureAccordion .accordion-body blockquote {
    border-left: 3px solid var(--m-gold);
    padding-left: 1rem;
    color: var(--m-text);
}

/* --- Identity Page --- */
.id-hero {
    background: var(--m-gradient-hero);
    position: relative;
    overflow: hidden;
    padding: 5rem 0 4rem;
    color: #fff;
}

.id-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(201, 168, 76, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 70%, rgba(123, 45, 59, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.id-hero-cross {
    font-size: 2.5rem;
    color: var(--m-gold);
    display: block;
    margin-bottom: 1rem;
}

.id-hero-title {
    font-family: var(--m-font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}

.id-hero-accent {
    background: var(--m-gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.id-hero-subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.8;
    max-width: 620px;
}

.id-hero-verse {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    margin-top: 1rem;
}

.id-hero-verse cite {
    color: var(--m-gold-light);
    font-style: normal;
    font-weight: 600;
}

/* Segments */
.id-segments {
    padding: 5rem 0 2rem;
    background: var(--m-cream);
}

.id-segment-row {
    padding-top: 1rem;
}

.id-segment-visual {
    position: relative;
    display: inline-block;
    width: 280px;
    height: 280px;
    border-radius: var(--m-radius);
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(15, 27, 51, 0.2);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.id-segment-visual:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 50px rgba(15, 27, 51, 0.3);
}

.id-segment-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.id-segment-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--m-gradient-hero);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--m-gold);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.id-segment-badge.badge-warm {
    background: linear-gradient(135deg, #5b2c3f 0%, #7b2d3b 100%);
    color: #f0c987;
}

.id-segment-badge.badge-deep {
    background: linear-gradient(135deg, #1a3a5c 0%, #2c3e50 100%);
    color: #a8d8ea;
}

.id-segment-badge.badge-golden {
    background: linear-gradient(135deg, #6b4f1d 0%, #c9a84c 100%);
    color: #fff;
}

.id-segment-badge.badge-spirit {
    background: linear-gradient(135deg, #2d1b4e 0%, #4a2d6b 100%);
    color: #d4a8ff;
}

.id-segment-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--m-gold);
    background: rgba(201, 168, 76, 0.1);
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 0.75rem;
}

.id-segment-title {
    font-family: var(--m-font-heading);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--m-primary-dark);
    margin-bottom: 1rem;
    line-height: 1.25;
}

.id-segment-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--m-text);
    margin-bottom: 1.25rem;
}

.id-segment-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.id-segment-features li {
    padding: 0.35rem 0;
    font-size: 0.95rem;
    color: var(--m-text);
}

.id-segment-features li i {
    color: var(--m-gold);
    margin-right: 0.5rem;
}

.id-segment-quote {
    border-left: 3px solid var(--m-gold);
    padding: 0.75rem 1.25rem;
    margin: 0;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--m-text-muted);
    background: rgba(201, 168, 76, 0.04);
    border-radius: 0 var(--m-radius-sm) var(--m-radius-sm) 0;
    line-height: 1.7;
}

.id-segment-quote cite {
    display: block;
    margin-top: 0.5rem;
    font-style: normal;
    font-weight: 600;
    color: var(--m-gold);
    font-size: 0.85rem;
}

.id-divider {
    border: none;
    border-top: 1px solid var(--m-sand);
    margin: 0 0 2.5rem 0;
    opacity: 0.5;
}

/* CTA */
.id-cta {
    background: var(--m-gradient-hero);
    position: relative;
    overflow: hidden;
    padding: 5rem 0;
    color: #fff;
}

.id-cta-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(201, 168, 76, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.id-cta-cross {
    font-size: 2.5rem;
    color: var(--m-gold);
    display: block;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.id-cta-title {
    font-family: var(--m-font-heading);
    font-size: 2.4rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.id-cta-body {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.8;
    max-width: 600px;
}

.id-cta-footer {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    margin-top: 2rem;
}

.id-cta-footer cite {
    color: var(--m-gold-light);
    font-style: normal;
    font-weight: 600;
}

/* --- Landing Page --- */
.min-vh-75 { min-height: 75vh; }

.landing-hero {
    background: var(--m-gradient-hero);
    position: relative;
    overflow: hidden;
    padding: 5rem 0 6rem;
    color: #fff;
}

.landing-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 40%, rgba(201, 168, 76, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 70%, rgba(123, 45, 59, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.landing-hero-title {
    font-family: var(--m-font-heading);
    font-size: 3.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}

.landing-hero-accent {
    background: var(--m-gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero-subtitle {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.7;
    max-width: 520px;
}

.landing-hero .hero-cross {
    font-size: 2.5rem;
    color: var(--m-gold);
    display: block;
    margin-bottom: 1rem;
}

/* Decorative orbs */
.landing-hero-visual {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.5;
    animation: orbFloat 8s ease-in-out infinite;
}

.landing-orb-1 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.3), transparent 70%);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.landing-orb-2 {
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(123, 45, 59, 0.25), transparent 70%);
    bottom: 5%;
    right: 5%;
    animation-delay: -3s;
}

.landing-orb-3 {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(45, 67, 115, 0.3), transparent 70%);
    top: 50%;
    right: 25%;
    animation-delay: -5s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(12px, -18px) scale(1.05); }
    66%      { transform: translate(-8px, 10px) scale(0.95); }
}

.landing-hero-icon {
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 1;
}

/* Features section */
.landing-features {
    padding: 5rem 0;
    background: var(--m-cream);
}

.landing-section-title {
    font-family: var(--m-font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--m-primary);
    margin-bottom: 0.5rem;
}

.landing-section-subtitle {
    font-size: 1.05rem;
    color: var(--m-text-muted);
    max-width: 560px;
    margin: 0 auto;
}

.landing-feature-card {
    background: #fff;
    border: 1px solid rgba(213, 207, 197, 0.5);
    border-radius: var(--m-radius-lg);
    padding: 2rem 1.75rem;
    height: 100%;
    text-align: center;
    box-shadow: var(--m-shadow);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.landing-feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--m-shadow-hover);
}

.landing-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
}

.landing-feature-card h5 {
    font-family: var(--m-font-heading);
    font-weight: 600;
    color: var(--m-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.landing-feature-card p {
    color: var(--m-text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* Scripture banner */
.landing-scripture {
    padding: 4rem 0;
    background: var(--m-gradient-hero);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.landing-scripture::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(201, 168, 76, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.landing-verse {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    border: none;
    padding: 0;
}

.landing-quote-icon {
    font-size: 3rem;
    color: var(--m-gold);
    opacity: 0.5;
    display: block;
    margin-bottom: 0.75rem;
}

.landing-verse p {
    font-family: var(--m-font-heading);
    font-size: 1.35rem;
    font-style: italic;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.landing-verse cite {
    font-family: var(--m-font-body);
    font-style: normal;
    font-size: 0.95rem;
    color: var(--m-gold-light);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* CTA section */
.landing-cta {
    padding: 5rem 0;
    background: var(--m-cream);
}

.landing-cta-title {
    font-family: var(--m-font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--m-primary);
    margin-bottom: 0.5rem;
}

.landing-cta-subtitle {
    font-size: 1.1rem;
    color: var(--m-text-muted);
}

.landing-cta .btn-accent {
    font-size: 1.05rem;
}

.landing-cta .btn-outline-light {
    color: var(--m-primary);
    border-color: var(--m-primary);
}

.landing-cta .btn-outline-light:hover {
    background: var(--m-primary);
    color: #fff;
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
    .ministry-navbar .navbar-collapse {
        background: var(--m-primary-dark);
        border-radius: var(--m-radius);
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .hero-section {
        padding: 4rem 0;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .dashboard-welcome {
        padding: 1rem 1.25rem;
    }

    .dashboard-welcome::after {
        display: none;
    }

    .landing-hero {
        padding: 3.5rem 0 4rem;
    }

    .landing-hero-title {
        font-size: 2.4rem;
    }

    .landing-hero-subtitle {
        margin: 0 auto;
    }

    .landing-features {
        padding: 3.5rem 0;
    }

    .landing-scripture {
        padding: 3rem 0;
    }

    .landing-cta {
        padding: 3.5rem 0;
    }

    .id-hero {
        padding: 3.5rem 0 3rem;
    }

    .id-hero-title {
        font-size: 2.4rem;
    }

    .id-segments {
        padding: 3.5rem 0 1rem;
    }

    .id-segment-visual {
        width: 220px;
        height: 220px;
        margin-bottom: 1.5rem;
    }

    .id-segment-title {
        font-size: 1.6rem;
    }

    .id-cta {
        padding: 3.5rem 0;
    }

    .id-cta-title {
        font-size: 2rem;
    }
}

@media (max-width: 575.98px) {
    .dashboard-card .card-body {
        padding: 1.5rem 1rem;
    }

    .dashboard-card .card-icon {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }

    .landing-hero-title {
        font-size: 2rem;
    }

    .landing-hero-subtitle {
        font-size: 1rem;
    }

    .landing-verse p {
        font-size: 1.1rem;
    }

    .landing-section-title {
        font-size: 1.6rem;
    }

    .landing-cta-title {
        font-size: 1.6rem;
    }

    .id-hero-title {
        font-size: 2rem;
    }

    .id-hero-subtitle {
        font-size: 1rem;
    }

    .id-segment-visual {
        width: 180px;
        height: 180px;
    }

    .id-segment-badge {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .id-segment-title {
        font-size: 1.4rem;
    }

    .id-cta-title {
        font-size: 1.6rem;
    }
}

/* ============================================================
   MOBILE-FIRST ENHANCEMENTS
   Bottom nav, compact layouts, sticky headers
   Only active below the Bootstrap lg breakpoint (< 992px)
   ============================================================ */

/* --- Mobile App Dock (iPhone-style icon bar) --- */
.mobile-dock {
    display: none;
}

@media (max-width: 991.98px) {
    .mobile-dock {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        background: var(--m-primary-dark);
        border-top: 2px solid var(--m-gold);
        padding: 4px 0 max(4px, env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    }

    .mobile-dock-icons {
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        max-width: 400px;
        margin: 0 auto;
        padding: 0 4px;
    }

    .mobile-dock-icon {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        text-decoration: none;
        background: none;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        padding: 0;
    }

    .mobile-dock-bubble {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 1.1rem;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-dock-icon:active .mobile-dock-bubble {
        transform: scale(0.9);
    }

    .mobile-dock-icon.active .mobile-dock-bubble {
        box-shadow: 0 0 0 2px var(--m-gold), 0 2px 8px rgba(201, 168, 76, 0.3);
    }

    .mobile-dock-label {
        font-size: 0.55rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.6);
        letter-spacing: 0.01em;
        line-height: 1;
    }

    .mobile-dock-icon.active .mobile-dock-label {
        color: var(--m-gold);
    }

    /* Push content above the dock */
    body {
        padding-bottom: 68px;
    }

    /* Footer spacing */
    .ministry-footer {
        margin-bottom: 60px;
    }

    /* Compact top navbar */
    .ministry-navbar {
        padding: 0.4rem 0;
    }
}

/* --- Mobile "More" Drawer (icon grid) --- */
.mobile-more-drawer {
    display: none;
    position: fixed;
    bottom: 72px;
    left: 0;
    right: 0;
    z-index: 1039;
    background: var(--m-primary-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--m-radius-lg) var(--m-radius-lg) 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 55vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-more-drawer.open {
    transform: translateY(0);
}

@media (max-width: 991.98px) {
    .mobile-more-drawer {
        display: block;
    }
}

.mobile-more-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0.5rem;
    color: #fff;
    font-size: 1rem;
}

/* Icon grid inside the drawer */
.mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 0;
    padding: 0.5rem 1rem 1.25rem;
}

.mobile-grid-section {
    grid-column: 1 / -1;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    padding: 10px 4px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-grid-section:first-child {
    border-top: none;
    padding-top: 4px;
}

.mobile-grid-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px;
    text-decoration: none;
    border-radius: var(--m-radius-sm);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-grid-icon:active {
    background: rgba(255, 255, 255, 0.06);
}

.mobile-grid-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    font-size: 1.3rem;
    transition: transform 0.2s ease;
}

.mobile-grid-icon:active .mobile-grid-bubble {
    transform: scale(0.9);
}

.mobile-grid-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.01em;
}

/* Backdrop behind the drawer */
.mobile-more-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    bottom: 72px;
    z-index: 1038;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-more-backdrop.open {
    opacity: 1;
}

@media (max-width: 991.98px) {
    .mobile-more-backdrop.open {
        display: block;
    }
}

/* --- Compact Mobile: Dashboard (iPhone-style icon grid) --- */
@media (max-width: 991.98px) {
    .dashboard-welcome {
        padding: 0.875rem 1rem;
        margin-bottom: 1rem;
        border-radius: var(--m-radius);
    }

    .dashboard-welcome h1 {
        font-size: 1.1rem;
    }

    .dashboard-welcome p {
        font-size: 0.8rem;
    }

    /* Convert the Bootstrap row into a CSS icon grid */
    .dashboard-card-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px 8px;
        padding: 0 8px;
    }

    /* Remove Bootstrap column sizing */
    .dashboard-card-grid > [class*="col"] {
        width: 100%;
        max-width: 100%;
        padding: 0;
        flex: none;
    }

    /* Strip the card chrome — become a transparent icon tile */
    .dashboard-card {
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    .dashboard-card::before {
        display: none;
    }

    .dashboard-card:hover {
        transform: none;
        box-shadow: none;
    }

    .dashboard-card .card-body {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 0;
        text-align: center;
    }

    /* Icon bubble — matches dock/grid style */
    .dashboard-card .card-icon {
        width: 50px;
        height: 50px;
        border-radius: 14px;
        font-size: 1.3rem;
        margin-bottom: 0;
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .dashboard-card:active .card-icon {
        transform: scale(0.9);
    }

    .dashboard-card .card-title {
        font-size: 0.65rem;
        font-weight: 600;
        margin-bottom: 0;
        color: var(--m-text);
        line-height: 1.2;
    }

    /* Hide the description text */
    .dashboard-card .card-text {
        display: none;
    }
}

/* 4 columns on slightly wider phones */
@media (min-width: 400px) and (max-width: 991.98px) {
    .dashboard-card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Compact Mobile: Bible --- */
@media (max-width: 991.98px) {
    /* Bible index: tighter book links */
    .bible-book-link {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.85rem;
    }

    .bible-book-link small {
        font-size: 0.7rem;
    }

    /* Bible chapter buttons: smaller */
    .bible-chapter-btn {
        min-width: 42px !important;
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Bible text: tighter line height on mobile */
    .bible-text {
        font-size: 1rem;
        line-height: 1.75;
    }

    /* Translation switcher: wrap nicely */
    .bible-translation-switcher {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.35rem;
    }

    .bible-translation-switcher .btn-group-sm .btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .bible-translation-switcher .bible-set-default-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* --- Compact Mobile: Headings & Flex Headers --- */
@media (max-width: 767.98px) {
    /* Stack flex headers vertically on small screens */
    .d-flex.justify-content-between.align-items-center.mb-3,
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    /* Smaller page headings */
    h1, .h1 {
        font-size: 1.5rem;
    }

    h1 small {
        font-size: 0.55em;
    }

    h3, .h3 {
        font-size: 1.15rem;
    }

    /* Compact cards */
    .card-header {
        padding: 0.7rem 1rem;
    }

    .card-body {
        padding: 0.85rem 1rem;
    }

    /* Tighter container padding */
    main.container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* --- Sticky Context Headers: Bible Chapter & Study --- */
.bible-sticky-header,
.study-sticky-header {
    display: none;
}

@media (max-width: 991.98px) {
    .bible-sticky-header,
    .study-sticky-header {
        display: block;
    }
    /* Bible chapter: sticky breadcrumb-style header */
    .bible-sticky-header {
        position: sticky;
        top: 0;
        z-index: 1020;
        background: var(--m-cream);
        border-bottom: 1px solid var(--m-sand);
        padding: 0.5rem 0;
        margin: -1rem -0.75rem 0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    [data-theme="glass"] .bible-sticky-header {
        background: rgba(13, 13, 26, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }

    /* Study page: sticky section indicator */
    .study-sticky-header {
        position: sticky;
        top: 0;
        z-index: 1020;
        background: var(--m-cream);
        border-bottom: 1px solid var(--m-sand);
        padding: 0.5rem 0;
        margin: -1rem -0.75rem 0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    [data-theme="glass"] .study-sticky-header {
        background: rgba(13, 13, 26, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }
}

/* --- Compact Mobile: Study Show Page --- */
@media (max-width: 767.98px) {
    /* Tighter accordion items */
    #scriptureAccordion .accordion-button {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }

    #scriptureAccordion .accordion-body {
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
    }

    /* Tighter study sections */
    .study-content {
        font-size: 0.95rem;
        line-height: 1.7;
    }
}

/* --- Compact Mobile: Discipleship Track --- */
@media (max-width: 767.98px) {
    #modulesAccordion .accordion-button {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }

    #modulesAccordion .accordion-body {
        padding: 0.85rem 1rem;
    }
}

/* ============================================================
   ADMIN SCREENS — MOBILE RESPONSIVE
   Covers: page headers, tables/DataTables, nav tabs,
   form layouts (main + sidebar), detail/show pages,
   action buttons, and cards.
   Only active below the Bootstrap lg breakpoint (< 992px)
   ============================================================ */

/* --- Admin Page Headers --- */
@media (max-width: 991.98px) {
    /* Stack h1 + action buttons vertically */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 h1 {
        font-size: 1.35rem;
        margin-bottom: 0;
    }

    /* Action buttons row: full width, wrap if needed */
    .d-flex.justify-content-between.align-items-center.mb-4 > .btn,
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex,
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-inline,
    .d-flex.justify-content-between.align-items-center.mb-4 > form {
        width: 100%;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex {
        flex-wrap: wrap;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 > .btn {
        text-align: center;
    }

    /* Member show header: stack the button group too */
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex > .btn,
    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex > form {
        flex: 1;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 > .d-flex > form .btn {
        width: 100%;
    }
}

/* --- Admin Nav Tabs (horizontal scroll) --- */
@media (max-width: 991.98px) {
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        white-space: nowrap;
        border-bottom-width: 2px;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs .nav-item {
        flex-shrink: 0;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
    }
}

/* --- Admin Tables: row-to-card conversion on mobile --- */
@media (max-width: 991.98px) {
    /* Hide table header */
    .table-cards thead {
        display: none;
    }

    /* Each row becomes a card */
    .table-cards tbody tr {
        display: block;
        background: var(--m-white, #fff);
        border: 1px solid var(--m-sand, #e0d8c8);
        border-radius: var(--m-radius, 8px);
        margin-bottom: 0.75rem;
        padding: 0.75rem 1rem;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }

    .table-cards tbody tr:last-child {
        margin-bottom: 0;
    }

    /* Each cell becomes a labeled row */
    .table-cards tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.3rem 0;
        border: none;
        font-size: 0.88rem;
    }

    /* Label from data-label attribute */
    .table-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--m-text-muted, #6c757d);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        flex-shrink: 0;
        margin-right: 0.75rem;
        min-width: 80px;
    }

    /* First cell (title) is the card header — full width, no label */
    .table-cards tbody td:first-child {
        display: block;
        font-size: 1rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0.35rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .table-cards tbody td:first-child::before {
        display: none;
    }

    /* Actions row: right-aligned, no label */
    .table-cards tbody td:last-child {
        justify-content: flex-end;
        padding-top: 0.5rem;
        margin-top: 0.25rem;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .table-cards tbody td:last-child::before {
        display: none;
    }

    /* Action buttons: slightly larger for touch */
    .table-cards .btn-group-sm .btn,
    .table-cards .btn-sm {
        padding: 0.3rem 0.55rem;
        font-size: 0.8rem;
    }

    /* Remove table hover effect (cards handle it) */
    .table-cards.table-hover tbody tr:hover {
        background: var(--m-white, #fff);
    }

    /* DataTables controls: compact and stacked */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 0.5rem;
    }

    .dataTables_wrapper .dataTables_length label,
    .dataTables_wrapper .dataTables_filter label {
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_length select {
        padding: 0.2rem 0.5rem;
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_filter input {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
        width: 100%;
    }

    /* Stack DataTables top controls */
    .dataTables_wrapper .row:first-child {
        flex-direction: column;
        gap: 0.25rem;
    }

    .dataTables_wrapper .row:first-child > div {
        width: 100% !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    /* Compact pagination */
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.55rem !important;
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_info {
        font-size: 0.75rem;
        padding-top: 0.5rem;
    }

    /* Glass theme card rows */
    [data-theme="glass"] .table-cards tbody tr {
        background: rgba(13, 13, 26, 0.6);
        border-color: rgba(255, 255, 255, 0.08);
    }

    [data-theme="glass"] .table-cards tbody td:first-child {
        border-bottom-color: rgba(255, 255, 255, 0.06);
    }

    [data-theme="glass"] .table-cards tbody td:last-child {
        border-top-color: rgba(255, 255, 255, 0.06);
    }
}

/* --- Admin Form Layouts (main + sidebar) --- */
@media (max-width: 991.98px) {
    /* Sidebar stacks below main on mobile — add visual separator */
    .col-lg-4 > .card:first-child {
        margin-top: 0;
    }

    /* Tighter form controls — 16px minimum prevents iOS auto-zoom */
    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px;
        padding: 0.45rem 0.75rem;
    }

    .form-control-lg {
        font-size: 16px;
        padding: 0.55rem 0.85rem;
    }

    .form-label {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }

    /* Compact row gutters in forms */
    .row.g-3 {
        --bs-gutter-y: 0.65rem;
        --bs-gutter-x: 0.65rem;
    }

    .row.g-4 {
        --bs-gutter-y: 0.85rem;
        --bs-gutter-x: 0.85rem;
    }

    /* Scripture/resource rows: stack columns */
    .scripture-row .col-md-4,
    .scripture-row .col-md-7,
    .resource-row .col-md-3,
    .resource-row .col-md-4 {
        margin-bottom: 0.35rem;
    }

    /* Publish buttons: full width on mobile */
    .d-grid.gap-2 .btn {
        font-size: 0.9rem;
        padding: 0.55rem;
    }

    /* Card headers: tighter */
    .card-header h6 {
        font-size: 0.85rem;
    }
}

/* --- Admin Detail/Show Pages --- */
@media (max-width: 991.98px) {
    /* Profile card: tighter */
    .card-body .rounded-circle {
        width: 80px !important;
        height: 80px !important;
    }

    .card-body .display-3 {
        font-size: 2rem !important;
    }

    /* Definition lists: compact */
    dl dt {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
    }

    dl dd {
        font-size: 0.88rem;
        margin-bottom: 0.6rem;
    }

    /* Pastoral notes: compact */
    .border-bottom.pb-3.mb-3 {
        padding-bottom: 0.75rem !important;
        margin-bottom: 0.75rem !important;
    }

    .border-bottom .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.25rem;
    }

    /* Members summary cards: compact numbers */
    .display-6 {
        font-size: 1.5rem;
    }
}

/* --- Admin: Extra-small phone tweaks --- */
@media (max-width: 575.98px) {
    /* Tighter card rows on very small phones */
    .table-cards tbody tr {
        padding: 0.6rem 0.75rem;
    }

    .table-cards tbody td {
        font-size: 0.82rem;
    }

    .table-cards tbody td::before {
        font-size: 0.7rem;
        min-width: 70px;
    }

    /* Tighter card padding */
    .card-body {
        padding: 0.65rem 0.75rem;
    }

    .card-header {
        padding: 0.55rem 0.75rem;
    }
}

/* ============================================================
   MOBILE-OPTIMISED: KellyComposer (ContentEditor)
   Larger touch targets, taller editor, no iOS zoom
   ============================================================ */
@media (max-width: 991.98px) {
    /* Editor body: taller min-height, comfortable font */
    .ce-body {
        min-height: 280px;
        font-size: 16px;
        padding: 12px 14px;
        -webkit-overflow-scrolling: touch;
    }

    /* Toolbar: bigger touch targets */
    .ce-toolbar {
        gap: 2px;
        padding: 6px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ce-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }

    .ce-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Select dropdowns: prevent iOS zoom */
    .ce-select {
        font-size: 16px;
        height: 36px;
        max-width: 120px;
    }

    /* Modal inputs: prevent iOS zoom */
    .ce-input,
    .ce-select-full {
        font-size: 16px;
        padding: 10px 12px;
    }

    /* Modal: nearly full-width on mobile */
    .ce-modal {
        width: 95%;
        min-width: unset;
        max-width: none;
        margin: 0 auto;
    }

    /* Dropzone: bigger tap area */
    .ce-dropzone {
        padding: 28px 16px;
        font-size: 14px;
    }

    /* Brand badge: slightly smaller */
    .ce-brand-icon {
        width: 28px;
        height: 28px;
    }
}

/* ============================================================
   PHONE-COMPACT: Tighter cards, spacing, and layout
   Makes the app feel more native on small screens
   ============================================================ */
@media (max-width: 767.98px) {
    /* Container: less side padding */
    .container {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    /* General cards: tighter */
    .card {
        border-radius: 10px;
    }

    .card-body {
        padding: 0.75rem 0.85rem;
    }

    .card-header {
        padding: 0.6rem 0.85rem;
        font-size: 0.88rem;
    }

    .card-footer {
        padding: 0.5rem 0.85rem;
    }

    /* Card title/text: slightly smaller */
    .card-title {
        font-size: 1rem;
        margin-bottom: 0.35rem;
    }

    .card-text {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    /* Badges: compact */
    .badge {
        font-size: 0.7rem;
        padding: 0.25em 0.55em;
    }

    /* Buttons: comfortable but compact */
    .btn {
        padding: 0.4rem 0.85rem;
        font-size: 0.88rem;
    }

    .btn-sm {
        padding: 0.28rem 0.6rem;
        font-size: 0.78rem;
    }

    .btn-lg {
        padding: 0.55rem 1.1rem;
        font-size: 1rem;
    }

    /* Alerts: compact */
    .alert, .ministry-alert {
        padding: 0.6rem 0.85rem;
        font-size: 0.88rem;
    }

    /* List groups: compact */
    .list-group-item {
        padding: 0.55rem 0.85rem;
        font-size: 0.88rem;
    }

    /* Margins between sections: tighter */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mb-3 {
        margin-bottom: 0.65rem !important;
    }

    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* Page breadcrumb: compact */
    .breadcrumb {
        font-size: 0.8rem;
        padding: 0;
        margin-bottom: 0.5rem;
    }

    /* Blog post cards on mobile */
    .post-content {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    /* Accordion: tighter */
    .accordion-button {
        padding: 0.6rem 0.85rem;
        font-size: 0.9rem;
    }

    .accordion-body {
        padding: 0.75rem 0.85rem;
        font-size: 0.9rem;
    }

    /* Tables (non-card mode): compact */
    .table td, .table th {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    /* Modal: full-width on phone */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 0.85rem;
    }

    .modal-header {
        padding: 0.65rem 0.85rem;
    }

    .modal-footer {
        padding: 0.5rem 0.85rem;
    }

    /* Progress bars: slimmer */
    .progress {
        height: 6px;
    }

    /* Nav pills/tabs: compact */
    .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Form sections spacing */
    .mb-3:has(> .form-label) {
        margin-bottom: 0.6rem !important;
    }

    /* Definition lists: compact */
    dl {
        margin-bottom: 0.5rem;
    }

    /* Images: slight rounding on mobile */
    .img-fluid {
        border-radius: 8px;
    }
}

/* Extra-small phones (iPhone SE, etc.) */
@media (max-width: 375px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-body {
        padding: 0.6rem 0.7rem;
    }

    h1, .h1 {
        font-size: 1.3rem;
    }

    h2, .h2 {
        font-size: 1.15rem;
    }

    h3, .h3 {
        font-size: 1.05rem;
    }

    .btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.82rem;
    }

    /* KellyComposer on tiny phones */
    .ce-body {
        min-height: 240px;
        padding: 10px 12px;
    }

    .ce-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
}
