/* T-Shop & T-Food — Design system mobile-only */
:root {
  --bg: #070708;
  --bg2: #0B0B0D;
  --surface: #111214;
  --surface2: #17181B;
  --orange: #FF5A00;
  --orange2: #FF7A1A;
  --gold: #F5C14A;
  --gold2: #FFD66B;
  --text: #FFFFFF;
  --muted: #B9B9B9;
  --success: #29C85A;
  --danger: #FF3B30;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,.45);
  --border-gold: rgba(245,193,74,.22);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
.tshop-body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

.desktop-gate {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.desktop-gate-inner { text-align: center; max-width: 420px; padding: 2rem; }
.gate-logo { width: 80px; border-radius: 16px; margin-bottom: 1rem; }

.mobile-shell {
  max-width: 430px; min-height: 100dvh; margin: 0 auto;
  background: var(--bg2);
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}

@media (min-width: 768px) {
  .desktop-gate.d-none { display: flex !important; }
  .mobile-shell { opacity: .3; pointer-events: none; filter: blur(2px); }
}
@media (max-width: 767px) {
  .desktop-gate { display: none !important; }
}

/* Splash client — fidèle maquette T-Shop / T-Food */
.splash-screen--client {
  position: relative;
  min-height: 100dvh;
  max-height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: #0a0a0c;
}

.splash-screen--client .splash-screen__image {
  display: block;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  object-fit: cover;
  object-position: center top;
  user-select: none;
  -webkit-user-drag: none;
}

.splash-screen--client .splash-screen__progress {
  position: absolute;
  left: 7.5%;
  right: 7.5%;
  bottom: calc(1.55rem + var(--safe-b));
  height: 3px;
  border-radius: 999px;
  background: transparent;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
}

.splash-screen--client .splash-screen__progress-fill {
  display: block;
  height: 100%;
  width: 32%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b8862a 0%, #ff7a1a 50%, #ffd66b 100%);
  box-shadow: 0 0 16px rgba(255, 122, 26, 0.75);
  animation: splashClientLoad 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  mix-blend-mode: screen;
  opacity: 0.95;
}

@keyframes splashClientLoad {
  0% { width: 32%; }
  100% { width: 100%; }
}

/* Ancien splash générique (autres portails) */
.splash-screen {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  background: linear-gradient(135deg, var(--bg) 55%, var(--orange) 55%);
  position: relative; overflow: hidden;
}
.splash-screen::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(125deg, transparent 40%, rgba(245,193,74,.08) 60%, transparent 80%);
}
.splash-top { padding: 2.5rem 1.5rem 0; position: relative; z-index: 1; }
.splash-top img { width: 72px; border-radius: 12px; }
.splash-bottom {
  margin-top: auto; padding: 2rem 1.5rem 3rem;
  display: flex; flex-direction: column; align-items: flex-end;
  position: relative; z-index: 1;
}
.splash-bottom img { width: 88px; border-radius: 14px; margin-bottom: 1rem; }
.splash-tagline {
  width: 100%; text-align: center;
  font-weight: 700; letter-spacing: .12em; font-size: .85rem;
  margin: 2rem 0 1rem; color: var(--gold);
}
.splash-bar {
  width: 100%; height: 4px; background: rgba(255,255,255,.1);
  border-radius: 4px; overflow: hidden;
}
.splash-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold2));
  border-radius: 4px;
  animation: loadBar 2.2s ease forwards;
}
@keyframes loadBar { to { width: 100%; } }

/* Auth */
.auth-screen { min-height: 100dvh; padding: 2rem 1.25rem; }
.auth-hero {
  text-align: center; padding: 1.5rem 0 2rem;
}
.auth-logos { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1.5rem; }
.auth-logos img { width: 64px; border-radius: 14px; box-shadow: var(--shadow); }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.form-control, .form-select {
  background: var(--surface2) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 48px;
  padding: .75rem 1rem;
}
.form-control:focus { border-color: var(--orange) !important; box-shadow: 0 0 0 3px rgba(255,90,0,.2) !important; }
.form-label { color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--orange));
  border: none; color: #111; font-weight: 700;
  min-height: 48px; border-radius: var(--radius-sm);
  width: 100%; padding: .75rem 1rem;
}
.btn-gold:hover { filter: brightness(1.08); color: #111; }
.btn-outline-gold {
  background: transparent;
  border: 1px solid var(--border-gold);
  color: var(--gold);
  min-height: 48px; border-radius: var(--radius-sm);
  width: 100%;
}
.btn-orange {
  background: linear-gradient(135deg, var(--orange), var(--orange2));
  border: none; color: #fff; font-weight: 600;
  min-height: 44px; border-radius: 12px;
}

/* App shell */
.app-header {
  padding: 1rem 1rem .5rem;
  background: linear-gradient(180deg, var(--surface) 0%, transparent 100%);
  position: sticky; top: 0; z-index: 100;
}
.app-header h1 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.app-header .sub { color: var(--muted); font-size: .8rem; }
.search-bar {
  background: var(--surface2);
  border-radius: 14px;
  padding: .6rem 1rem;
  display: flex; align-items: center; gap: .5rem;
  margin: .75rem 0;
  border: 1px solid rgba(255,255,255,.06);
}
.search-bar input {
  background: transparent; border: none; color: var(--text);
  flex: 1; outline: none; font-size: .9rem;
}

.toggle-shop {
  display: flex; background: var(--surface);
  border-radius: 14px; padding: 4px; margin-bottom: 1rem;
  border: 1px solid var(--border-gold);
}
.toggle-shop button {
  flex: 1; border: none; background: transparent;
  color: var(--muted); padding: .6rem; border-radius: 11px;
  font-weight: 600; font-size: .85rem;
}
.toggle-shop button.active {
  background: linear-gradient(135deg, var(--orange), var(--orange2));
  color: #fff;
}

.banner-promo {
  background: linear-gradient(135deg, rgba(255,90,0,.25), rgba(245,193,74,.15));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  position: relative; overflow: hidden;
}
.banner-promo::after {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 60%; height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,.06), transparent);
  transform: rotate(25deg);
}

.shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1.25rem; }
.shortcut {
  background: var(--surface); border-radius: 14px;
  padding: .75rem .25rem; text-align: center;
  border: 1px solid rgba(255,255,255,.05);
  font-size: .7rem; color: var(--muted);
  cursor: pointer;
}
.shortcut i { display: block; font-size: 1.25rem; color: var(--gold); margin-bottom: .25rem; }

.section-title { font-weight: 700; font-size: .95rem; margin: 1rem 0 .75rem; }

.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; padding-bottom: 6rem; }
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.05);
}
.product-card .img {
  height: 110px; background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--orange);
}
.product-card .img img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: .75rem; }
.product-card .name { font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
.product-card .desc { color: var(--muted); font-size: .7rem; line-height: 1.3; margin-bottom: .5rem; }
.product-card .row-price { display: flex; align-items: center; justify-content: space-between; }
.product-card .price { color: var(--gold); font-weight: 700; font-size: .9rem; }
.btn-add {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--orange));
  border: none; color: #111; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: rgba(17,18,20,.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-gold);
  display: flex; padding: .5rem .25rem calc(.5rem + var(--safe-b));
  z-index: 200;
}
.bottom-nav a, .bottom-nav button {
  flex: 1; background: none; border: none;
  color: var(--muted); text-align: center;
  font-size: .65rem; padding: .35rem;
  text-decoration: none;
}
.bottom-nav a.active, .bottom-nav button.active { color: var(--gold); }
.bottom-nav i { display: block; font-size: 1.25rem; margin-bottom: 2px; }

/* Cart & checkout */
.cart-item {
  display: flex; gap: .75rem; align-items: center;
  background: var(--surface); border-radius: 14px;
  padding: .75rem; margin-bottom: .5rem;
}
.cart-summary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border-gold);
  margin-top: 1rem;
}
.checkout-steps { display: flex; gap: .5rem; margin-bottom: 1rem; }
.checkout-steps span {
  flex: 1; text-align: center; padding: .5rem;
  background: var(--surface); border-radius: 10px;
  font-size: .75rem; color: var(--muted);
}
.checkout-steps span.active { background: var(--orange); color: #fff; font-weight: 600; }

.status-badge {
  display: inline-block; padding: .25rem .6rem;
  border-radius: 20px; font-size: .7rem; font-weight: 600;
}
.status-received { background: rgba(45,156,219,.2); color: #2D9CDB; }
.status-preparing { background: rgba(245,193,74,.2); color: var(--gold); }
.status-delivering { background: rgba(255,90,0,.2); color: var(--orange); }
.status-delivered { background: rgba(41,200,90,.2); color: var(--success); }
.status-cancelled { background: rgba(255,59,48,.2); color: var(--danger); }

#map, .map-box { height: 200px; border-radius: var(--radius); overflow: hidden; margin: 1rem 0; }

/* Manager */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid rgba(255,255,255,.05);
}
.kpi-card[data-go] {
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.kpi-card[data-go]:active {
  transform: scale(.98);
  border-color: rgba(255, 90, 0, .35);
  background: var(--surface2);
}
.kpi-card .val { font-size: 1.4rem; font-weight: 700; color: var(--gold); }
.kpi-card .lbl { font-size: .75rem; color: var(--muted); }

.order-row {
  background: var(--surface);
  border-radius: 14px;
  padding: .875rem;
  margin-bottom: .5rem;
  border-left: 3px solid var(--orange);
}
.order-row.admin-product-row { cursor: pointer; }
.admin-product-row__img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}
.admin-product-row__placeholder {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 1.1rem;
}
.admin-product-form__preview {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: 12px;
}
.admin-product-form__preview.admin-product-row__placeholder {
  max-height: 80px;
  width: 100%;
}

.swal-product-actions.btn-group {
  display: flex;
  gap: 0;
}
.swal-product-actions.btn-group .btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem .5rem;
  font-size: 1.15rem;
  border-radius: 0;
}
.swal-product-actions.btn-group .btn:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}
.swal-product-actions.btn-group .btn:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}
.swal-product-actions.btn-group .btn-outline-warning {
  color: #ffc107;
  border-color: rgba(255, 193, 7, .45);
}
.swal-product-actions.btn-group .btn-outline-danger {
  color: #dc3545;
  border-color: rgba(220, 53, 69, .45);
}
.swal-product-actions.btn-group .btn-outline-secondary {
  color: var(--muted);
  border-color: rgba(255, 255, 255, .15);
}

/* Driver */
.driver-stat { text-align: center; padding: 1rem; }
.online-toggle {
  width: 56px; height: 32px; border-radius: 16px;
  background: var(--surface2); border: none;
  position: relative; cursor: pointer;
}
.online-toggle.on { background: var(--success); }
.online-toggle::after {
  content: ''; position: absolute; top: 4px; left: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.online-toggle.on::after { transform: translateX(24px); }

.app-content { padding: 0 1rem 6rem; min-height: 60vh; }
.hidden { display: none !important; }
.text-muted-custom { color: var(--muted); }
.text-gold { color: var(--gold); }
.text-orange { color: var(--orange); }
.price-update { font-size: .7rem; color: var(--muted); margin-top: .5rem; }

.chat-bubble {
  max-width: 80%; padding: .6rem .85rem;
  border-radius: 14px; margin-bottom: .5rem;
  font-size: .85rem;
}
.chat-bubble.me { background: var(--orange); margin-left: auto; }
.chat-bubble.them { background: var(--surface2); }

.offline-badge {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  background: var(--danger); color: #fff;
  padding: .25rem 1rem; font-size: .75rem;
  border-radius: 0 0 8px 8px; z-index: 300;
  max-width: 430px; width: 100%; text-align: center;
}

.pwa-install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 398px;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem .85rem;
  background: rgba(23, 24, 27, .96);
  border: 1px solid rgba(255, 90, 0, .35);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .45);
  z-index: 400;
  backdrop-filter: blur(8px);
}
.pwa-install-banner__icon {
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
}
.pwa-install-banner__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.3;
}
.pwa-install-banner__text strong {
  color: #fff;
  font-size: .85rem;
}
.pwa-install-banner .btn-orange {
  flex-shrink: 0;
  padding: .4rem .75rem;
  font-size: .8rem;
  white-space: nowrap;
}
.pwa-install-dismiss {
  position: absolute;
  top: .35rem;
  right: .5rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: .15rem .25rem;
  cursor: pointer;
}
