/* main.css — Reset, base, utilitaires */

* {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%; height: 100dvh;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  transition: background 0.3s ease, color 0.3s ease;
  position: relative;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background: url('../assets/images/fabrics.png') no-repeat center;
  background-size: cover;
  opacity: 0.03; /* Très transparent comme demandé */
  pointer-events: none;
  z-index: -1;
}

h1, h2, h3, h4, h5, h6, .display {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
}

/* ─── APP SHELL ──────────────────────────────────────────────── */
#app {
  width: 100%; height: 100dvh;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ─── SCREEN ────────────────────────────────────────────────── */
.screen {
  display: none; flex-direction: column;
  flex: 1; overflow: hidden;
  position: absolute; inset: 0;
}
.screen.active { display: flex; }

/* ─── SCROLL ZONE ────────────────────────────────────────────── */
.scroll-zone {
  flex: 1;
  min-height: 0;        /* critique : permet au flex item de shrink → active l'overflow scroll */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.scroll-zone > * { flex-shrink: 0; } /* empêche les enfants de se comprimer */
.scroll-zone::before {
  content: "";
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 280px; height: 280px;
  background: url('../assets/icons/logo-mma.png') no-repeat center;
  background-size: contain;
  opacity: 0.035;
  filter: grayscale(1);
  pointer-events: none;
  z-index: -1;
}
.scroll-zone::-webkit-scrollbar { display: none; }

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex-shrink: 0;
  position: relative; z-index: 5;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }

.topbar-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--gold);
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.topbar-logo img { width: 28px; height: 28px; object-fit: contain; }

.topbar-info h1 {
  font-size: 16px; font-weight: 600;
  color: var(--text); line-height: 1.2;
}

.boutique-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--gold-dim); border: 1px solid var(--gold);
  font-size: 10px; color: var(--gold); font-weight: 600;
  letter-spacing: 0.3px; cursor: pointer; transition: all 0.2s;
}

.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  position: relative;
  overflow: hidden;
}
.icon-btn::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(184, 149, 42, 0.1);
  transition: width 0.5s ease-out, height 0.5s ease-out;
  pointer-events: none;
}
.icon-btn:active::before {
  width: 100%; height: 100%;
}
.icon-btn:active { transform: scale(0.92); border-color: var(--gold); }

/* ─── SEARCH BAR ─────────────────────────────────────────────── */
.search-bar {
  margin: 0 16px 14px;
  position: relative; flex-shrink: 0;
}
.search-bar input {
  width: 100%;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px 12px 42px;
  font-size: 14px; color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none; transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.search-bar input::placeholder { color: var(--text-3); }
.search-bar input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.search-icon {
  position: absolute; left: 14px;
  top: 50%; transform: translateY(-50%);
  color: var(--text-3);
}

/* ─── SECTION LABEL ──────────────────────────────────────────── */
.section-label {
  padding: 4px 20px 10px;
  font-size: 10px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-3); font-weight: 600;
}

/* ─── BOTTOM NAV ─────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: var(--nav-bg);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding-bottom: 12px;
  z-index: 100;
  display: none; /* caché par défaut, affiché après login */
}
.bottom-nav.visible { display: flex; }

.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: 14px;
  transition: all 0.2s;
  flex: 1;
}
.nav-item:active { background: var(--gold-dim); }
.nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: color 0.2s;
}
.nav-item.active .nav-icon { color: var(--gold); }
.nav-label {
  font-size: 10px; font-weight: 500; color: var(--text-3); transition: color 0.2s;
}
.nav-item.active .nav-label { color: var(--gold); font-weight: 600; }
.nav-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0; transition: opacity 0.2s;
  margin-top: 1px;
}
.nav-item.active .nav-dot { opacity: 1; }

/* ─── FAB ────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 92px; right: 20px;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--gold-glow), 0 2px 8px rgba(0,0,0,0.15);
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
  z-index: 99;
  display: none;
}
.fab.visible { display: flex; }
.fab:active { transform: scale(0.92); }
.fab svg { width: 24px; height: 24px; stroke: white; stroke-width: 2; fill: none; }

/* ─── UTILITIES ──────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-2); }
.text-error { color: #C0392B; }
.text-success { color: #27AE60; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 32px;
  text-align: center; gap: 12px;
}
.empty-icon { color: var(--text-3); margin-bottom: 4px; }
.empty-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 600; color: var(--text);
}
.empty-text { font-size: 13px; color: var(--text-3); line-height: 1.6; }

/* ─── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.3); }
}
@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.animate-fadeUp { animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; }
.animate-bounceIn { animation: bounceIn 0.5s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ─── BUTTON LOADING ─────────────────────────────────────────── */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.75;
}
.btn-loading::before {
  content: '';
  position: absolute;
  top: 50%; left: 14px;
  width: 14px; height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ─── FORM INPUT ERROR ───────────────────────────────────────── */
.form-input.input-error {
  border-color: #C0392B !important;
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1) !important;
}
.form-input-error-msg {
  font-size: 11px;
  color: #C0392B;
  margin-top: 4px;
  display: none;
}
.form-input-error-msg.visible { display: block; }

/* ─── LUXURY BACKGROUNDS ─────────────────────────────────────── */
.bg-luxury-login {
  background-color: #171513;
  background-image: 
    radial-gradient(at 0% 0%, rgba(184, 149, 42, 0.15) 0, transparent 50%), 
    radial-gradient(at 100% 100%, rgba(184, 149, 42, 0.1) 0, transparent 50%),
    linear-gradient(to bottom, rgba(23, 21, 19, 0.4), rgba(23, 21, 19, 0.85)),
    url('../assets/images/luxuryboutiqu.png');
  background-size: cover;
  background-position: center;
}

.bg-facade {
  background-color: #121212;
  background-image: 
    radial-gradient(at 0% 100%, rgba(184, 149, 42, 0.1) 0, transparent 50%),
    linear-gradient(to bottom, rgba(23, 21, 19, 0.5), rgba(23, 21, 19, 0.95)),
    url('../assets/images/facade.png');
  background-size: cover;
  background-position: center;
}
[data-theme="dark"] .bg-facade {
  background: linear-gradient(rgba(18, 18, 18, 0.9), rgba(18, 18, 18, 0.95)), url('../assets/images/facade.png') no-repeat center;
}

/* Fix mobile viewport height issues for footer */
.screen-with-footer {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden; /* clip les enfants pour que scroll-zone fonctionne */
}

.form-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

/* ─── SUPPORT BUTTON ─────────────────────────────────────────── */
.support-btn {
  position: fixed;
  bottom: 94px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 16px; font-weight: 700;
  font-family: 'Cormorant Garamond', serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 98;
  transition: all 0.2s;
}
.support-btn:active { transform: scale(0.92); border-color: var(--gold); color: var(--gold); }

/* ─── DESKTOP — app centrée, UX améliorée ───────────────────── */
@media (min-width: 600px) {

  /* Fond neutre derrière l'app */
  body {
    background: var(--bg-3);
  }
  body::before {
    opacity: 0.06;
  }

  /* App centrée comme une interface mobile */
  #app {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 80px rgba(0,0,0,0.1);
  }

  /* Bottom nav contrainte à la largeur de l'app */
  .bottom-nav {
    width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  /* FAB aligné avec le bord droit de l'app */
  .fab {
    right: calc(50% - 220px);
  }

  /* Scrollbar fine visible sur desktop */
  .scroll-zone::-webkit-scrollbar        { display: block; width: 4px; }
  .scroll-zone::-webkit-scrollbar-track  { background: transparent; }
  .scroll-zone::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 2px; }
  .scroll-zone::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

  /* Curseur texte sur les labels de formulaire */
  .form-label { cursor: default; user-select: none; }

  /* Support button sur desktop */
  .support-btn {
    bottom: 94px;
    right: calc(50% - 220px);
  }

  /* Hover states sur les cartes */
  .client-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--gold-glow);
    border-color: rgba(184,149,42,0.3);
  }
  .commande-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  }
}

/* ─── DESKTOP SIDEBAR ≥900px ─────────────────────────────────── */
@media (min-width: 900px) {

  /* Sidebar brand visible */
  #sidebar-brand {
    display: flex !important;
  }

  /* Nav devient sidebar verticale */
  .bottom-nav {
    flex-direction: column;
    width: 220px;
    height: 100dvh;
    top: 0; bottom: auto;
    left: 0; right: auto;
    border-top: none;
    border-right: 1px solid var(--border);
    border-left: none !important;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    transform: none !important;
    overflow-y: auto;
  }
  .bottom-nav.visible { display: flex; }

  /* Items horizontaux en sidebar */
  .nav-item {
    flex-direction: row;
    flex: none;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 2px 10px;
    gap: 12px;
    justify-content: flex-start;
  }
  .nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
  .nav-label { font-size: 14px; font-weight: 500; flex: 1; }
  .nav-dot { display: none; }
  .nav-item.active { background: var(--gold-dim); }
  .nav-item.active .nav-label { font-weight: 600; }

  /* App occupe le reste — seulement quand la sidebar est visible */
  #app {
    max-width: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: none !important;
  }
  body:has(.bottom-nav.visible) #app {
    width: calc(100vw - 220px) !important;
    margin: 0 0 0 220px !important;
  }

  /* FAB repositionné */
  .fab {
    right: 24px;
    bottom: 24px;
  }

  /* Support button repositionné */
  .support-btn {
    right: 80px;
    bottom: 24px;
  }

  /* Scrollbar visible desktop */
  .scroll-zone::-webkit-scrollbar { display: block; width: 4px; }
  .scroll-zone::-webkit-scrollbar-track { background: transparent; }
  .scroll-zone::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
}
