/* ══════════════════════════════════════════
   BidDown — Styles globaux
   ══════════════════════════════════════════ */

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --surface2: #22263a;
  --border:   #2e3350;
  --accent:   #3b82f6;
  --accent2:  #6366f1;
  --green:    #10b981;
  --red:      #ef4444;
  --amber:    #f59e0b;
  --text:     #f1f5f9;
  --muted:    #64748b;
  --muted2:   #94a3b8;
  --sidebar-w: 240px;
}

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

html, body {
  height: 100%;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Layout principal ── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  grid-column: 1 / -1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px;
  text-decoration: none; color: var(--text);
}
.topbar-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.topbar-spacer { flex: 1; }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted2);
}
.topbar-avatar {
  width: 32px; height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--accent);
}
.topbar-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(16,185,129,.12);
  border: 1px solid rgba(16,185,129,.25);
  color: var(--green);
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.topbar-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%; background: var(--green);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ── Sidebar ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-section {
  font-size: 10px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .8px; padding: 12px 8px 6px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--muted2); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: all .15s; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.sidebar-item:hover { background: var(--surface2); color: var(--text); }
.sidebar-item.active { background: rgba(59,130,246,.15); color: var(--accent); }
.sidebar-item .icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-spacer { flex: 1; }

/* ── Main content ── */
.main-content {
  overflow-y: auto;
  padding: 24px;
}

/* ── Page header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 12px; color: var(--muted2); margin-top: 2px; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 13px;
}
.card-body { padding: 20px; }

/* ── KPI cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; font-family: 'Courier New', monospace; }
.kpi-sub { font-size: 11px; color: var(--muted2); margin-top: 4px; }
.kpi-green { color: var(--green); }
.kpi-amber { color: var(--amber); }
.kpi-blue  { color: var(--accent); }
.kpi-red   { color: var(--red); }

/* ── Grilles ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .6px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 14px; font-size: 13px;
  border-bottom: 1px solid rgba(46,51,80,.5);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(59,130,246,.04); }

/* ── Badges / Tags ── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.tag-blue   { background: rgba(59,130,246,.15);  color: #93c5fd; border: 1px solid rgba(59,130,246,.2);  }
.tag-green  { background: rgba(16,185,129,.15);  color: #6ee7b7; border: 1px solid rgba(16,185,129,.2);  }
.tag-amber  { background: rgba(245,158,11,.15);  color: #fcd34d; border: 1px solid rgba(245,158,11,.2);  }
.tag-red    { background: rgba(239,68,68,.15);   color: #fca5a5; border: 1px solid rgba(239,68,68,.2);   }
.tag-gray   { background: rgba(100,116,139,.15); color: #94a3b8; border: 1px solid rgba(100,116,139,.2); }
.tag-purple { background: rgba(139,92,246,.15);  color: #c4b5fd; border: 1px solid rgba(139,92,246,.2);  }

/* ── Boutons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: none;
  cursor: pointer; font-family: Arial, sans-serif;
  font-size: 13px; font-weight: 600;
  transition: all .2s; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-success  { background: linear-gradient(135deg, var(--green), #059669); color: #fff; }
.btn-success:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-danger   { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,.25); }
.btn-ghost    { background: var(--surface2); color: var(--muted2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted2); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ── Formulaires ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--muted2); margin-bottom: 6px;
}
.form-group label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: Arial, sans-serif; font-size: 13px;
  outline: none; transition: border-color .2s;
  appearance: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--muted); }
.form-control[type=number] { font-family: 'Courier New', monospace; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 4px; display: none; }

/* ── Alertes ── */
.alert {
  padding: 12px 16px; border-radius: 8px;
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: rgba(59,130,246,.1);  border: 1px solid rgba(59,130,246,.25);  color: #93c5fd; }
.alert-success { background: rgba(16,185,129,.1);  border: 1px solid rgba(16,185,129,.25);  color: #6ee7b7; }
.alert-warning { background: rgba(245,158,11,.1);  border: 1px solid rgba(245,158,11,.25);  color: #fcd34d; }
.alert-error   { background: rgba(239,68,68,.1);   border: 1px solid rgba(239,68,68,.25);   color: #fca5a5; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s ease;
}
.modal-lg { max-width: 720px; }
@keyframes modalIn { from{opacity:0;transform:translateY(-16px)} to{opacity:1;transform:none} }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.modal-sub { font-size: 12px; color: var(--muted2); margin-bottom: 24px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Timer ── */
.timer-display {
  font-family: 'Courier New', monospace;
  font-size: 32px; font-weight: 700;
  color: var(--amber); letter-spacing: 3px;
}
.timer-display.urgent { color: var(--red); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.5} }

/* ── Progress bar ── */
.progress-wrap { background: var(--border); border-radius: 4px; height: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.pf-green { background: linear-gradient(90deg, var(--green), #34d399); }
.pf-blue  { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.pf-amber { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.pf-red   { background: linear-gradient(90deg, var(--red), #f87171); }

/* ── Avatar ── */
.avatar {
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.av-sm { width: 30px; height: 30px; font-size: 12px; }
.av-md { width: 38px; height: 38px; font-size: 14px; }
.av-blue   { background: rgba(59,130,246,.2);  color: var(--accent);  }
.av-green  { background: rgba(16,185,129,.2);  color: var(--green);   }
.av-amber  { background: rgba(245,158,11,.2);  color: var(--amber);   }
.av-purple { background: rgba(139,92,246,.2);  color: #a78bfa;        }
.av-red    { background: rgba(239,68,68,.2);   color: var(--red);     }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.vdivider { width: 1px; background: var(--border); align-self: stretch; }

/* ── Utilities ── */
.hidden { display: none !important; }
.text-muted  { color: var(--muted2); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-accent { color: var(--accent); }
.fw-bold { font-weight: 700; }
.mono { font-family: 'Courier New', monospace; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.w-full { width: 100%; }

/* ── Page login (pas de sidebar) ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 420px;
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px; justify-content: center;
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.login-title { font-size: 22px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--muted2); text-align: center; margin-bottom: 28px; }

/* ── Page enchères fournisseur ── */
.bid-layout { max-width: 960px; margin: 0 auto; padding: 24px; }
.bid-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
}
.bid-timer-block {
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 24px;
}
.my-position {
  background: linear-gradient(135deg, rgba(16,185,129,.08), rgba(59,130,246,.04));
  border: 1px solid rgba(16,185,129,.2);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  display: flex; gap: 24px; flex-wrap: wrap; align-items: center;
}
.pos-block { flex: 1; min-width: 120px; }
.pos-label { font-size: 10px; color: var(--muted2); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 4px; }
.pos-value { font-family: 'Courier New', monospace; font-size: 22px; font-weight: 700; }

/* ── Rang ── */
.rank-badge {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.rank-1 { background: rgba(16,185,129,.2);  color: var(--green); border: 1px solid rgba(16,185,129,.4); }
.rank-2 { background: rgba(245,158,11,.15); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.rank-3 { background: rgba(100,116,139,.15);color: var(--muted2);border: 1px solid var(--border); }
.rank-n { background: var(--surface2);      color: var(--muted); border: 1px solid var(--border); }

/* ── Historique enchères ── */
.bid-history-item {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid rgba(46,51,80,.4);
  font-size: 12px;
}
.bid-history-item:last-child { border-bottom: none; }
.bid-history-time { color: var(--muted); font-family: 'Courier New', monospace; font-size: 10px; flex-shrink: 0; width: 48px; margin-top: 2px; }
.bid-history-dot  { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }

/* ── Responsive basique ── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .grid2, .grid3, .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
