@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@300;400;500;600;700;800&family=Share+Tech+Mono:wght@400&display=swap');

/* ── Variables thème SOMBRE (défaut) ── */
:root {
  --bg:       #0a1a0f;
  --bg2:      #0d2015;
  --card:     #0f2418;
  --card2:    #122b1c;
  --border:   rgba(255,255,255,0.07);
  --border-a: rgba(52,211,153,0.3);

  --accent:   #34d399;
  --accent2:  #10b981;
  --accent-dim: rgba(52,211,153,0.12);

  --text:     #e2f0e8;
  --muted:    #6b9a7a;

  --green:    #34d399;
  --red:      #f87171;
  --orange:   #fb923c;
  --blue:     #60a5fa;

  --nav-h:    64px;
  --header-h: 52px;
  --font:     'Exo 2', sans-serif;
  --mono:     'Share Tech Mono', monospace;
  --r:        14px;
}

/* ── Thème CLAIR ── */
[data-theme="light"] {
  --bg:       #f0faf5;
  --bg2:      #e4f5ec;
  --card:     #ffffff;
  --card2:    #f5fbf7;
  --border:   rgba(0,0,0,0.08);
  --border-a: rgba(16,185,129,0.4);

  --accent:   #059669;
  --accent2:  #047857;
  --accent-dim: rgba(5,150,105,0.1);

  --text:     #0f2d1e;
  --muted:    #4a7a5e;

  --green:    #059669;
  --red:      #dc2626;
  --orange:   #d97706;
  --blue:     #2563eb;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── HEADER ── */
.app-header {
  position: sticky; top: 0; z-index: 200;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(10,26,15,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
[data-theme="light"] .app-header {
  background: rgba(240,250,245,0.92);
}

.header-brand {
  font-size: 1.05rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.header-clock {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--muted);
}

.header-right { display: flex; align-items: center; gap: 8px; }

/* Toggle thème */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
  transition: all 0.15s;
}
.theme-toggle:hover { border-color: var(--border-a); color: var(--accent); }

/* ── BOTTOM NAV MOBILE ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 0.62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: color 0.2s; position: relative;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent); }
.nav-item.active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 2px; background: var(--accent);
  border-radius: 0 0 2px 2px; box-shadow: 0 0 8px var(--accent);
}

/* ── SIDEBAR DESKTOP ── */
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .desktop-nav {
    position: fixed; left: 0; top: var(--header-h); bottom: 0;
    width: 210px; background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 16px 10px; gap: 3px; z-index: 100;
  }
  .body-with-sidebar { padding-left: 210px; }
}
@media (max-width: 767px) {
  .desktop-nav { display: none; }
}

.desktop-nav-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); padding: 10px 12px 5px;
}
.desktop-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--muted); font-size: 0.85rem; font-weight: 500;
  transition: all 0.15s; border: 1px solid transparent;
}
.desktop-nav-item:hover { background: var(--card2); color: var(--text); }
.desktop-nav-item.active {
  background: var(--accent-dim); color: var(--accent);
  border-color: var(--border-a);
}
.desktop-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.desktop-nav-footer {
  margin-top: auto; padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--muted);
}

/* ── PAGE CONTENT ── */
.page-content {
  padding: 16px 14px calc(var(--nav-h) + 16px);
}
@media (min-width: 768px) {
  .page-content { padding: 24px; }
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color 0.2s, background 0.3s;
}
.card:hover { border-color: rgba(52,211,153,0.15); }
.card.active-green { border-color: rgba(52,211,153,0.35); background: linear-gradient(135deg, #0f2a1a 0%, var(--card) 60%); }
.card.warn-orange  { border-color: rgba(251,146,60,0.35);  background: linear-gradient(135deg, #1f1508 0%, var(--card) 60%); }
.card.warn-red     { border-color: rgba(248,113,113,0.35); background: linear-gradient(135deg, #1f0808 0%, var(--card) 60%); }
[data-theme="light"] .card.active-green { background: linear-gradient(135deg, #dcfce7 0%, var(--card) 60%); }

/* ── SECTION TITLE ── */
.section-title {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin: 18px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── GRIDS ── */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
@media (min-width: 768px) {
  .grid-2 { gap: 14px; }
  .grid-3 { gap: 14px; }
  .grid-auto { gap: 14px; }
}

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 100px;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.on     { background: rgba(52,211,153,0.12);  color: var(--green);  border: 1px solid rgba(52,211,153,0.25); }
.badge.off    { background: rgba(107,154,122,0.1);  color: var(--muted);  border: 1px solid var(--border); }
.badge.live   { background: rgba(248,113,113,0.12); color: var(--red);    border: 1px solid rgba(248,113,113,0.25); }
.badge.live .dot { animation: blink 1s infinite; }
.badge.warn   { background: rgba(251,146,60,0.12);  color: var(--orange); border: 1px solid rgba(251,146,60,0.25); }
.badge.info   { background: rgba(96,165,250,0.12);  color: var(--blue);   border: 1px solid rgba(96,165,250,0.25); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; border: none;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.03em;
  cursor: pointer; transition: all 0.15s;
}
.btn-accent  { background: var(--accent); color: #030f07; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-ghost   { background: var(--card2); color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-danger  { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-full    { width: 100%; }
.btn-sm      { padding: 5px 12px; font-size: 0.75rem; border-radius: 7px; }
.btn-lg      { padding: 13px 24px; font-size: 0.92rem; }

/* ── FORM ── */
.form-group  { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label  { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.form-input  {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 0.9rem; color: var(--text);
  font-family: var(--font); outline: none; width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  color-scheme: dark;
}
[data-theme="light"] .form-input { color-scheme: light; }
.form-input:focus { border-color: var(--border-a); box-shadow: 0 0 0 3px rgba(52,211,153,0.1); }
.form-select { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 0.88rem; color: var(--text);
  font-family: var(--font); outline: none; width: 100%; cursor: pointer; color-scheme: dark; }

/* ── NOTICES ── */
.notice {
  padding: 11px 14px; border-radius: 10px; font-size: 0.84rem;
  margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px;
}
.notice.error   { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.2); color: #fca5a5; }
.notice.success { background: rgba(52,211,153,0.08);  border: 1px solid rgba(52,211,153,0.2);  color: #6ee7b7; }
.notice.info    { background: var(--accent-dim);       border: 1px solid var(--border-a);        color: var(--accent); }

/* ── ICON BTN ── */
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card2);
  color: var(--muted); display: inline-flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 0.85rem;
  text-decoration: none; transition: all 0.15s;
}
.icon-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--border-a); }

/* ── CAM THUMB ── */
.cam-thumb {
  position: relative; aspect-ratio: 16/9;
  background: var(--bg); overflow: hidden;
}
.cam-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; }
.cam-thumb:hover img { transform: scale(1.03); }
.cam-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--border); font-size: 2rem;
}

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 9px 12px; text-align: left; font-size: 0.68rem; font-weight: 700;
     text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
     border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; font-size: 0.84rem; border-bottom: 1px solid rgba(255,255,255,0.03); }
[data-theme="light"] td { border-bottom-color: rgba(0,0,0,0.04); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-dim); }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
.anim-1 { animation: fadeUp 0.35s ease both; }
.anim-2 { animation: fadeUp 0.35s 0.07s ease both; }
.anim-3 { animation: fadeUp 0.35s 0.14s ease both; }
.anim-4 { animation: fadeUp 0.35s 0.21s ease both; }
.anim-5 { animation: fadeUp 0.35s 0.28s ease both; }

/* ── UTILS ── */
.mono    { font-family: var(--mono); }
.cyan    { color: var(--accent); }
.muted   { color: var(--muted); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.68rem; }
.bold    { font-weight: 700; }
.upper   { text-transform: uppercase; letter-spacing: 0.08em; }
