/* =========================================================================
   মসজিদ ম্যানেজমেন্ট সিস্টেম — Shared Design System
   Theme: Islamic Green & Gold | Fully responsive (mobile-first)
   This file is loaded on every page (admin shell + public pages).
   ========================================================================= */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap');

/* ---------- Brand tokens (reskins Bootstrap 5.3 CSS variables) ---------- */
:root {
    --brand-25: #f4f9f6;
    --brand-50: #e9f5ee;
    --brand-100: #cfe9db;
    --brand-200: #a3d4bb;
    --brand-300: #72bd9b;
    --brand-400: #429e78;
    --brand-500: #1f7a53;
    --brand-600: #146345;
    --brand-700: #0f4f37;
    --brand-800: #0c3f2c;
    --brand-900: #082a1e;

    --gold-100: #fbf0d9;
    --gold-300: #edc978;
    --gold-400: #e0b354;
    --gold-500: #c8983a;
    --gold-600: #a97c2b;

    --surface: #f3f6f4;
    --surface-alt: #eef2ef;
    --card-bg: #ffffff;
    --border-color: #e3e8e4;
    --text-body: #223229;
    --text-muted: #6b7a71;

    --radius-sm: .5rem;
    --radius-md: .85rem;
    --radius-lg: 1.15rem;
    --shadow-sm: 0 1px 2px rgba(8, 42, 30, .06), 0 1px 1px rgba(8, 42, 30, .04);
    --shadow-md: 0 8px 24px rgba(8, 42, 30, .08);
    --shadow-lg: 0 16px 40px rgba(8, 42, 30, .12);

    /* Bootstrap 5.3 variable overrides -> reskins buttons, links, badges, etc. */
    --bs-primary: var(--brand-600);
    --bs-primary-rgb: 20, 99, 69;
    --bs-secondary: #5b6b62;
    --bs-secondary-rgb: 91, 107, 98;
    --bs-success: #227a4c;
    --bs-success-rgb: 34, 122, 76;
    --bs-info: #2a7f8f;
    --bs-info-rgb: 42, 127, 143;
    --bs-warning: var(--gold-500);
    --bs-warning-rgb: 200, 152, 58;
    --bs-danger: #b3332c;
    --bs-danger-rgb: 179, 51, 44;
    --bs-body-font-family: 'Hind Siliguri', 'Poppins', system-ui, sans-serif;
    --bs-body-color: var(--text-body);
    --bs-body-bg: var(--surface);
    --bs-link-color: var(--brand-600);
    --bs-link-hover-color: var(--brand-700);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-md);
    --bs-border-radius-sm: .4rem;
}

* { scrollbar-width: thin; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--bs-body-font-family);
    color: var(--text-body);
    background-color: var(--surface);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .brand-font { font-family: 'Poppins', 'Hind Siliguri', sans-serif; }
a { text-decoration: none; }
::selection { background: var(--brand-200); }

/* ---------- Buttons ---------- */
.btn { font-weight: 500; border-radius: var(--radius-sm); }
.btn-primary { --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700); --bs-btn-active-bg: var(--brand-800); box-shadow: none; }
.btn-gold, .btn-accent {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
    border: none; color: #3a2b06; font-weight: 600;
}
.btn-gold:hover, .btn-accent:hover { background: linear-gradient(135deg, var(--gold-300), var(--gold-400)); color: #3a2b06; }
.btn-sm { border-radius: .4rem; }
.btn i, .btn .bi { margin-inline-end: .35rem; }

/* ---------- App Shell Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* Topbar */
.app-topbar {
    position: sticky; top: 0; z-index: 1040;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: .6rem 1rem;
    display: flex; align-items: center; gap: .75rem;
    box-shadow: var(--shadow-sm);
}
.app-topbar .topbar-toggle {
    border: 1px solid var(--border-color); background: var(--surface-alt);
    border-radius: .6rem; width: 40px; height: 40px; display: inline-flex;
    align-items: center; justify-content: center; color: var(--brand-700); font-size: 1.2rem;
}
.app-topbar .topbar-brand { font-weight: 700; color: var(--brand-800); font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.app-topbar .topbar-brand .bi { color: var(--gold-500); }
.app-topbar .topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: .5rem; }
.app-topbar .page-eyebrow { color: var(--text-muted); font-size: .8rem; }

/* Sidebar */
.app-sidebar {
    width: 264px; flex-shrink: 0;
    background: linear-gradient(180deg, var(--brand-800), var(--brand-900));
    color: #eafaf1;
}
.app-sidebar .sidebar-inner { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.app-sidebar .sidebar-brand {
    padding: 1.25rem 1.1rem; display: flex; align-items: center; gap: .65rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar .sidebar-brand .brand-icon {
    width: 38px; height: 38px; border-radius: .7rem;
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
    display: flex; align-items: center; justify-content: center; color: #3a2b06; font-size: 1.15rem; flex-shrink: 0;
}
.app-sidebar .sidebar-brand .brand-text { font-weight: 700; font-size: .98rem; line-height: 1.25; color: #fff; }
.app-sidebar .sidebar-brand small { color: rgba(255,255,255,.6); font-weight: 400; font-size: .72rem; }

.app-sidebar .sidebar-nav { flex: 1; overflow-y: auto; padding: .85rem .65rem; }
.app-sidebar .nav-section-label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: rgba(255,255,255,.45); padding: .85rem .6rem .35rem;
}
.app-sidebar .nav-link {
    color: rgba(234, 250, 241, .82); border-radius: .6rem; padding: .58rem .75rem;
    display: flex; align-items: center; gap: .7rem; font-size: .92rem; font-weight: 500;
    margin-bottom: .15rem; transition: background .15s ease, color .15s ease;
}
.app-sidebar .nav-link .bi { font-size: 1.05rem; width: 1.3rem; text-align: center; opacity: .85; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
    color: #3a2b06; font-weight: 600; box-shadow: var(--shadow-sm);
}
.app-sidebar .nav-link.active .bi { opacity: 1; }
.app-sidebar .sidebar-footer { padding: .85rem 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08); }
.app-sidebar .sidebar-footer a { color: rgba(234, 250, 241, .75); font-size: .85rem; display: flex; align-items: center; gap: .5rem; padding: .35rem 0; }
.app-sidebar .sidebar-footer a:hover { color: #fff; }
.app-sidebar .sidebar-footer .bi { width: 1.3rem; text-align: center; }

/* Main content */
.app-main { flex: 1; min-width: 0; }
.app-content { padding: 1.25rem 1.25rem 3rem; max-width: 1500px; }

/* Page header */
.page-header {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color);
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--brand-800); margin: 0; display: flex; align-items: center; gap: .55rem; }
.page-header h1 .bi { color: var(--gold-500); }
.page-header .page-subtitle { color: var(--text-muted); font-size: .88rem; margin-top: .15rem; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); background: var(--card-bg);
}
.card-header {
    background: var(--card-bg); border-bottom: 1px solid var(--border-color);
    font-weight: 600; color: var(--brand-800); border-top-left-radius: var(--radius-md) !important; border-top-right-radius: var(--radius-md) !important;
    display: flex; align-items: center; gap: .5rem;
}
.card-header .bi { color: var(--gold-500); }

/* Stat cards */
.stat-card {
    border: none; border-radius: var(--radius-lg); color: #fff; overflow: hidden; position: relative;
    box-shadow: var(--shadow-md);
}
.stat-card .card-body { padding: 1.15rem 1.25rem; position: relative; z-index: 1; }
.stat-card .stat-icon {
    position: absolute; right: .6rem; top: .5rem; font-size: 2.6rem; opacity: .18;
}
.stat-card .stat-label { font-size: .82rem; font-weight: 500; opacity: .9; margin-bottom: .25rem; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; font-family: 'Poppins', sans-serif; }
.stat-card.tone-green { background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); }
.stat-card.tone-gold { background: linear-gradient(135deg, var(--gold-400), var(--gold-600)); color: #3a2b06; }
.stat-card.tone-teal { background: linear-gradient(135deg, #2a7f8f, #205f6c); }
.stat-card.tone-rose { background: linear-gradient(135deg, #c0564f, #9c3f3a); }
.stat-card.tone-dark { background: linear-gradient(135deg, #34423a, #1c2621); }
.stat-card.tone-slate { background: linear-gradient(135deg, #5b6b62, #3f4c45); }

/* ---------- Tables ---------- */
.table { --bs-table-hover-bg: var(--brand-25); }
.table thead th {
    background: var(--surface-alt); color: var(--brand-800);
    font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
    border-bottom-width: 1px; white-space: nowrap;
}
.table td, .table th { vertical-align: middle; }
.table-card .table { margin-bottom: 0; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: .87rem; color: var(--text-body); }
.form-control, .form-select {
    border-color: var(--border-color); border-radius: var(--radius-sm);
    padding: .55rem .8rem; font-size: .92rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-400); box-shadow: 0 0 0 .2rem rgba(20, 99, 69, .14);
}
.input-group-text { background: var(--surface-alt); border-color: var(--border-color); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .74rem; padding: .4em .65em; border-radius: .5rem; }

/* ---------- Alerts / Flash messages ---------- */
.alert { border: none; border-radius: var(--radius-md); border-inline-start: 4px solid transparent; box-shadow: var(--shadow-sm); }
.alert-success { background: #e9f7ef; color: #1c6b41; border-inline-start-color: #1c6b41; }
.alert-danger { background: #fdecea; color: #9c322c; border-inline-start-color: #9c322c; }
.alert-warning { background: var(--gold-100); color: #7a5b12; border-inline-start-color: var(--gold-500); }
.alert-info { background: #e7f4f6; color: #205f6c; border-inline-start-color: #205f6c; }

/* ---------- Modals ---------- */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border-color); }
.modal-header .modal-title { font-weight: 700; color: var(--brand-800); }
.modal-footer { border-top: 1px solid var(--border-color); }

/* ---------- Nav tabs ---------- */
.nav-tabs { border-bottom-color: var(--border-color); }
.nav-tabs .nav-link { color: var(--text-muted); font-weight: 500; border: none; border-bottom: 2px solid transparent; border-radius: 0; }
.nav-tabs .nav-link.active { color: var(--brand-700); border-bottom-color: var(--gold-500); background: transparent; font-weight: 600; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .bi { font-size: 2.4rem; color: var(--brand-200); margin-bottom: .5rem; display: block; }

/* ---------- Misc ---------- */
.text-brand { color: var(--brand-700) !important; }
.bg-brand-soft { background: var(--brand-50) !important; }
.divider-gold { height: 3px; width: 46px; background: linear-gradient(90deg, var(--gold-400), var(--gold-600)); border-radius: 3px; }
.avatar-circle {
    width: 38px; height: 38px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

/* ---------- Scrollbars (webkit) ---------- */
.sidebar-nav::-webkit-scrollbar, .app-main::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

/* =========================================================================
   Responsive breakpoints
   ========================================================================= */
@media (max-width: 991.98px) {
    .app-content { padding: 1rem 1rem 2.5rem; }
    .page-header h1 { font-size: 1.2rem; }
    .stat-card .stat-value { font-size: 1.25rem; }
}
@media (max-width: 575.98px) {
    .app-content { padding: .85rem .75rem 2rem; }
    .card-body { padding: 1rem; }
    .page-header { align-items: flex-start; }
}

/* Offcanvas sidebar (mobile/tablet) */
@media (max-width: 991.98px) {
    .app-sidebar.offcanvas-lg { width: 280px; }
}

/* ---------- Public site helpers (landing/login/member-status) ---------- */
.public-shell { background: var(--surface); min-height: 100vh; }
.public-hero {
    background: linear-gradient(135deg, rgba(8,42,30,.88), rgba(20,99,69,.82)), var(--hero-img, none);
    background-size: cover; background-position: center; color: #fff;
}

/* ---------- Print ---------- */
@media print {
    .no-print { display: none !important; }
    .app-sidebar, .app-topbar { display: none !important; }
    .app-main, .app-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
    .card { border: none !important; box-shadow: none !important; }
    body { background: #fff !important; font-size: 11.5pt; }
    .print-only { display: block !important; }
}
.print-only { display: none; }
