:root {
  --bg-0: #040a08;
  --bg-1: #08211c;
  --accent-900: #08201a;
  --accent-700: #1f6b52;
  --accent-500: #57b08f;
  --accent-400: #7cc4a8;
  --accent-300: #a8dcc7;
  --mint-300: #8fe3c0;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.16);
  --text-0: #f5f7ff;
  --text-1: #b7c0e6;
  --text-2: #7f89b8;
  --danger: #ff5c7a;
  --success: #35e0a1;
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text-0);
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(87, 176, 143, 0.35), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(143, 227, 192, 0.18), transparent 55%),
    radial-gradient(1200px 800px at 50% 120%, rgba(31, 107, 82, 0.35), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 45%, #020705 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* Bascule de langue FR / AR (page d'inscription uniquement) */
.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: var(--text-0);
  font-family: 'Poppins', 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lang-toggle:hover {
  background: var(--glass-bg-strong);
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(87, 176, 143, 0.35);
}

html[dir="rtl"] .lang-toggle {
  right: auto;
  left: 20px;
  font-family: 'Tajawal', 'Poppins', sans-serif;
}

/* Ajustements RTL générales de la page d'inscription */
html[dir="rtl"] body {
  font-family: 'Tajawal', 'Poppins', sans-serif;
}

html[dir="rtl"] .field label,
html[dir="rtl"] .insta-handle-label,
html[dir="rtl"] .card h1,
html[dir="rtl"] .card .lede,
html[dir="rtl"] .insta-instruction,
html[dir="rtl"] .form-footer,
html[dir="rtl"] .brand,
html[dir="rtl"] .success-box {
  text-align: right;
}

html[dir="rtl"] .brand {
  text-align: center;
}

@media (max-width: 480px) {
  .lang-toggle {
    top: 14px;
    right: 14px;
    padding: 7px 14px;
    font-size: 12px;
  }
  html[dir="rtl"] .lang-toggle {
    left: 14px;
  }
}

.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.glow-orb.a { width: 420px; height: 420px; top: -140px; left: -120px; background: var(--accent-500); }
.glow-orb.b { width: 380px; height: 380px; bottom: -160px; right: -100px; background: var(--mint-300); opacity: 0.28; }

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 64px;
}

/* Brand header */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
  text-align: center;
}

.brand-logo {
  width: 128px;
  height: auto;
  filter:
    drop-shadow(0 0 22px rgba(87, 176, 143, 0.65))
    drop-shadow(0 0 46px rgba(124, 196, 168, 0.35));
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.brand-title {
  font-size: 15px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-1);
  font-weight: 600;
}

.brand-title span {
  background: linear-gradient(90deg, var(--accent-300), var(--mint-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 13px;
  color: var(--text-2);
  max-width: 380px;
  line-height: 1.5;
}

/* Glass card */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
}

.card h1 {
  font-size: 22px;
  margin: 0 0 6px;
  font-weight: 700;
}

.card .lede {
  color: var(--text-1);
  font-size: 13.5px;
  margin: 0 0 26px;
  line-height: 1.5;
}

/* Form */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-1);
  margin-bottom: 8px;
}

.field input,
.field select {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: inherit;
}

.field input::placeholder {
  color: var(--text-2);
}

.field input:focus,
.field select:focus {
  border-color: var(--accent-400);
  background: rgba(124, 196, 168, 0.1);
  box-shadow: 0 0 0 4px rgba(124, 196, 168, 0.15);
}

.field .error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  min-height: 14px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.insta-check {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-0);
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--accent-500);
  cursor: pointer;
}

.insta-link {
  display: inline-block;
  width: auto;
  margin-top: 0;
  padding: 9px 14px;
  font-size: 12.5px;
  text-decoration: none;
  text-align: center;
}

.insta-instruction {
  font-size: 13px;
  color: var(--text-0);
  line-height: 1.5;
  margin-bottom: 12px;
}

.insta-handle-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-1);
  margin: 16px 0 8px;
}

.insta-handle-wrap {
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.insta-handle-wrap:focus-within {
  border-color: var(--accent-400);
  background: rgba(124, 196, 168, 0.1);
  box-shadow: 0 0 0 4px rgba(124, 196, 168, 0.15);
}

.insta-at {
  display: flex;
  align-items: center;
  padding: 0 4px 0 15px;
  color: var(--text-1);
  font-weight: 600;
  font-size: 14.5px;
}

.insta-handle-wrap input {
  border: none;
  background: transparent;
  padding: 13px 15px 13px 4px;
}

.insta-handle-wrap input:focus {
  box-shadow: none;
  background: transparent;
}

/* Instagram status pill + toggle (admin) */
.insta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.insta-pill:hover { transform: translateY(-1px); }

.insta-pill.confirmed {
  background: rgba(53, 224, 161, 0.16);
  border: 1px solid rgba(53, 224, 161, 0.5);
  color: var(--success);
}

.insta-pill.pending {
  background: rgba(255, 92, 122, 0.14);
  border: 1px solid rgba(255, 92, 122, 0.45);
  color: #ffb0c0;
}

.insta-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.insta-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.insta-handle-link {
  color: var(--accent-300);
  font-size: 12.5px;
  text-decoration: none;
  font-weight: 600;
}

.insta-handle-link:hover {
  text-decoration: underline;
}

.btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: white;
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700) 60%, #0a2420);
  box-shadow: 0 10px 30px rgba(87, 176, 143, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(87, 176, 143, 0.6); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn.danger {
  background: linear-gradient(135deg, #ff5c7a, #a10e2f);
  box-shadow: 0 8px 24px rgba(255, 92, 122, 0.35);
}

.form-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
}

.success-box {
  text-align: center;
  padding: 10px 0 4px;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(53, 224, 161, 0.12);
  border: 1px solid rgba(53, 224, 161, 0.4);
  color: var(--success);
  font-size: 30px;
}

.banner {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
}
.banner.show { display: block; }
.banner.error { background: rgba(255, 92, 122, 0.12); border: 1px solid rgba(255, 92, 122, 0.35); color: #ffb0c0; }
.banner.success { background: rgba(53, 224, 161, 0.12); border: 1px solid rgba(53, 224, 161, 0.35); color: #a9f5d9; }

/* Admin */
.admin-shell {
  width: 100%;
  max-width: 1080px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-topbar .who {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-topbar .who img { width: 46px; height: auto; }
.admin-topbar .who .name { font-weight: 700; font-size: 15px; }
.admin-topbar .who .tag { font-size: 11.5px; color: var(--text-2); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  padding: 18px 20px;
}

.stat-card .num {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent-300), var(--mint-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select {
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-0);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}

.toolbar input { flex: 1; min-width: 180px; }

.toolbar .btn, .toolbar .btn.ghost { width: auto; padding: 10px 16px; font-size: 13px; }

.city-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px 18px;
}

.city-chip {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.city-chip:hover { background: rgba(255, 255, 255, 0.09); }

.city-chip.active {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 16px rgba(87, 176, 143, 0.4);
}

.table-wrap {
  overflow-x: auto;
  padding: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-2);
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}

tbody td {
  padding: 13px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-0);
}

tbody tr:hover { background: rgba(255, 255, 255, 0.035); }

.ville-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 196, 168, 0.16);
  border: 1px solid rgba(124, 196, 168, 0.35);
  color: var(--accent-300);
  font-size: 12px;
}

.row-actions { display: flex; gap: 8px; }
.icon-btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 92, 122, 0.14); border-color: rgba(255, 92, 122, 0.4); color: #ffb0c0; }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-2);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .card { padding: 28px 22px; }
  .row-2 { grid-template-columns: 1fr; }
}
