/* ============================================================
   WiFi Grand'Anse — Global styles
   ============================================================ */
:root {
  --primary:        #2E4AD4;
  --primary-dark:   #2239B0;
  --green:          #2D7A3E;
  --green-light:    #C9E8D8;
  --peach:          #F5DCC8;
  --peach-text:     #B36D25;
  --bg:             #F4F4F8;
  --card:           #FFFFFF;
  --border:         #E5E7EB;
  --text:           #0F172A;
  --muted:          #64748B;
  --muted-bg:       #F1F5F9;
  --danger:         #DC2626;
  --danger-bg:      #FEE2E2;
  --blue-light:     #CFE0F0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0; color: var(--text); }
p { margin: 0; }

/* ------------- Forms ------------- */
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,74,212,.12);
}
.textarea { resize: vertical; min-height: 90px; }
.label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }

.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 40px; }
.input-icon-wrap .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }

/* ------------- Buttons ------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  transition: background .15s, transform .05s;
  font-family: inherit;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-lg { padding: 14px 18px; font-size: 16px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--muted-bg); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--muted-bg); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #1E5A2D; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 10px; }
.btn-icon { padding: 8px; border-radius: 10px; }

/* ------------- Cards / layout ------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.card-sm { padding: 14px; border-radius: 14px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; min-width: 0; }
.space-y > * + * { margin-top: 16px; }
.space-y-sm > * + * { margin-top: 10px; }

.text-sm { font-size: 12px; }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

/* ------------- Badges ------------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--muted-bg);
  color: var(--muted);
}

/* ------------- Tables ------------- */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data thead { background: #FAFAFC; }
table.data th, table.data td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.data thead th { font-weight: 500; color: var(--muted); font-size: 12px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(241,245,249,.5); }
@media (max-width: 800px) { .hide-md { display: none; } }
@media (max-width: 600px) { .hide-sm { display: none; } }

/* ------------- Alert / toast ------------- */
.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error   { background: var(--danger-bg); color: #991B1B; }
.alert-warn    { background: var(--peach); color: var(--peach-text); }
.alert-success { background: var(--green-light); color: var(--green); }
.alert-info    { background: var(--blue-light); color: var(--primary); }

/* ------------- Stat cards ------------- */
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.stat-icon.blue   { background: var(--blue-light);  color: var(--primary); }
.stat-icon.green  { background: var(--green-light); color: var(--green); }
.stat-icon.peach  { background: var(--peach);       color: var(--peach-text); }
.stat-icon.purple { background: #EDE9FE;            color: #6D28D9; }
.stat-icon.gray   { background: var(--muted-bg);    color: var(--muted); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; margin: 4px 0; }
.stat-subtitle { font-size: 11px; color: var(--muted); }

/* ------------- Admin layout ------------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-size: 14px; font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--muted-bg); color: var(--text); text-decoration: none; }
.nav-link.active { background: rgba(46,74,212,.10); color: var(--primary); }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; padding: 0 20px;
}
.topbar .menu-toggle { display: none; }
.page { padding: 24px; max-width: 1400px; }

@media (max-width: 1000px) {
  .sidebar { position: fixed; transform: translateX(-100%); transition: transform .25s; z-index: 50; }
  .sidebar.open { transform: translateX(0); }
  .topbar .menu-toggle { display: inline-flex; }
  .backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; }
  .backdrop.show { display: block; }
}

/* ------------- Portal (mobile-first captive) ------------- */
.portal-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, #fff 100%);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 30px 20px;
}
.portal-card {
  width: 100%; max-width: 440px;
}
.portal-icon-circle {
  width: 80px; height: 80px;
  border-radius: 24px;
  background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  margin: 30px auto 24px;
  box-shadow: 0 16px 32px -8px rgba(46,74,212,.45);
}
.portal-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; text-align: center; }
.portal-subtitle { font-size: 15px; color: var(--muted); text-align: center; margin-bottom: 30px; line-height: 1.5; }
.portal-foot { font-size: 12px; color: var(--muted); text-align: center; margin-top: 26px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 20px; cursor: pointer; background: none; border: 0;
  padding: 0;
}
.back-link:hover { color: var(--text); }

/* ------------- Modal / dialog ------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 18px;
  width: 100%; max-width: 540px;
  padding: 24px;
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }

/* ------------- Switch ------------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #CBD5E1; border-radius: 24px;
  transition: .2s;
}
.switch .slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ------------- Radio "card" / checkbox "card" ------------- */
.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  background: #fff;
}
.choice:hover { background: var(--muted-bg); }
.choice input { accent-color: var(--primary); width: 18px; height: 18px; }
.rating-btn {
  width: 48px; height: 48px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.rating-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ------------- Login layout ------------- */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  width: 100%; max-width: 420px;
}
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card p.sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
