/* ============================================================
   OG Performance – Portail Client – Style partagé
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --orange: #e10600;
  --orange-dark: #b00500;
  --black: #161616;
  --dark: #111827;
  --card: #1f2937;
  --border: rgba(255,255,255,0.08);
  --gray: #6b7280;
  --white: #ffffff;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --sidebar-w: 240px;
}
html, body { height: 100%; font-family: var(--font); background: var(--black); color: var(--white); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===== APP LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--dark);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform 0.25s ease;
}

/* Barre mobile + overlay (masqués sur desktop) */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }
.mobile-menu-btn { background: none; border: none; color: #fff; cursor: pointer; display: inline-flex; padding: 0.25rem; }
.mobile-topbar-logo img { width: 120px; }
.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.sidebar-logo img { width: 160px; margin: 0 auto; }
.sidebar-logo-sub {
  display: inline-block;
  margin-top: 0.7rem;
  font-size: 0.66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--orange);
  background: rgba(225,6,0,0.10);
  border: 1px solid rgba(225,6,0,0.30);
  border-radius: 50px;
  padding: 0.25rem 0.85rem;
}
.sidebar-section {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--gray);
  padding: 1.2rem 1.25rem 0.5rem;
}
.sidebar nav { flex: 1; padding: 0.5rem 0; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem; font-weight: 500;
  color: rgba(255,255,255,0.65);
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.nav-item.active { background: rgba(225,6,0,0.12); color: var(--orange); }
.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .icon svg { width: 18px; height: 18px; display: block; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--gray);
}
.sidebar-user { font-weight: 600; color: var(--white); margin-bottom: 0.3rem; }
.sidebar-logout {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--gray); font-size: 0.8rem; margin-top: 0.5rem;
  transition: color 0.15s; cursor: pointer;
}
.sidebar-logout:hover { color: var(--orange); }

/* Main content */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; padding: 2rem 2.5rem;
  min-height: 100vh;
}
.page-title {
  font-size: 1.4rem; font-weight: 800; margin-bottom: 0.3rem;
}
.page-sub { font-size: 0.88rem; color: var(--gray); margin-bottom: 2rem; }

/* ===== CARDS ===== */
.card {
  background: var(--card); border-radius: 12px;
  border: 1px solid var(--border);
  padding: 1.5rem;
}
.card-title {
  font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem;
  padding-bottom: 0.75rem; border-bottom: 1px solid var(--border);
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: 0.84rem; font-weight: 600;
  margin-bottom: 0.45rem; color: rgba(255,255,255,0.85);
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--white); font-size: 0.92rem;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(225,6,0,0.15);
}
.form-input::placeholder { color: rgba(255,255,255,0.25); }
.form-select option { background: var(--card); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

.form-hint { font-size: 0.78rem; color: var(--gray); margin-top: 0.3rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem; border-radius: var(--radius);
  font-weight: 700; font-size: 0.9rem; cursor: pointer;
  border: none; font-family: var(--font);
  transition: background 0.2s, transform 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--white); }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-danger { background: #ef4444; color: var(--white); }
.btn-success { background: #22c55e; color: var(--white); }

/* ===== ALERTS ===== */
.alert {
  padding: 0.85rem 1rem; border-radius: var(--radius);
  font-size: 0.88rem; margin-bottom: 1.25rem;
  display: flex; align-items: flex-start; gap: 0.6rem;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }

/* ===== STATUS BADGE ===== */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem; border-radius: 50px;
  font-size: 0.75rem; font-weight: 700;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-waiting { color: #f59e0b; background: rgba(245,158,11,0.12); }
.badge-progress { color: #3b82f6; background: rgba(59,130,246,0.12); }
.badge-done   { color: #22c55e; background: rgba(34,197,94,0.12); }
.badge-cancel { color: #ef4444; background: rgba(239,68,68,0.12); }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left; padding: 0.65rem 1rem;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--gray);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--orange);
  background: rgba(225,6,0,0.05);
}
.upload-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.upload-label { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.35rem; }
.upload-hint { font-size: 0.78rem; color: var(--gray); }
.upload-selected { margin-top: 0.75rem; font-size: 0.82rem; color: var(--orange); font-weight: 600; }

/* ===== STEPS ===== */
.steps-nav {
  display: flex; gap: 0; margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.step-tab {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.5rem 0.75rem 0;
  font-size: 0.85rem; font-weight: 600;
  color: var(--gray); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.step-tab.active { color: var(--orange); border-color: var(--orange); }
.step-tab.done { color: #22c55e; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--border); color: var(--gray);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; flex-shrink: 0;
}
.step-tab.active .step-num { background: var(--orange); color: var(--white); }
.step-tab.done .step-num { background: #22c55e; color: var(--white); }

/* ===== CONFIGURATEUR ===== */
.config-grid { display: grid; grid-template-columns: 1fr 1fr 260px; gap: 1.25rem; }
@media(max-width:900px) { .config-grid { grid-template-columns: 1fr 1fr; } }
@media(max-width:600px) { .config-grid { grid-template-columns: 1fr; } }

.stage-item, .opt-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: rgba(255,255,255,0.03);
  cursor: pointer; margin-bottom: 0.4rem;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.stage-item:hover, .opt-item:hover { border-color: rgba(225,6,0,0.3); }
.stage-item.active { border-color: var(--orange); background: rgba(225,6,0,0.08); }
.opt-item.selected { border-color: var(--orange); background: rgba(225,6,0,0.08); }

.item-left { display: flex; align-items: center; gap: 0.65rem; }
.item-icon {
  width: 32px; height: 32px; border-radius: 6px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
  color: #cbd5e1; /* teinte uniforme des icônes (monochrome) */
}
.opt-item.selected .item-icon { color: var(--orange); } /* accent quand sélectionné */
.item-name { font-size: 0.86rem; font-weight: 500; }
.item-credits { font-size: 0.82rem; font-weight: 700; color: var(--orange); }

.result-card {
  background: var(--dark); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem;
  position: sticky; top: 1rem;
}
.result-big { font-size: 2.2rem; font-weight: 900; color: var(--orange); text-align: center; }
.result-sub { font-size: 0.75rem; color: var(--gray); text-align: center; margin-bottom: 1rem; }
.result-price { font-size: 1.8rem; font-weight: 900; text-align: center; }
.result-sep { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

.breakdown-row {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.65);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-credits { color: var(--orange); font-weight: 600; }

.cat-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--gray); margin: 1rem 0 0.5rem;
}

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem 1.5rem;
}
.stat-value { font-size: 2rem; font-weight: 900; color: var(--orange); }
.stat-label { font-size: 0.8rem; color: var(--gray); margin-top: 0.25rem; }

/* ===== MISC ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.text-orange { color: var(--orange); }
.text-gray { color: var(--gray); }
.text-sm { font-size: 0.82rem; }
.mt-1 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.text-right { text-align: right; }

@media(max-width:768px) {
  /* Barre mobile fixe avec hamburger */
  .mobile-topbar {
    display: flex; align-items: center; gap: 0.75rem;
    position: fixed; top: 0; left: 0; right: 0; height: 56px;
    background: var(--dark); border-bottom: 1px solid var(--border);
    z-index: 60; padding: 0 1rem;
  }
  /* Sidebar coulissante */
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); z-index: 48; /* sous la sidebar (50), au-dessus du contenu */
  }
  /* Contenu : place pour la barre en haut et la bulle crédits en bas */
  .main { margin-left: 0; padding: calc(56px + 1.25rem) 1rem 5.5rem; }
  .page-sub { margin-bottom: 1.25rem; }
}

/* ===== Bulle crédits (haut droite, espace client) ===== */
.credits-pill {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: rgba(20, 24, 33, .92);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: .45rem .55rem .45rem 1.1rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
}
.credits-count { font-size: .88rem; color: rgba(255,255,255,.85); white-space: nowrap; }
.credits-count strong { color: #fff; font-size: 1rem; }
.tarif-badge { display:inline-flex; align-items:center; gap:.3rem; font-size:.78rem; font-weight:800; white-space:nowrap; border-radius:50px; padding:.4rem .8rem; }
.tarif-badge.tarif-master { background: rgba(255,255,255,.07); color:#cbd5e1; border:1px solid rgba(255,255,255,.16); }
.tarif-badge.tarif-slave { background: rgba(34,197,94,.16); color:#22c55e; border:1px solid rgba(34,197,94,.45); }
.tarif-sep { width:1px; height:20px; background: var(--border); }
.credits-buy {
  background: var(--orange);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  padding: .5rem 1.1rem;
  border-radius: 50px;
  white-space: nowrap;
  transition: background .15s, transform .15s;
}
.credits-buy:hover { background: var(--orange-dark); transform: translateY(-1px); }
@media (max-width: 768px) {
  .credits-pill { top: auto; bottom: 1rem; left: 1rem; right: auto; padding: .4rem .5rem .4rem .9rem; gap: .5rem; }
  .credits-pill .tarif-badge, .credits-pill .tarif-sep { display: none; } /* compact sur mobile */
  .credits-count { font-size: .82rem; }
  .credits-buy { font-size: .78rem; padding: .45rem .9rem; }
}

/* ===== Bouton WhatsApp flottant ===== */
.wa-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 45;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  transition: transform .15s, box-shadow .15s;
}
.wa-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 10px 26px rgba(37,211,102,.5); }
.wa-fab svg { width: 32px; height: 32px; fill: #fff; }
@media (max-width: 768px) {
  .wa-fab { bottom: 1rem; right: 1rem; width: 52px; height: 52px; }
  .wa-fab svg { width: 30px; height: 30px; }
}
