/* =========================================================================
   RT SHOP — Velvet Magic OVERRIDE layer
   Charge design-system.css avant ce fichier. Override les classes existantes
   avec le nouveau look, en gardant les IDs/classes pour ne pas casser le JS.
   ========================================================================= */

/* === Reset background to new tokens === */
html, body {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family: var(--font-sans) !important;
}
body { overflow: auto; height: auto; }

/* === Screens === */
.screen {
  background: var(--bg);
  padding-top: var(--safe-top);
}

/* === Splash === */
#splash .splash-inner { gap: 40px; }
.spinner {
  width: 36px; height: 36px;
  border: 2.5px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* === Auth screens === */
#auth .auth-inner { padding: 40px 24px; gap: 16px; }
.auth-tag {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin: -8px 0 24px;
}

/* === Buttons (new pill, Honor flat) === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 24px;
  height: 52px;
  border-radius: var(--r-pill) !important;
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.01em;
  border: none;
  transition: transform var(--t-base) var(--ease-spring), background var(--t-base), box-shadow var(--t-base);
  width: 100%;
  font-family: inherit;
  cursor: pointer;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: var(--sh-warm) !important;
}
.btn-primary:active { background: var(--accent-hover) !important; }
.btn-primary:disabled { background: var(--text-dim) !important; box-shadow: none !important; }

.btn-google {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-hi) !important;
  box-shadow: var(--sh-1) !important;
}

.btn-ghost {
  background: transparent !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  font-weight: 500;
}

.btn-danger {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: var(--sh-warm) !important;
}

/* === Separator === */
.sep {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sep::before, .sep::after { background: var(--border); }

/* === Top bar (header global) === */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 14px 12px;
  display: flex; align-items: center; gap: 10px;
}
.back-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--text);
  font-weight: 400;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--t-base) var(--ease-spring);
}
.back-btn:active { transform: scale(0.92); }
.top-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* === Forms (floating label feel) === */
.form { padding: 24px 22px 32px; gap: 16px; }
.form label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form input {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.form input::placeholder { color: var(--text-dim); }
.form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.err {
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  min-height: 18px;
}

/* === OTP === */
.otp-inner { padding: 32px 24px; gap: 22px; }
.otp-intro { font-size: 14px; color: var(--text-muted); line-height: 1.55; text-align: center; }
.otp-intro strong {
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  display: block;
  margin-top: 6px;
}
.otp-boxes { display: flex; justify-content: center; gap: 8px; }
.otp-box {
  width: 46px; height: 56px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  font-size: 22px; font-weight: 700;
  color: var(--text);
  text-align: center;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-fast);
}
.otp-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}

/* === Home tabs container === */
#home { display: none; flex-direction: column; height: 100vh; height: 100dvh; }
#home.active { display: flex; }

/* === Header (gh-*) === */
.gh-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(var(--safe-top) + 12px) 16px 14px;
}
.gh-page-text .gh-page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.gh-page-text .gh-page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.gh-search-row { padding-top: 12px; }
.gh-search-bar {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t-base);
}
.gh-search-bar:active { background: var(--surface-3); }
.gh-search-mic {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}

/* === Tab bar — Liquid Glass Honor === */
.tab-bar {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(var(--safe-bottom) + 12px);
  height: 68px;
  background: rgba(255,255,255,0.78) !important;
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-3xl) !important;
  display: flex; align-items: center; justify-content: space-around;
  box-shadow: var(--sh-3);
  z-index: 100;
  transition: transform var(--t-base) var(--ease-spring);
}
.tab-bar.collapsed { transform: translateY(85px) scale(0.84); }
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  position: relative;
  transition: color var(--t-base);
  cursor: pointer;
  font-family: inherit;
}
.tab-btn svg {
  width: 22px; height: 22px;
  stroke-width: 2;
  transition: transform var(--t-base) var(--ease-spring);
}
.tab-btn.active { color: var(--accent); }
.tab-btn.active svg {
  transform: scale(1.18);
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}
.tab-btn.active::after {
  content: ""; position: absolute; bottom: -2px;
  width: 24px; height: 4px;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* === Tab content area: padding-bottom for floating tab bar === */
.tab-page .tab-content {
  padding-bottom: calc(68px + var(--safe-bottom) + 24px);
}

/* === Empty states === */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

/* === Profile card === */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px 20px;
  margin: 16px;
  text-align: center;
  box-shadow: var(--sh-1);
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px;
  font-weight: 700;
  box-shadow: var(--sh-warm);
}
.profile-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.profile-phone {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* === Update card === */
.update-card {
  margin: 0 16px 16px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-xl) !important;
  padding: 16px !important;
  box-shadow: var(--sh-1);
}
#btn-check-update {
  background: var(--accent) !important;
  color: #fff !important;
  border-radius: var(--r-pill) !important;
  font-weight: 600;
  padding: 8px 16px !important;
}

/* === Outils tab cards === */
.ot-wrap { padding: 16px 16px 0; }
.ot-intro { padding: 8px 4px 16px; }
.ot-intro-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.ot-intro-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.ot-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  margin-bottom: 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform var(--t-base) var(--ease-spring), border-color var(--t-base);
}
.ot-card:active { transform: scale(0.98); border-color: var(--border-warm); }
.ot-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.ot-card-body { flex: 1; min-width: 0; }
.ot-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ot-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.ot-card-arrow { color: var(--text-dim); flex-shrink: 0; }

/* === Tool inner pages === */
.ot-tool-wrap { display: flex; flex-direction: column; }
.ot-tool-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ot-back {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 22px; line-height: 1;
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.ot-tool-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}
.ot-tool-body { padding: 16px; }
.ot-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-1);
}
.ot-tool-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 8px; }
.ot-lbl {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 10px 0 6px;
}
.ot-tool-card input,
.ot-tool-card select,
.ot-tool-card textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.ot-tool-card input:focus,
.ot-tool-card select:focus,
.ot-tool-card textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.ot-result-ok {
  background: rgba(21,128,61,0.10);
  border: 1px solid rgba(21,128,61,0.20);
  color: var(--success);
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.55;
}
.ot-result-err {
  background: rgba(185,28,28,0.10);
  border: 1px solid rgba(185,28,28,0.20);
  color: var(--error);
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
}

/* === Tab bar fixes — override old CSS leakage === */
.tab-bar {
  padding: 0 !important;
  border-top: none !important;
  box-shadow: var(--sh-3) !important;
  flex-shrink: 1 !important;
}
.tab-btn { padding: 6px 4px !important; min-height: 100% !important; gap: 2px !important; }
.tab-btn span { font-size: 10px !important; line-height: 1.2 !important; }
/* Hide old ::before top indicator (vestige) */
.tab-btn::before { display: none !important; content: none !important; }
/* Re-assert our ::after bottom indicator */
.tab-btn.active::after {
  content: "" !important;
  position: absolute !important;
  bottom: 4px !important; top: auto !important; left: 50% !important;
  transform: translateX(-50%) !important;
  width: 24px !important; height: 3px !important;
  background: var(--accent) !important;
  border-radius: 999px !important;
  box-shadow: 0 0 10px var(--accent-glow) !important;
}

/* === Search row layout: input + AI button side by side === */
.gh-search-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding-top: 12px !important;
}
.gh-search-row .gh-search-bar {
  flex: 1;
  min-width: 0;
  display: flex !important;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px;
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--r-pill) !important;
  color: var(--text-muted) !important;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.gh-search-row .gh-search-bar:active { background: var(--surface-3) !important; }
.gh-search-row .gh-search-placeholder {
  flex: 1;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gh-ai-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: var(--sh-warm);
  transition: transform var(--t-base) var(--ease-spring), background var(--t-base);
}
.gh-ai-btn:active { transform: scale(0.96); background: var(--accent-hover); }
.gh-ai-btn span { letter-spacing: 0; }

/* === OBD Dashboard tiles === */
.dash-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:6px}
.dash-tile{background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:14px;position:relative;overflow:hidden}
.dash-label{font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.06em;margin-bottom:8px}
.dash-value{font-family:var(--font-mono,'Geist Mono',monospace);font-size:28px;font-weight:700;line-height:1;letter-spacing:-0.02em}
.dash-unit{font-size:12px;color:var(--text-muted);margin-top:4px}
.dash-bar{height:4px;background:rgba(0,0,0,0.05);border-radius:99px;margin-top:10px;overflow:hidden}
.dash-bar-fill{height:100%;border-radius:99px;transition:width .4s ease}

/* === COMPACT HEADER (v2.7) — proper grid, no overlap === */
.gh-topbar.gh-topbar--centered{
  position:relative;
  display:grid;
  grid-template-columns: 70px 1fr 50px;
  align-items:center;
  column-gap:10px;
  min-height:104px;
  padding:12px 14px 12px 14px;
  padding-top:calc(12px + env(safe-area-inset-top, 0px));
}
.gh-brand.gh-brand--split{
  grid-column:2;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:0;width:100%;min-width:0;
  text-align:center;
  align-self:center;
}
/* Logo circle in column 1 */
.gh-logo-circle{
  position:relative;
  grid-column:1;
  width:60px;height:60px;
  background:#fff;
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  box-shadow:
    0 6px 18px rgba(0,0,0,0.45),
    0 2px 6px rgba(0,0,0,0.30),
    0 0 0 1px rgba(255,255,255,0.08),
    inset 0 -1px 2px rgba(0,0,0,0.08);
  border:2px solid rgba(239,68,68,0.65);
  z-index:2;
  align-self:center;
  justify-self:start;
  margin-left:6px;
  animation:ghLogoFloat 4.5s ease-in-out infinite;
}
.gh-logo-circle::before{
  content:"";
  position:absolute;
  inset:-4px;
  border-radius:50%;
  border:2px solid rgba(239,68,68,0.9);
  pointer-events:none;
  animation:ghLogoPulse 2.4s ease-out infinite;
}
.gh-logo-circle::after{
  content:"";
  position:absolute;
  inset:-10px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(239,68,68,0.30) 0%, rgba(239,68,68,0) 65%);
  pointer-events:none;
  z-index:-1;
  animation:ghLogoHalo 3s ease-in-out infinite;
}
.gh-logo-circle .gh-logo--solid{
  animation:ghLogoBreathe 4.5s ease-in-out infinite;
}
.gh-logo.gh-logo--solid{
  width:48px !important;height:48px !important;
  max-width:48px !important;max-height:48px !important;
  object-fit:contain;
  background:transparent !important;
  padding:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
}
@keyframes ghLogoFloat{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-1.5px)}
}
@keyframes ghLogoPulse{
  0%{transform:scale(1);opacity:0.9;border-width:2px}
  70%{transform:scale(1.18);opacity:0;border-width:1px}
  100%{transform:scale(1.18);opacity:0}
}
@keyframes ghLogoHalo{
  0%,100%{opacity:0.55;transform:scale(1)}
  50%{opacity:1;transform:scale(1.10)}
}
@keyframes ghLogoBreathe{
  0%,100%{transform:scale(1)}
  50%{transform:scale(1.04)}
}
@media (prefers-reduced-motion: reduce){
  .gh-logo-circle, .gh-logo-circle::before, .gh-logo-circle::after, .gh-logo-circle .gh-logo--solid{animation:none !important}
}
.gh-text.gh-text--centered{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:2px;line-height:1.05;text-align:center;
  width:100%;min-width:0;
}
.gh-name.gh-name--horizon{
  font-family:'Orbitron','Geist',system-ui,sans-serif;
  font-size:clamp(16px, 5vw, 22px);
  font-weight:900;
  letter-spacing:0.14em;
  color:#fff;
  text-transform:uppercase;
  text-shadow:0 2px 8px rgba(0,0,0,0.4);
  padding-left:0.14em;
  white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;max-width:100%;
}
.gh-tag{
  font-family:'Orbitron','Geist',system-ui,sans-serif;
  font-size:clamp(7.5px, 2.4vw, 9px);
  font-weight:500;
  color:rgba(255,255,255,0.55);
  letter-spacing:0.28em;text-transform:uppercase;
  text-align:center;margin-top:2px;
  padding-left:0.28em;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;
}
.gh-rule{
  display:block;
  width:30px;height:2px;
  background:#ef4444;
  border-radius:2px;
  margin:5px auto 3px;
}
.gh-slogan{
  font-family:'Geist','Inter',system-ui,sans-serif;
  font-size:clamp(10px, 3vw, 11.5px);
  font-weight:600;
  color:rgba(255,255,255,0.78);
  letter-spacing:0.04em;text-align:center;
  white-space:nowrap;
}
.gh-stock{
  font-family:'Orbitron','Geist',system-ui,sans-serif;
  font-size:clamp(8.5px, 2.6vw, 10px);
  font-weight:700;
  color:#ef4444;
  letter-spacing:0.10em;text-align:center;
  text-transform:uppercase;
  margin-top:3px;
  padding-left:0.10em;
  white-space:nowrap;
}
.gh-bell-btn.gh-bell-btn--floating{
  position:relative;
  grid-column:3;
  align-self:center;
  justify-self:end;
}
/* Very small phones (<340px) */
@media (max-width: 340px){
  .gh-topbar.gh-topbar--centered{grid-template-columns: 56px 1fr 44px;column-gap:6px}
  .gh-logo-circle{width:50px;height:50px;margin-left:2px}
  .gh-logo.gh-logo--solid{width:38px !important;height:38px !important}
  .gh-rule{margin:3px auto 2px}
}

/* === Header bottom rounding + shadow (v2.9) === */
.gh-topbar.gh-topbar--centered{
  border-bottom-left-radius:22px;
  border-bottom-right-radius:22px;
  box-shadow:
    0 8px 22px rgba(0,0,0,0.28),
    0 4px 10px rgba(239,68,68,0.10);
  position:relative;
  z-index:5;
}
/* Make sure the wrap that contains topbar lets shadow escape */
.gh-wrap{overflow:visible}
