/* NX DISTRIB PWA — app.css */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

/* ── Variables ── */
:root {
  --bg:       #262626;
  --bg2:      #1e1e1e;
  --bg3:      #333333;
  --border:   #3a3a3a;
  --text:     #ffffff;
  --text2:    #b0b0b0;
  --text3:    #6e6e6e;
  --accent:   #f4f4ef;
  --primary:  #ffffff;
  --green:    #34c759;
  --red:      #ff3b30;
  --orange:   #ff9500;
  --header-h: 56px;
  --tab-h:    64px;
  --radius:   12px;
  --radius-sm:8px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg2);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── App shell ── */
#app {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Status bar ── */
.statusbar {
  height: 44px;
  background: var(--bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 11px;
  font-weight: 600;
}
.statusbar .time { font-size: 15px; font-weight: 700; }
.statusbar .icons { display: flex; gap: 6px; align-items: center; }

/* ── Header ── */
#header {
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}
#header.hidden { display: none; }
.header-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  font-size: 22px;
}
.header-back:hover { color: var(--text); }
.header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.header-action {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  font-size: 20px;
}

/* ── Screens ── */
.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tab-h) + 16px);
}
.screen.active { display: flex; flex-direction: column; }
.screen.no-tab { padding-bottom: 16px; }

/* ── Tab bar ── */
#tabbar {
  height: var(--tab-h);
  background: rgba(30,30,30,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar.hidden { display: none; }
.tab-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px 16px;
  color: var(--text3); font-size: 10px; font-weight: 600;
  letter-spacing: 0.2px; cursor: pointer; transition: color .2s;
}
.tab-item svg { width: 24px; height: 24px; }
.tab-item.active { color: var(--text); }

/* ── Splash ── */
#screen-splash {
  background: var(--bg2);
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.splash-logo { width: 140px; height: 140px; }
.splash-title {
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.5px; color: var(--text);
}
.splash-sub { font-size: 13px; color: var(--text2); font-weight: 500; }
.splash-loader {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-top: 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth screens ── */
.auth-wrap {
  flex: 1; padding: 32px 24px 24px;
  display: flex; flex-direction: column;
}
.auth-logo { width: 72px; height: 72px; margin-bottom: 24px; }
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text2); margin-bottom: 32px; }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 11px; font-weight: 700; color: var(--text2); margin-bottom: 8px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  width: 100%; padding: 14px 16px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 15px; font-family: inherit;
  outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: rgba(255,255,255,0.4); }
.form-input::placeholder { color: var(--text3); }
.btn-primary {
  width: 100%; padding: 16px;
  background: var(--text); color: var(--bg);
  border-radius: var(--radius); font-size: 15px;
  font-weight: 700; letter-spacing: -0.2px;
  transition: opacity .2s; margin-top: 8px;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; }
.btn-secondary {
  width: 100%; padding: 16px;
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 15px; font-weight: 600;
}
.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text2); }
.auth-switch a { color: var(--text); font-weight: 700; }
.form-error { color: var(--red); font-size: 12px; margin-top: 8px; }

/* ── Home ── */
.home-greeting {
  padding: 20px 20px 0;
  font-size: 22px; font-weight: 800; letter-spacing: -0.3px;
}
.home-greeting span { color: var(--text2); font-weight: 500; }
.section-title {
  font-size: 13px; font-weight: 700;
  color: var(--text2); text-transform: uppercase;
  letter-spacing: 0.8px; padding: 20px 20px 12px;
}
.section-header {
  display: flex; justify-content: space-between;
  align-items: center; padding: 20px 20px 12px;
}
.section-header .section-title { padding: 0; }
.see-all { font-size: 12px; color: var(--text2); font-weight: 600; }

/* Categories grid */
.cat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 0 20px;
}
.cat-card {
  background: var(--bg3); border-radius: var(--radius);
  padding: 16px; cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color .2s;
  display: flex; flex-direction: column; gap: 8px;
}
.cat-card:hover { border-color: rgba(255,255,255,0.2); }
.cat-icon { font-size: 24px; }
.cat-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.cat-count { font-size: 11px; color: var(--text3); font-weight: 500; }

/* Featured products scroll */
.products-scroll {
  display: flex; gap: 12px;
  padding: 0 20px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.products-scroll::-webkit-scrollbar { display: none; }
.prod-card-sm {
  min-width: 150px; background: var(--bg3);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
  flex-shrink: 0; transition: border-color .2s;
}
.prod-card-sm:hover { border-color: rgba(255,255,255,0.2); }
.prod-card-sm img {
  width: 150px; height: 150px;
  object-fit: cover; display: block;
  background: var(--bg2);
}
.prod-card-sm .prod-info { padding: 10px 12px 12px; }
.prod-card-sm .prod-name { font-size: 12px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.prod-card-sm .prod-cat { font-size: 10px; color: var(--text3); font-weight: 500; }

/* ── Search bar ── */
.search-bar {
  margin: 16px 20px;
  display: flex; align-items: center;
  background: var(--bg3); border-radius: var(--radius);
  padding: 12px 16px; gap: 10px;
  border: 1px solid var(--border);
}
.search-bar svg { color: var(--text3); flex-shrink: 0; }
.search-bar input {
  flex: 1; background: none; border: none;
  color: var(--text); font-size: 15px; outline: none;
}
.search-bar input::placeholder { color: var(--text3); }

/* ── Product list ── */
.prod-list { padding: 0 20px; display: flex; flex-direction: column; gap: 12px; }
.prod-row {
  display: flex; gap: 12px; background: var(--bg3);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color .2s;
}
.prod-row:hover { border-color: rgba(255,255,255,0.2); }
.prod-row img {
  width: 80px; height: 80px;
  object-fit: cover; flex-shrink: 0; background: var(--bg2);
}
.prod-row-info {
  flex: 1; padding: 12px 12px 12px 0;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.prod-row-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.prod-row-cat { font-size: 11px; color: var(--text3); font-weight: 500; }
.prod-row-badge {
  font-size: 10px; font-weight: 700;
  background: var(--border); color: var(--text2);
  padding: 2px 8px; border-radius: 20px;
  align-self: flex-start;
}

/* ── Product detail ── */
.prod-detail-img {
  width: 100%; aspect-ratio: 1;
  object-fit: cover; background: var(--bg2);
}
.prod-detail-body { padding: 20px; }
.prod-detail-cat { font-size: 11px; color: var(--text3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.prod-detail-name { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 12px; line-height: 1.2; }
.prod-detail-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 20px; }

/* Variations */
.variations-section { margin-bottom: 20px; }
.var-title { font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.var-chip {
  padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s; color: var(--text2);
}
.var-chip.selected {
  border-color: var(--text); color: var(--text);
  background: rgba(255,255,255,0.08);
}

/* Qty selector */
.qty-row {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.qty-label { font-size: 13px; font-weight: 600; }
.qty-ctrl { display: flex; align-items: center; gap: 16px; }
.qty-btn {
  width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text); cursor: pointer;
  background: var(--bg3); transition: border-color .2s;
}
.qty-btn:hover { border-color: var(--text); }
.qty-val { font-size: 18px; font-weight: 700; min-width: 24px; text-align: center; }

/* Add to quote btn */
.btn-add-quote {
  width: 100%; padding: 16px;
  background: var(--text); color: var(--bg);
  border-radius: var(--radius); font-size: 15px; font-weight: 700;
  transition: opacity .2s;
}
.btn-add-quote:disabled { opacity: 0.35; }

/* Similar products */
.similar-section { padding: 24px 20px 0; border-top: 1px solid var(--border); margin-top: 20px; }

/* ── Devis / Quote ── */
.devis-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 40px;
}
.devis-empty-icon { font-size: 48px; opacity: 0.3; }
.devis-empty-txt { font-size: 14px; color: var(--text2); font-weight: 600; text-align: center; }
.quote-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.quote-line {
  display: flex; gap: 12px; background: var(--bg3);
  border-radius: var(--radius); padding: 12px;
  border: 1px solid var(--border); align-items: center;
}
.quote-line img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg2); }
.quote-line-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.quote-line-name { font-size: 13px; font-weight: 700; }
.quote-line-var { font-size: 11px; color: var(--text3); }
.quote-line-qty { font-size: 12px; color: var(--text2); font-weight: 600; }
.quote-remove { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 18px; cursor: pointer; }
.quote-remove:hover { color: var(--red); }
.quote-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  background: var(--bg);
  position: sticky; bottom: 0;
}
.quote-total {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text2); margin-bottom: 12px;
}
.quote-total strong { color: var(--text); font-size: 15px; }
.btn-submit-quote {
  width: 100%; padding: 16px;
  background: var(--text); color: var(--bg);
  border-radius: var(--radius); font-size: 15px; font-weight: 700;
}

/* ── Compte ── */
.compte-header {
  padding: 24px 20px;
  display: flex; gap: 16px; align-items: center;
  border-bottom: 1px solid var(--border);
}
.compte-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; flex-shrink: 0;
}
.compte-name { font-size: 17px; font-weight: 700; }
.compte-email { font-size: 12px; color: var(--text3); margin-top: 2px; }
.compte-menu { padding: 8px 20px; }
.compte-item {
  display: flex; align-items: center;
  gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: opacity .15s;
}
.compte-item:last-child { border-bottom: none; }
.compte-item:hover { opacity: 0.8; }
.compte-item-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.compte-item-label { flex: 1; font-size: 14px; font-weight: 600; }
.compte-item-chevron { color: var(--text3); font-size: 18px; }
.compte-stat-row { display: flex; gap: 12px; padding: 16px 20px; }
.compte-stat {
  flex: 1; background: var(--bg3); border-radius: var(--radius);
  padding: 14px; text-align: center;
  border: 1px solid var(--border);
}
.compte-stat-num { font-size: 24px; font-weight: 800; }
.compte-stat-lbl { font-size: 11px; color: var(--text3); font-weight: 500; margin-top: 2px; }

/* ── Toast ── */
#toast {
  position: absolute; bottom: calc(var(--tab-h) + 16px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 20px; border-radius: 24px;
  font-size: 13px; font-weight: 700;
  white-space: nowrap; z-index: 999;
  opacity: 0; transition: all .3s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-line { height: 14px; margin-bottom: 8px; }
.skel-img { height: 150px; }

/* ── Misc ── */
.divider { height: 1px; background: var(--border); margin: 0 20px; }
.spacer { height: 20px; }
.badge-count {
  background: var(--red); color: #fff;
  border-radius: 50%; width: 18px; height: 18px;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: -4px; right: -4px;
}
.tab-icon-wrap { position: relative; display: inline-flex; }
.text-muted { color: var(--text2); }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.px-20 { padding: 0 20px; }
.py-20 { padding: 20px 0; }
.info-row {
  display: flex; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .lbl { color: var(--text2); }
.info-row .val { font-weight: 600; text-align: right; max-width: 60%; }
