/* ==========================================================================
   PricerHub — components
   ========================================================================== */

/* --- buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; line-height: 1;
  border: 1px solid transparent; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.12s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover { box-shadow: 0 4px 12px -2px rgba(37,99,235,0.45); }

.btn-secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-mute); }

.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-icon {
  width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }

/* --- cards ---------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* --- stat tiles ----------------------------------------------------------- */
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.tile::after {
  content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
  background: var(--accent); opacity: 0.9;
}
.tile.tile-best::after { background: var(--best); }
.tile.tile-amber::after { background: var(--st-pending); }
.tile.tile-violet::after { background: #7c3aed; }
.tile-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-mute); }
.tile-value { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1; }
.tile-value small { font-size: 15px; font-weight: 600; color: var(--text-dim); }
.tile-foot { font-size: 12px; color: var(--text-dim); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.tile-issuer { display: flex; align-items: center; gap: 9px; margin-top: 10px; }

/* --- badges & pills ------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.4;
}
.badge-neutral { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge-best { background: var(--best-soft); color: var(--best-text); border-color: var(--best-border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* status badges for quotes */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.st-received { color: var(--best-text); } .st-received .st-dot { background: var(--st-received); }
.st-pending  { color: #b45309; } .st-pending .st-dot { background: var(--st-pending); animation: pulse 1.1s ease-in-out infinite; }
.st-timeout  { color: var(--text-mute); } .st-timeout .st-dot { background: var(--st-timeout); }
.st-error    { color: var(--danger); } .st-error .st-dot { background: var(--st-error); }
[data-theme="dark"] .st-pending { color: var(--st-pending); }

@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }

/* --- issuer monogram ------------------------------------------------------ */
.issuer { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.mono-badge {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 11px;
  letter-spacing: -0.02em; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}
.mono-badge.sm { width: 24px; height: 24px; font-size: 9.5px; border-radius: 6px; }
.mono-badge.lg { width: 40px; height: 40px; font-size: 14px; border-radius: 10px; }
.issuer-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.issuer-sub { font-size: 11.5px; color: var(--text-mute); }

/* --- toasts --------------------------------------------------------------- */
.toast-wrap {
  position: fixed; top: 16px; right: 16px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s cubic-bezier(0.16,1,0.3,1);
}
.toast.success { border-left-color: var(--best); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--st-pending); }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: var(--best); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon, .toast.debug .toast-icon { color: var(--accent); }
.toast.warning .toast-icon { color: var(--st-pending); }
.toast-msg { font-size: 13px; color: var(--text); flex: 1; }
.toast-close { background: none; border: none; color: var(--text-mute); padding: 0; line-height: 1; font-size: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* --- empty states --------------------------------------------------------- */
.empty {
  text-align: center; padding: 48px 24px; color: var(--text-dim);
}
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 12px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-mute);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 15px; color: var(--text); font-weight: 650; }
.empty p { margin-top: 6px; font-size: 13px; max-width: 380px; margin-left: auto; margin-right: auto; }
.empty .btn { margin-top: 16px; }

/* --- meta list (key/value) ------------------------------------------------ */
.metalist { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: baseline; }
.metalist dt { color: var(--text-mute); font-size: 12.5px; }
.metalist dd { font-weight: 600; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

/* --- divider -------------------------------------------------------------- */
.hr { height: 1px; background: var(--border); border: none; margin: 16px 0; }

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1fr; place-items: center;
  padding: 24px; position: relative;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(37,99,235,0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(16,185,129,0.1), transparent 55%),
    #070b14;
}
.auth-grid-lines {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(rgba(148,163,184,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 80%);
}
.auth-card {
  width: 100%; max-width: 400px; position: relative; z-index: 1;
  background: rgba(17, 24, 39, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: 16px; padding: 32px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7);
  color: #e6eaf2;
}
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 8px; }
.auth-brand .sb-logo { width: 38px; height: 38px; font-size: 18px; }
.auth-wordmark { font-size: 21px; font-weight: 750; letter-spacing: -0.03em; color: #fff; }
.auth-wordmark span { color: var(--sb-accent); }
.auth-tag { text-align: center; color: #8a94a6; font-size: 13px; margin-bottom: 26px; }
.auth-card h1 { font-size: 18px; font-weight: 650; color: #fff; margin-bottom: 4px; }
.auth-sub { color: #8a94a6; font-size: 13px; margin-bottom: 22px; }
.auth-field { margin-bottom: 15px; }
.auth-field label { display: block; font-size: 12.5px; font-weight: 600; color: #cbd5e1; margin-bottom: 6px; }
.auth-input {
  width: 100%; padding: 11px 13px; border-radius: 9px;
  background: rgba(2,6,23,0.5); border: 1px solid rgba(148,163,184,0.18);
  color: #fff; font-size: 14px; transition: border-color 0.12s, box-shadow 0.12s;
}
.auth-input::placeholder { color: #5b6577; }
.auth-input:focus { outline: none; border-color: var(--sb-accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.18); }
.auth-error { color: #fca5a5; font-size: 12.5px; margin-top: 6px; }
.auth-nonfield {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5; font-size: 13px; padding: 10px 12px; border-radius: 9px; margin-bottom: 16px;
}
.auth-foot { text-align: center; margin-top: 20px; font-size: 13px; color: #8a94a6; }
.auth-foot a { color: var(--sb-accent); font-weight: 600; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 18px; }
.auth-links a { color: var(--sb-accent); font-size: 12.5px; }

.auth-demo {
  margin-top: 22px; padding: 14px; border-radius: 11px;
  background: rgba(2,6,23,0.4); border: 1px dashed rgba(148,163,184,0.2);
}
.auth-demo-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; margin-bottom: 10px; }
.auth-demo-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border-radius: 7px; cursor: pointer; transition: background 0.12s;
}
.auth-demo-row:hover { background: rgba(59,130,246,0.1); }
.auth-demo-role { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: rgba(59,130,246,0.15); color: #93c5fd; }
.auth-demo-mail { font-family: var(--font-mono); font-size: 12px; color: #cbd5e1; }

/* --- chart holder --------------------------------------------------------- */
.chart-holder { position: relative; height: 300px; width: 100%; }
.chart-holder canvas { max-width: 100%; }
.chart-holder.is-empty canvas { display: none; }
.chart-holder.is-empty::after {
  content: "Aucune donnée de tendance pour ce sous-jacent.";
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-mute); font-size: 13px; text-align: center; padding: 24px;
}
.chart-select {
  appearance: none; cursor: pointer;
  padding: 7px 30px 7px 11px; font-size: 12.5px; font-weight: 600;
  border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2393a0b2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}

/* --- auth "or" divider ---------------------------------------------------- */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: #64748b; font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: rgba(148,163,184,0.18); }
