/* ============================================================
   O'Church — Styles globaux
   Thème : Bleu profond + Or accent — professionnel & élégant
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables CSS ───────────────────────────────────────── */
:root {
  --ch-primary:       #1B3A6B;
  --ch-primary-light: #2351A0;
  --ch-primary-dark:  #122847;
  --ch-accent:        #D4A017;
  --ch-accent-light:  #F0C842;
  --ch-success:       #1A7F5A;
  --ch-danger:        #C0392B;
  --ch-warning:       #E67E22;
  --ch-info:          #2471A3;
  --ch-bg:            #F4F6FB;
  --ch-bg-card:       #FFFFFF;
  --ch-sidebar-bg:    #122847;
  --ch-sidebar-text:  #A8C0D6;
  --ch-sidebar-active:#FFFFFF;
  --ch-text:          #1A2B45;
  --ch-text-muted:    #6B7F96;
  --ch-border:        #DDE3EF;
  --ch-shadow:        0 2px 16px rgba(27,58,107,.08);
  --ch-shadow-md:     0 4px 24px rgba(27,58,107,.12);
  --ch-radius:        .75rem;
  --ch-radius-sm:     .5rem;
  --ch-sidebar-w:     260px;
  --ch-topbar-h:      64px;
  --ch-font:          'Plus Jakarta Sans', sans-serif;
  --ch-mono:          'DM Mono', monospace;
  --ch-transition:    .2s ease;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--ch-font); background: var(--ch-bg); color: var(--ch-text); margin: 0; }
a { color: var(--ch-primary-light); text-decoration: none; }
a:hover { color: var(--ch-accent); }

/* ── Sidebar ─────────────────────────────────────────────── */
.ch-sidebar {
  position: fixed; top: 0; left: 0; width: var(--ch-sidebar-w);
  height: 100vh; background: var(--ch-sidebar-bg);
  display: flex; flex-direction: column; z-index: 1040;
  transition: transform var(--ch-transition);
}
.ch-sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ch-sidebar-brand .brand-logo {
  font-size: 1.4rem; font-weight: 800; color: #fff;
  letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem;
}
.ch-sidebar-brand .brand-logo span { color: var(--ch-accent); }
.ch-sidebar-brand .brand-logo .church { color: #fff; transition: color .2s; }
.ch-sidebar-brand:hover .brand-logo .church { color: var(--ch-accent); }
.ch-sidebar-church-name {
  font-size: .75rem; color: var(--ch-sidebar-text); margin-top: .25rem;
  padding: 0 .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ch-sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem 0; }
.ch-sidebar-nav::-webkit-scrollbar { width: 4px; }
.ch-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.ch-nav-group-label {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: rgba(168,192,214,.5);
  padding: .75rem 1.25rem .25rem; margin-top: .25rem;
}
.ch-nav-item { display: block; padding: .6rem 1.25rem; margin: .1rem .5rem;
  border-radius: var(--ch-radius-sm); color: var(--ch-sidebar-text);
  font-size: .875rem; font-weight: 500; display: flex; align-items: center; gap: .75rem;
  transition: all var(--ch-transition);
}
.ch-nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.ch-nav-item.active { background: var(--ch-primary-light); color: var(--ch-sidebar-active); }
.ch-nav-item .nav-icon { width: 1.1rem; text-align: center; font-size: 1rem; }
.ch-nav-item .nav-badge {
  margin-left: auto; background: var(--ch-accent); color: #fff;
  font-size: .65rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px;
}
.ch-sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.08); }

/* ── Topbar ──────────────────────────────────────────────── */
.ch-topbar {
  position: fixed; top: 0; right: 0; left: var(--ch-sidebar-w);
  height: var(--ch-topbar-h); background: var(--ch-bg-card);
  border-bottom: 1px solid var(--ch-border); z-index: 1030;
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  box-shadow: var(--ch-shadow);
  transition: left var(--ch-transition);
}
.ch-topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--ch-text); flex: 1; }
.ch-topbar-actions { display: flex; align-items: center; gap: .75rem; }
.ch-topbar-btn {
  width: 2.25rem; height: 2.25rem; border-radius: var(--ch-radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--ch-bg); border: 1px solid var(--ch-border); color: var(--ch-text-muted);
  cursor: pointer; transition: all var(--ch-transition); position: relative;
}
.ch-topbar-btn:hover { background: var(--ch-primary); color: #fff; border-color: var(--ch-primary); }
.ch-topbar-btn .badge-dot {
  position: absolute; top: .3rem; right: .3rem; width: .5rem; height: .5rem;
  background: var(--ch-danger); border-radius: 50%; border: 2px solid var(--ch-bg-card);
}

/* ── Main Content ────────────────────────────────────────── */
.ch-main {
  margin-left: var(--ch-sidebar-w); padding-top: var(--ch-topbar-h);
  min-height: 100vh;
}
.ch-page { padding: 1.5rem; }

/* ── Subscription Alert ──────────────────────────────────── */
.ch-subscription-alert {
  background: linear-gradient(135deg, var(--ch-warning), #D35400);
  color: #fff; padding: .6rem 1.5rem;
  display: flex; align-items: center; gap: 1rem; font-size: .875rem;
  position: sticky; top: var(--ch-topbar-h); z-index: 1020;
}
.ch-subscription-alert .alert-countdown { font-family: var(--ch-mono); font-weight: 600; }
.ch-subscription-alert .btn-renew {
  margin-left: auto; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
  color: #fff; padding: .25rem .75rem; border-radius: var(--ch-radius-sm);
  font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background var(--ch-transition);
}
.ch-subscription-alert .btn-renew:hover { background: rgba(255,255,255,.35); }

/* ── Stat Cards ──────────────────────────────────────────── */
.ch-stat-card {
  background: var(--ch-bg-card); border-radius: var(--ch-radius);
  padding: 1.25rem; border: 1px solid var(--ch-border); box-shadow: var(--ch-shadow);
  transition: transform var(--ch-transition), box-shadow var(--ch-transition);
}
.ch-stat-card:hover { transform: translateY(-2px); box-shadow: var(--ch-shadow-md); }
.ch-stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ch-text-muted); }
.ch-stat-value { font-size: 1.75rem; font-weight: 800; color: var(--ch-text);
  line-height: 1.1; margin: .25rem 0; }
.ch-stat-icon {
  width: 2.5rem; height: 2.5rem; border-radius: var(--ch-radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  float: right; margin-top: -.25rem;
}
.ch-stat-icon.primary { background: rgba(27,58,107,.1); color: var(--ch-primary-light); }
.ch-stat-icon.accent  { background: rgba(212,160,23,.1); color: var(--ch-accent); }
.ch-stat-icon.success { background: rgba(26,127,90,.1);  color: var(--ch-success); }
.ch-stat-icon.danger  { background: rgba(192,57,43,.1);  color: var(--ch-danger); }
.ch-stat-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: 999px;
}
.ch-stat-badge.up   { background: rgba(26,127,90,.1); color: var(--ch-success); }
.ch-stat-badge.down { background: rgba(192,57,43,.1); color: var(--ch-danger); }

/* ── Cards ───────────────────────────────────────────────── */
.ch-card {
  background: var(--ch-bg-card); border-radius: var(--ch-radius);
  border: 1px solid var(--ch-border); box-shadow: var(--ch-shadow);
}
.ch-card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--ch-border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: .9rem;
}
.ch-card-body { padding: 1.25rem; }

/* ── DataTable Custom ────────────────────────────────────── */
.ch-table-wrapper { border-radius: var(--ch-radius); overflow: hidden;
  border: 1px solid var(--ch-border); background: var(--ch-bg-card); }
table.dataTable thead th {
  background: var(--ch-primary) !important; color: #fff !important;
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: .85rem 1rem !important; border: none !important;
}
table.dataTable tbody tr { border-bottom: 1px solid var(--ch-border); }
table.dataTable tbody tr:hover td { background: rgba(27,58,107,.03); }
table.dataTable tbody td { padding: .85rem 1rem !important; font-size: .875rem; vertical-align: middle; }
/* Pagination supprimé - géré par chaque page spécifiques */
/*
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--ch-primary) !important; color: #fff !important; border-color: var(--ch-primary) !important;
  border-radius: var(--ch-radius-sm) !important;
}
*/
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--ch-border) !important; border-radius: var(--ch-radius-sm) !important;
  padding: .35rem .75rem !important; font-family: var(--ch-font);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-ch-primary {
  background: var(--ch-primary); color: #fff; border: none;
  padding: .5rem 1.25rem; border-radius: var(--ch-radius-sm);
  font-weight: 600; font-size: .875rem; cursor: pointer;
  transition: background var(--ch-transition); display: inline-flex; align-items: center; gap: .4rem;
}
.btn-ch-primary:hover { background: var(--ch-primary-light); color: #fff; }
.btn-ch-accent { background: var(--ch-accent); }
.btn-ch-accent:hover { background: var(--ch-accent-light); }

/* ── Forms ───────────────────────────────────────────────── */
.ch-form-label {
  font-size: .8rem; font-weight: 600; color: var(--ch-text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; display: block;
}
.ch-form-control {
  display: block; width: 100%; padding: .55rem .875rem;
  border: 1.5px solid var(--ch-border); border-radius: var(--ch-radius-sm);
  font-family: var(--ch-font); font-size: .875rem; color: var(--ch-text);
  background: var(--ch-bg); transition: border-color var(--ch-transition), box-shadow var(--ch-transition);
}
.ch-form-control:focus {
  outline: none; border-color: var(--ch-primary-light);
  box-shadow: 0 0 0 3px rgba(35,81,160,.12); background: #fff;
}
.ch-form-control.is-invalid { border-color: var(--ch-danger); }
.ch-invalid-feedback { font-size: .78rem; color: var(--ch-danger); margin-top: .2rem; }

/* ── Badges ──────────────────────────────────────────────── */
.ch-badge {
  display: inline-flex; align-items: center; padding: .2rem .55rem;
  border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.ch-badge-active   { background: rgba(26,127,90,.12); color: var(--ch-success); }
.ch-badge-blocked  { background: rgba(192,57,43,.12); color: var(--ch-danger); }
.ch-badge-pending  { background: rgba(230,126,34,.12); color: var(--ch-warning); }
.ch-badge-info     { background: rgba(36,113,163,.12); color: var(--ch-info); }

/* ── Toast (Toastr override) ─────────────────────────────── */
#toast-container > div { border-radius: var(--ch-radius) !important;
  font-family: var(--ch-font) !important; box-shadow: var(--ch-shadow-md) !important; }

/* ── Wallet Summary ──────────────────────────────────────── */
.ch-wallet-card { border-left: 4px solid; border-radius: var(--ch-radius); padding: 1rem 1.25rem; }
.ch-wallet-card.cash   { border-color: var(--ch-success); background: rgba(26,127,90,.05); }
.ch-wallet-card.mobile { border-color: var(--ch-primary-light); background: rgba(35,81,160,.05); }
.ch-wallet-card.commission { border-color: var(--ch-accent); background: rgba(212,160,23,.05); }
.ch-wallet-amount { font-size: 1.4rem; font-weight: 800; font-family: var(--ch-mono); }

/* ── Mobile Overrides ────────────────────────────────────── */
@media (max-width: 991.98px) {
  :root { --ch-sidebar-w: 0px; }
  .ch-sidebar { transform: translateX(-260px); width: 260px; }
  .ch-sidebar.show { transform: translateX(0); }
  .ch-topbar { left: 0; }
  .ch-main { margin-left: 0; }
  .ch-page { padding: 1rem; }
  .ch-sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 1039; display: none;
  }
  .ch-sidebar-overlay.show { display: block; }
}
