/* ============================================================
   ParfumZONE — Feuille de styles personnalisée
   Boutique PWA de parfums en Haïti
   ============================================================ */

/* -------------------------------------------------------
   1. Propriétés CSS personnalisées (variables globales)
   ------------------------------------------------------- */
:root {
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: 20px;
  --amber-glow: rgba(245, 158, 11, 0.3);
}

/* -------------------------------------------------------
   0. Image d'arrière-plan du site
   ------------------------------------------------------- */
.site-background-image,
.site-background-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.site-background-image {
  z-index: 0;
  object-fit: cover;
  object-position: center center;
  background: #020617;
}

.site-background-overlay {
  z-index: 1;
  background:
    linear-gradient(rgba(2, 6, 23, 0.32), rgba(2, 6, 23, 0.48)),
    radial-gradient(circle at center, rgba(15, 23, 42, 0.04), rgba(2, 6, 23, 0.2));
}

main {
  position: relative;
  z-index: 2;
}

.site-brand {
  flex: 0 0 auto;
  white-space: nowrap;
}

.app-update-banner {
  position: fixed;
  z-index: 60;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem;
  color: #fff;
  background: #0f172a;
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 1rem;
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.35);
}

.app-update-banner.hidden {
  display: none;
}

.app-update-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.75rem;
}

.app-update-actions button {
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  font-weight: 700;
}

#app-update-reload {
  color: #111827;
  background: #fbbf24;
}

#app-update-dismiss {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.1);
}

.site-footer {
  display: block;
  width: 100%;
  margin-top: 2rem;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-footer .site-brand .text-white {
  color: #ffffff !important;
}

.site-footer .site-brand .text-amber-500 {
  color: #fbbf24 !important;
}

/* -------------------------------------------------------
   0b. Thème mobile clair
   ------------------------------------------------------- */
@media (max-width: 767px) {
  .app-update-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .app-update-actions {
    width: 100%;
  }

  .app-update-actions button {
    flex: 1;
  }

  html,
  body {
    min-height: 100%;
    background: #020617 !important;
  }

  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  #app {
    min-height: 100%;
    background: transparent !important;
  }

  body {
    color: #0f172a !important;
  }

  .site-background-overlay {
    display: block;
  }

  .site-background-overlay {
    z-index: 1;
    background: linear-gradient(
      rgba(2, 6, 23, 0.48),
      rgba(2, 6, 23, 0.66)
    );
  }

  #main-nav {
    background: #ffffff !important;
    border-bottom-color: #e2e8f0 !important;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
  }

  .site-brand {
    color: #0f172a !important;
    font-size: 1.15rem;
    text-shadow: none;
  }

  .site-brand .text-white {
    color: #0f172a !important;
  }

  #main-nav a,
  #main-nav button {
    color: #334155 !important;
  }

  #nav-menu {
    background: #ffffff !important;
    border-top-color: #e2e8f0 !important;
  }

  #nav-menu a {
    color: #334155 !important;
  }

  main {
    background: transparent;
  }

  .site-footer {
    background: rgba(2, 6, 23, 0.9);
    margin-top: 1rem;
  }

  main > .page {
    color: #ffffff;
  }

  .glass,
  .glass-light,
  .glass-hover {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    color: #0f172a;
  }

  .glass .text-white,
  .glass-light .text-white,
  .glass-hover .text-white {
    color: #0f172a !important;
  }

  .glass .text-slate-300,
  .glass .text-slate-400,
  .glass-light .text-slate-300,
  .glass-light .text-slate-400,
  .glass-hover .text-slate-300,
  .glass-hover .text-slate-400 {
    color: #475569 !important;
  }

  .flex {
    color: inherit;
  }
}

/* -------------------------------------------------------
   2. Classe .glass — carte avec effet verre dépoli
   ------------------------------------------------------- */
.glass {
  background: #ffffff;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  color: #0f172a;
}

/* -------------------------------------------------------
   3. .glass-light — variante plus légère
   ------------------------------------------------------- */
.glass-light {
  background: #ffffff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  color: #0f172a;
}

/* -------------------------------------------------------
   4. .glass-hover — effet lueur dorée au survol
   ------------------------------------------------------- */
.glass-hover {
  background: #ffffff;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  color: #0f172a;
}

.glass .text-white,
.glass-light .text-white,
.glass-hover .text-white {
  color: #0f172a !important;
}

.glass .text-slate-300,
.glass .text-slate-400,
.glass-light .text-slate-300,
.glass-light .text-slate-400,
.glass-hover .text-slate-300,
.glass-hover .text-slate-400 {
  color: #475569 !important;
}

.glass-hover:hover {
  box-shadow: 0 0 30px var(--amber-glow);
  border-color: rgba(245, 158, 11, 0.25);
}

/* -------------------------------------------------------
   5. Animations (keyframes)
   ------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--amber-glow); }
  50%      { box-shadow: 0 0 40px var(--amber-glow); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------
   6. Classes utilitaires d'animation
   ------------------------------------------------------- */
.fade-in {
  animation: fadeIn 0.5s ease-out both;
}

.slide-up {
  animation: slideUp 0.5s ease-out both;
}

.slide-in {
  animation: slideIn 0.3s ease-out both;
}

.float {
  animation: float 3s ease-in-out infinite;
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* -------------------------------------------------------
   7. Barre de défilement personnalisée (fine, discrète)
   ------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

/* -------------------------------------------------------
   8. Classe .page — conteneur de chaque vue
   ------------------------------------------------------- */
.page {
  min-height: calc(100vh - 5rem);
  padding: 1rem;
  transition: opacity 0.3s ease;
}

.page.hidden {
  display: none;
}

/* -------------------------------------------------------
   9. Styles des toasts (notifications éphémères)
   ------------------------------------------------------- */
.toast {
  animation: slideIn 0.3s ease-out;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.875rem;
  max-width: 22rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

/* -------------------------------------------------------
   10. Conteneur 3D — arrondi du canvas
   ------------------------------------------------------- */
#viewer-3d-container canvas {
  border-radius: 1rem;
}

/* -------------------------------------------------------
   11. Cartes de paiement (radio stylisé)
   ------------------------------------------------------- */
.payment-card {
  transition: all 0.3s ease;
  cursor: pointer;
}

.payment-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.payment-card.selected,
input[type="radio"]:checked + .payment-card,
input[type="radio"]:checked ~ .payment-card {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

/* -------------------------------------------------------
   12. Affichage du code OTP
   ------------------------------------------------------- */
.otp-code {
  font-family: 'Courier New', Courier, monospace;
  letter-spacing: 0.3em;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

/* -------------------------------------------------------
   13. Carte produit — effet survol
   ------------------------------------------------------- */
.product-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* -------------------------------------------------------
   14. Interface d'administration
   ------------------------------------------------------- */
.admin-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  color: #f8fafc;
  padding: 0.7rem 0.85rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-input:focus {
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.admin-input::placeholder {
  color: #64748b;
}

.admin-file-label {
  display: block;
  padding: 0.75rem;
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 0.75rem;
  background: rgba(245, 158, 11, 0.05);
  color: #cbd5e1;
  font-size: 0.875rem;
}

.admin-file-label span {
  display: block;
  color: #fbbf24;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.admin-file-label small {
  display: block;
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.72rem;
}

.admin-file-input {
  width: 100%;
  color: #cbd5e1;
  font-size: 0.8rem;
}

.admin-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.35);
}

.admin-status,
.admin-category {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-status { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.status-confirmed { background: rgba(20, 184, 166, 0.15); color: #5eead4; }
.status-preparing { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.status-in_delivery { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; }
.status-delivered { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.status-cancelled { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.admin-category { background: rgba(255, 255, 255, 0.08); color: #cbd5e1; }

.admin-action-btn,
.admin-save-stock {
  color: #fbbf24;
  transition: color 0.2s ease, background 0.2s ease;
}

.admin-action-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
}

.admin-action-btn:hover,
.admin-save-stock:hover { color: #fcd34d; }

.admin-delete-product {
  color: #fca5a5;
  transition: color 0.2s ease;
}

.admin-delete-product:hover {
  color: #fecaca;
}

.promo-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
}

.admin-stock-input {
  width: 4.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  padding: 0.4rem 0.5rem;
  text-align: center;
}

.admin-stock-input.stock-low {
  border-color: rgba(239, 68, 68, 0.65);
  color: #fca5a5;
}

.admin-note-input {
  width: 10rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
  padding: 0.4rem 0.5rem;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.875rem;
}

#page-admin {
  color: #f5f0e6;
}

#page-admin .glass,
#page-admin .glass-light,
#page-admin .glass-hover {
  background: rgba(15, 23, 42, 0.94) !important;
  border-color: rgba(245, 240, 230, 0.18) !important;
  color: #f5f0e6 !important;
}

#page-admin .glass .text-white,
#page-admin .glass-light .text-white,
#page-admin .glass-hover .text-white {
  color: #f5f0e6 !important;
}

#page-admin .text-slate-300,
#page-admin .text-slate-400,
#page-admin .text-slate-500,
#page-admin .text-slate-600,
#page-admin .glass .text-slate-300,
#page-admin .glass .text-slate-400,
#page-admin .glass-light .text-slate-300,
#page-admin .glass-light .text-slate-400,
#page-admin .glass-hover .text-slate-300,
#page-admin .glass-hover .text-slate-400,
#page-admin .empty-state {
  color: #e8dcc8 !important;
}

.admin-input::placeholder,
.admin-note-input::placeholder {
  color: #c4b8a5;
  opacity: 1;
}

.admin-file-label,
.admin-file-label small,
.admin-file-input,
.admin-note-input {
  color: #e8dcc8;
}

/* -------------------------------------------------------
   15. Styles d'impression
   ------------------------------------------------------- */
@media print {
  body {
    background: white !important;
    color: black !important;
  }

  #main-nav,
  #toast-container,
  .no-print,
  button:not(.print-include) {
    display: none !important;
  }

  .glass,
  .glass-light {
    background: white !important;
    border: 1px solid #ddd !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .page.hidden {
    display: none !important;
  }

  #page-confirmation {
    display: block !important;
  }

  * {
    color: black !important;
    text-shadow: none !important;
  }
}

/* -------------------------------------------------------
   15. Texte en dégradé doré
   ------------------------------------------------------- */
.gradient-text {
  background: linear-gradient(135deg, #f59e0b, #eab308);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* -------------------------------------------------------
   16. Bouton de filtre actif
   ------------------------------------------------------- */
.filter-btn {
  transition: all 0.25s ease;
  cursor: pointer;
}

.filter-btn.active {
  background: #f59e0b;
  color: #000;
}

.filter-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.15);
}

/* -------------------------------------------------------
   17. Sélecteur de quantité
   ------------------------------------------------------- */
.quantity-selector {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}

.quantity-selector button {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: #cbd5e1;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quantity-selector button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f59e0b;
}

.quantity-selector input {
  width: 3rem;
  height: 2.75rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: transparent;
  border: none;
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  outline: none;
  -moz-appearance: textfield;
}

.quantity-selector input::-webkit-outer-spin-button,
.quantity-selector input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* -------------------------------------------------------
   18. Transitions fluides pour éléments interactifs
   ------------------------------------------------------- */
a,
button,
input,
select,
textarea {
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.97);
}

/* -------------------------------------------------------
   19. Orbes décoratives du héros
   ------------------------------------------------------- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
}

/* -------------------------------------------------------
   20. Focus des champs de saisie (bordure ambrée)
   ------------------------------------------------------- */
.input-glass {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  color: #fff;
  padding: 0.75rem 1rem;
  outline: none;
  transition: all 0.25s ease;
  width: 100%;
}

.input-glass::placeholder {
  color: #64748b;
}

.input-glass:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Sélecteur <select> stylisé */
select.input-glass {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23cbd5e1' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

select.input-glass option {
  background: #0f172a;
  color: #fff;
}

/* Textarea stylisé */
textarea.input-glass {
  resize: vertical;
  min-height: 5rem;
}

/* -------------------------------------------------------
   21. Ajustements responsive (mobile)
   ------------------------------------------------------- */
@media (max-width: 640px) {
  .site-background-image,
  .site-background-overlay {
    width: 100vw;
    height: 100dvh;
  }

  #main-nav > div {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .site-brand {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
  }

  .site-brand svg {
    width: 0.85rem;
    height: 0.85rem;
  }

  .page {
    padding: 0.75rem;
  }

  .toast {
    max-width: calc(100vw - 2rem);
  }

  #viewer-3d-container {
    aspect-ratio: 1 / 1;
    max-height: 300px;
  }
}

@media (max-width: 768px) {
  /* Réduction de la taille des titres sur mobile */
  h1 {
    font-size: 1.75rem !important;
  }
}

/* -------------------------------------------------------
   22. Spinner de chargement
   ------------------------------------------------------- */
.spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* -------------------------------------------------------
   23. Comportement de défilement fluide
   ------------------------------------------------------- */
html {
  scroll-behavior: smooth;
}

/* -------------------------------------------------------
   24. Badge compteur du panier
   ------------------------------------------------------- */
.cart-badge {
  position: absolute;
  top: -0.375rem;
  right: -0.375rem;
  min-width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  line-height: 1;
  padding: 0 0.25rem;
}

/* -------------------------------------------------------
   25. Notes de parfum — séparateur vertical
   ------------------------------------------------------- */
.notes-divider {
  width: 1px;
  background: var(--glass-border);
  margin: 0 0.5rem;
}

/* -------------------------------------------------------
   26. Shimmer / squelette de chargement
   ------------------------------------------------------- */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
