/* ═══════════════════════════════════════════════════════════════════
   SIMON  -  Dark Theme  -  Violet & Noir
   ═══════════════════════════════════════════════════════════════════ */

/* ── MOBILE TOPBAR (caché sur desktop) ─────────────────────────────── */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
#hamburger-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: var(--radius);
}
#hamburger-btn:hover { background: var(--bg3); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 98;
}
.sidebar-overlay.open { display: block; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }

  #app { flex-direction: column; }

  .sidebar {
    position: fixed;
    top: 0; left: -260px;
    height: 100%;
    z-index: 99;
    transition: left .25s ease;
    width: 260px;
  }
  .sidebar.open { left: 0; }

  .content { padding: 12px; }

  .stats-row { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .stats-row .card { padding: 16px 12px !important; }
  .card-value { font-size: 22px !important; }

  .page-header { margin-bottom: 12px; }
  .page-title { font-size: 17px; }

  .form-row { flex-direction: column; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .filters { flex-wrap: wrap; }
  .filters select, .filters input { min-width: 140px; }

  .modal-box { width: 95vw; margin: 12px; padding: 16px; }

  .member-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }

  /* Carte : layout vertical sur mobile */
  .map-container {
    flex-direction: column !important;
    height: auto !important;
  }
  .map-container #gta-map {
    flex: none !important;
    height: 60vw !important;
    min-height: 260px;
    max-height: 380px;
  }
  .map-container #wp-sidebar {
    width: 100% !important;
    height: 220px !important;
    flex-shrink: 0 !important;
  }
}

:root {
  --bg:         #0c0c0c;
  --bg2:        #111118;
  --bg3:        #1a1a24;
  --card:       #16161e;
  --border:     #2a2a3a;
  --red:        #4a0080;
  --red-l:      #6600b3;
  --red-ll:     #9933cc;
  --red-dim:    rgba(102,0,153,.15);
  --text:       #e8e8e8;
  --text-dim:   #888;
  --text-faint: #555;
  --success:    #1a7a1a;
  --success-l:  #22a022;
  --danger:     #4a0080;
  --warn:       #7a5500;
  --warn-l:     #c48800;
  --sidebar-w:  230px;
  --radius:     6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── SCROLLBAR ──────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--red); border-radius: 3px; }

/* ── LOGIN ──────────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0d001a 0%, #0c0c0c 70%);
}

.login-box {
  background: var(--card);
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 40px;
  width: 360px;
  box-shadow: 0 0 40px rgba(139,0,0,.4);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-rose { font-size: 52px; display: block; margin-bottom: 8px; }
.login-logo h1 {
  font-size: 24px; font-weight: 800; letter-spacing: 4px;
  color: var(--red-ll); text-transform: uppercase;
}
.login-subtitle { color: var(--text-dim); font-size: 12px; letter-spacing: 2px; margin-top: 4px; }

/* ── APP LAYOUT ─────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-rose { font-size: 24px; }
.brand-name {
  font-size: 13px; font-weight: 800; letter-spacing: 2px;
  color: var(--red-ll); text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-dim);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  text-decoration: none;
  font-size: 13px;
}
.nav-item:hover  { color: var(--text); background: var(--bg3); }
.nav-item.active {
  color: var(--red-ll);
  background: var(--red-dim);
  border-left-color: var(--red-ll);
}
.nav-ic { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#sidebar-username { font-weight: 600; font-size: 13px; }

.role-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  letter-spacing: .5px;
}

/* ── CONTENT ────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────── */
h2 { font-size: 20px; font-weight: 700; color: var(--text); }
h3 { font-size: 16px; font-weight: 600; color: var(--text); }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-title span { color: var(--red-ll); }

/* ── BUTTONS ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--red-l); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #252525; }
.btn-danger   { background: #4a0000; color: #ff6666; border: 1px solid #6a0000; }
.btn-danger:hover:not(:disabled)   { background: #600000; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled)  { background: var(--success-l); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 6px 8px; background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-icon:hover { color: var(--text); border-color: var(--text-dim); }

/* ── FORMS ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; letter-spacing: .3px; }

input, select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s;
  outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--red); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { display: none; }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; padding: 0; }
input[type="file"] { padding: 6px; cursor: pointer; }
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 70px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.error-msg {
  background: rgba(139,0,0,.2);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: #ff8080;
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 8px;
}

/* ── CARDS ──────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 8px;
}
.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--red-ll);
}
.card-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 20px; }

/* ── MEMBER GRID ────────────────────────────────────────────────────── */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }

.member-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}
.member-card:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(139,0,0,.25); }
.member-card.inactive { opacity: .5; }

.member-avatar {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-faint);
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-avatar-placeholder { width: 100%; aspect-ratio: 1; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 48px; }

.member-info { padding: 12px; }
.member-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-tithe { font-size: 18px; font-weight: 700; color: var(--red-ll); }
.member-tithe-label { font-size: 11px; color: var(--text-dim); }

/* ── TABLES ─────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg3);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }
.td-right { text-align: right; }
.td-center { text-align: center; }
.td-actions { white-space: nowrap; display: flex; gap: 4px; }

/* ── BADGES ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: rgba(26,122,26,.3); color: #6fc96f; border: 1px solid rgba(26,122,26,.5); }
.badge-red    { background: rgba(139,0,0,.3);   color: #ff8080; border: 1px solid rgba(139,0,0,.5); }
.badge-yellow { background: rgba(122,85,0,.3);  color: #c4a000; border: 1px solid rgba(122,85,0,.5); }
.badge-blue   { background: rgba(0,60,120,.3);  color: #60a0ff; border: 1px solid rgba(0,60,120,.5); }
.badge-gray   { background: rgba(80,80,80,.3);  color: #aaa;    border: 1px solid rgba(80,80,80,.5); }

/* ── MODAL ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { color: var(--red-ll); font-size: 16px; }
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ── TOASTS ─────────────────────────────────────────────────────────── */
#toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  animation: slideIn .2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: #8b0000;       color: #fff; }
.toast-info    { background: #003060;       color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── TABS ───────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  margin-bottom: -1px;
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--red-ll); border-bottom-color: var(--red-ll); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── FILTERS ────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.filters input, .filters select { width: auto; min-width: 140px; }

/* ── CHART ──────────────────────────────────────────────────────────── */
.chart-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

/* ── MEMBER DETAIL ──────────────────────────────────────────────────── */
.member-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.member-detail-photo {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--red);
  background: var(--bg3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
}
.member-detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.member-detail-name { font-size: 22px; font-weight: 700; }
.member-detail-join { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ── PRODUCTION CALCULATOR ──────────────────────────────────────────── */
.calc-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.calc-result {
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.calc-result h4 { color: var(--red-ll); margin-bottom: 12px; font-size: 14px; }
.calc-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); }
.calc-row:last-child { border: none; font-weight: 700; color: var(--red-ll); margin-top: 4px; }
.calc-row .label { color: var(--text-dim); }
.calc-row .value { font-weight: 600; }
.calc-big { font-size: 22px; font-weight: 800; color: var(--red-ll); text-align: center; margin: 8px 0; }

/* ── BANK ───────────────────────────────────────────────────────────── */
.balance-display {
  background: var(--card);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(139,0,0,.2);
}
.balance-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 8px; }
.balance-amount { font-size: 42px; font-weight: 800; color: var(--red-ll); }

/* ── BACK BUTTON ────────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 16px;
  background: none;
  border: none;
  padding: 4px 0;
}
.back-btn:hover { color: var(--text); }

/* ── SEPARATOR ──────────────────────────────────────────────────────── */
.sep { height: 1px; background: var(--border); margin: 20px 0; }

/* ── EMPTY STATE ────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-faint);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty p { font-size: 14px; }

/* ── UTILS ──────────────────────────────────────────────────────────── */
.text-red   { color: var(--red-ll); }
.text-green { color: #6fc96f; }
.text-dim   { color: var(--text-dim); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mt-8  { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── MAP ────────────────────────────────────────────────────────────── */
.leaflet-container { background: rgb(20, 61, 107) !important; font-family: inherit; }
.map-tooltip {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.6) !important;
  padding: 6px 10px !important;
  border-radius: var(--radius) !important;
  font-size: 12px !important;
}
.map-tooltip::before { border-top-color: var(--border) !important; }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* ── PAGINATION ─────────────────────────────────────────────────────── */
.pagination { display:flex;align-items:center;gap:6px;justify-content:center;padding:12px 0 4px; }
.pagination button { background:var(--bg3);border:1px solid var(--border);color:var(--text);padding:4px 10px;border-radius:4px;cursor:pointer;font-size:13px;transition:background .15s; }
.pagination button:hover:not(:disabled) { background:var(--bg4,#222); }
.pagination button.pag-active { background:var(--red);color:#fff;border-color:var(--red); }
.pagination button:disabled { opacity:.35;cursor:default; }
.pagination .pag-info { font-size:12px;color:var(--text-dim);padding:0 4px; }

/* ── MAP SIDEBAR ─────────────────────────────────────────────────────── */
.wp-sidebar-item { cursor:pointer;padding:5px 8px;border-radius:4px;margin:2px 0;display:flex;align-items:center;gap:8px;font-size:13px;transition:background .1s; }
.wp-sidebar-item:hover { background:var(--bg3); }
.wp-cat-label { font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.6px;padding:8px 4px 4px;opacity:.85; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  :root { --sidebar-w: 200px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); }
}
