/* ============================================================
   Altaris CSS — Church Management System
   ============================================================ */

:root {
    --navy:        #0B1120;
    --navy-light:  #1A2744;
    --navy-muted:  #243050;
    --gold:        #F5C842;
    --gold-soft:   #FDE68A;
    --gold-dark:   #D4A017;
    --white:       #FFFFFF;
    --off-white:   #F8F9FC;
    --text-dark:   #1E2A3B;
    --text-muted:  #6B7A99;
    --border:      #E2E8F0;
    --success:     #10B981;
    --danger:      #EF4444;
    --warning:     #F59E0B;
    --info:        #3B82F6;
    --sidebar-w:   260px;
    --topbar-h:    64px;
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.14);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--off-white);
    color: var(--text-dark);
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
}

a { text-decoration: none; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.25s ease;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Brand */
.sidebar-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gold);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--navy);
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--white);
    line-height: 1.2;
}

.brand-church {
    font-size: 11px;
    color: var(--gold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav section labels */
.nav-section {
    padding: 18px 16px 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.30);
}

/* Active nav items */
.nav-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,0.72);
    font-size: 13.5px;
    border-left: 3px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.nav-link-item:hover,
.nav-link-item.active {
    color: var(--gold);
    background: rgba(245,200,66,0.08);
    border-left-color: var(--gold);
}

.nav-link-item i {
    font-size: 16px;
    width: 20px;
    flex-shrink: 0;
}

/* Locked nav items */
.nav-link-locked {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: rgba(255,255,255,0.28);
    font-size: 13.5px;
    border-left: 3px solid transparent;
    cursor: not-allowed;
    user-select: none;
}

.nav-link-locked i {
    font-size: 16px;
    width: 20px;
    flex-shrink: 0;
}

.soon-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.30);
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 8px 0;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topbar-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 17px;
    color: var(--text-dark);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search {
    position: relative;
    flex-shrink: 0;
}

.topbar-search input {
    padding: 7px 14px 7px 36px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    width: 220px;
    background: var(--off-white);
    color: var(--text-dark);
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s ease;
}

.topbar-search input:focus {
    border-color: var(--gold);
}

.topbar-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--off-white);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.topbar-icon-btn:hover {
    background: var(--navy);
    color: var(--gold);
    border-color: var(--navy);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.user-avatar::after { display: none; }

/* Hamburger */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    flex-shrink: 0;
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ── Page Body ───────────────────────────────────────────── */
.page-body {
    padding: 24px;
    flex: 1;
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border-top: 4px solid var(--gold);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card.border-gold    { border-top-color: var(--gold); }
.stat-card.border-success { border-top-color: var(--success); }
.stat-card.border-info    { border-top-color: var(--info); }
.stat-card.border-danger  { border-top-color: var(--danger); }
.stat-card.border-warning { border-top-color: var(--warning); }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-altaris {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--navy);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    padding: 9px 22px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.btn-altaris:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245,200,66,0.45);
    color: var(--navy);
}

.btn-altaris:active {
    transform: translateY(0);
}

/* ── Forms ───────────────────────────────────────────────── */
.altaris-input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--white);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
    font-family: 'Inter', sans-serif;
}

.altaris-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245,200,66,0.18);
}

.altaris-input::placeholder {
    color: var(--text-muted);
}

.altaris-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
    display: block;
}

/* ── Tables ──────────────────────────────────────────────── */
.altaris-table {
    width: 100%;
    border-collapse: collapse;
}

.altaris-table thead {
    background: var(--navy);
}

.altaris-table thead th {
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 13px 16px;
    color: var(--white);
    border: none;
    white-space: nowrap;
    letter-spacing: 0.03em;
}

.altaris-table tbody tr {
    transition: background 0.12s ease;
}

.altaris-table tbody tr:hover {
    background: rgba(245,200,66,0.06);
}

.altaris-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
    color: var(--text-dark);
}

/* ── Member Avatar (initials) ────────────────────────────── */
.member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.member-avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 11px;
}

.member-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 20px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .hamburger-btn {
        display: block;
    }

    .topbar-search {
        display: none !important;
    }

    .page-body {
        padding: 16px;
    }
}

@media (max-width: 575.98px) {
    .stat-value {
        font-size: 22px;
    }

    .topbar {
        padding: 0 14px;
        gap: 10px;
    }
}

/* ── Collapsible Sidebar Groups ──────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 4px;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.sidebar-group-header {
    width: 100%;
    background: none;
    border: none;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.40);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: left;
}

.sidebar-group-header:hover {
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.75);
}

.sidebar-group-header.active-group {
    color: var(--gold);
}

.sidebar-group-header .group-label {
    display: flex;
    align-items: center;
    gap: 9px;
}

.sidebar-group-header .group-label i {
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.group-arrow {
    font-size: 11px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    opacity: 0.45;
}

.sidebar-group-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}

/* Settings pinned at bottom */
.sidebar-settings {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding: 6px 0;
}

/* Page header (used across all module pages) */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* ── RBAC: Sidebar User Info & Role Badge ─────────────────── */
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: rgba(245,200,66,0.18);
    border: 1px solid rgba(245,200,66,0.35);
    color: var(--gold);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.user-role-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 20px;
    background: var(--gold);
    color: var(--navy);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}

/* ── Impersonation Banner ────────────────────────────────── */
.impersonation-banner {
    background: #F59E0B;
    color: #1a1a2e;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 2000;
}
.btn-stop-impersonate {
    background: #1a1a2e;
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    margin-left: auto;
    white-space: nowrap;
}
.btn-stop-impersonate:hover { background: #0B1120; color: #fff; }

/* ── Finance sub-nav items ───────────────────────────────── */
.nav-sub {
    padding-left: 44px !important;
    font-size: 12px !important;
}

/* ── AI Sermon Resources Tabs ───────────────────────────── */
.resources-tabs { display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.res-tab {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.res-tab:hover { background:rgba(245,200,66,0.2); color:#F5C842; border-color:#F5C842; }
.res-tab.active { background:#F5C842; color:#0B1120; border-color:#F5C842; font-weight:600; }
.quote-card { background:rgba(255,255,255,0.08); border-left:3px solid #F5C842; border-radius:8px; padding:12px 14px; margin-bottom:10px; }
.quote-text { color:white; font-size:14px; font-style:italic; line-height:1.6; margin-bottom:8px; }
.quote-author { color:#F5C842; font-size:12px; font-weight:600; }
.quote-church { color:rgba(255,255,255,0.5); font-size:11px; }
.quote-relevance { color:rgba(255,255,255,0.4); font-size:11px; margin-top:4px; font-style:normal; }
.book-card { background:rgba(255,255,255,0.08); border-radius:8px; padding:12px 14px; margin-bottom:10px; display:flex; gap:12px; align-items:flex-start; }
.book-icon { font-size:24px; flex-shrink:0; }
.book-title { color:white; font-size:14px; font-weight:600; }
.book-author { color:#F5C842; font-size:12px; margin-top:2px; }
.book-insight { color:rgba(255,255,255,0.6); font-size:12px; margin-top:6px; font-style:italic; }
.insight-card { background:rgba(255,255,255,0.08); border-radius:8px; padding:12px 14px; margin-bottom:10px; }
.insight-pastor { color:#F5C842; font-size:13px; font-weight:600; margin-bottom:6px; }
.insight-text { color:rgba(255,255,255,0.85); font-size:13px; line-height:1.6; font-style:italic; }

/* ── Hymn Lyrics ──────────────────────────────────────────────────────────── */
.lyrics-verse, .lyrics-chorus, .lyrics-bridge { border-left: 3px solid #F5C842; padding-left: 16px; }
.verse-number { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px; }
.chorus-label { color: var(--gold-dark, #d4a017); }
.verse-text { font-size: 15px; line-height: 1.8; color: var(--text-dark, #1a202c); font-style: italic; }
.chorus-text { font-weight: 500; font-style: normal; }

/* ── Breadcrumb ──────────────────────────────────────── */
.breadcrumb { background: transparent; padding: 0; margin: 0; font-size: 13px; }
.breadcrumb-item a { color: var(--navy, #0B1120); text-decoration: none; font-weight: 500; }
.breadcrumb-item a:hover { color: var(--gold-dark, #d4a017); text-decoration: underline; }
.breadcrumb-item.active { color: #6b7280; }
.breadcrumb-item + .breadcrumb-item::before { color: #d1d5db; content: "/"; }
