:root {
  --primary: #FF5E13;
  --secondary: #005696;
  --bg-light: #F8F9FA;
  --card-bg: #FFFFFF;
  --text-dark: #1F2937;
  --text-muted: #6B7280;
  --radius: 16px;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
  padding-bottom: 90px;
}

/* SVG ICONS */
.icon-svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

/* HEADER RESPONSIVE */
header {
  background: #000;
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  max-width: 50%;
  flex-shrink: 1;
}

.brand img {
  height: 38px;
  max-width: 100%;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-socials {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-socials a {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.header-socials a:hover {
  color: var(--primary);
}

.user-profile-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.2s;
}

.user-profile-btn:active {
  transform: scale(0.95);
}

/* LAYOUT & SCREENS */
.container {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 16px;
}

.screen { display: none; }
.screen.active { display: block; }

/* BOTTOM NAVIGATION BAR */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  border-top: 1px solid #E5E7EB;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 99;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  width: 20%;
}

.nav-item.active {
  color: var(--primary);
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: 18px;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fav-badge {
  position: absolute;
  top: -4px;
  right: 18px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SEARCH & SUGGESTIONS */
.search-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: 30px;
  padding: 6px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: border-color 0.3s ease;
  gap: 8px;
}

.search-box:focus-within {
  border-color: var(--primary);
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  padding: 8px 0;
  font-size: 0.95rem;
  background: transparent;
}

.suggestions-box {
  position: absolute;
  top: 105%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 99;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.suggestions-box.active { display: block; }

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #F3F4F6;
  overflow: hidden;
}

.suggestion-item img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.suggestion-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* CATEGORIES FILTER */
.categories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 24px;
  scrollbar-width: none;
}

.category-btn {
  background: #E5E7EB;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.category-btn.active, .category-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* GRID PRODUITS — responsive Android / iPhone / tablette / ordinateur */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card {
    padding: 9px;
    border-radius: 12px;
  }

  .card-img-wrap {
    height: 150px;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card {
    padding: 8px;
  }

  .card-img-wrap {
    height: clamp(120px, 38vw, 155px);
  }

  .product-title {
    font-size: 0.82rem;
  }

  .special-price {
    font-size: 0.86rem;
  }
}

@media (min-width: 1200px) {
  .product-grid {
    gap: 18px;
  }
}

/* CARD PRODUIT */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
  height: 100%;
}

.card:hover { transform: translateY(-4px); }

.fav-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 2;
  color: var(--text-muted);
}

.fav-btn.active { color: var(--danger); }

.card-img-wrap {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  background: #F3F4F6;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 3px 0;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-height: 2.2em;
}

.prices {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  flex-wrap: wrap;
}

.special-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

.normal-price {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.btn-back-styled {
  background: white;
  border: 2px solid #FF5E13;
  color: var(--text-dark);
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* DÉTAILS PRODUIT */
.product-detail-container {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .product-detail-container { grid-template-columns: 1fr; }
}

.detail-img-wrap {
  width: 100%;
  height: 320px;
  border-radius: 16px;
  overflow: hidden;
  background: #F3F4F6;
}

.detail-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  word-break: break-word;
}

.detail-description {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 15px 0;
  word-break: break-word;
}

.selector-group { margin-bottom: 16px; }

.selector-title {
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.color-picker { display: flex; gap: 12px; flex-wrap: wrap; }

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.2s ease;
}

.color-option.active {
  border-color: #000;
  transform: scale(1.15);
}

.size-picker { display: flex; gap: 10px; flex-wrap: wrap; }

.size-option {
  border: 1px solid #E5E7EB;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
}

.size-option.active {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

.btn-add-big {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.2s;
}

.btn-add-big:hover { opacity: 0.9; }

.card-box {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  max-width: 600px;
  margin: 0 auto;
}

/* PANIER (CART) */
.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 20px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid #F3F4F6;
  padding-bottom: 12px;
}

.cart-item img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-item-info { 
  flex: 1; 
  min-width: 0;
}

.cart-item-info h4 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qty-controls { display: flex; align-items: center; gap: 8px; }

.qty-btn {
  background: #E5E7EB;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 10px;
}

.cart-summary { border-top: 1px solid #E5E7EB; padding-top: 15px; }

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 20px;
}

/* FORMULAIRES & BOUTONS D'ACTION */
.btn-primary-action {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  transition: opacity 0.2s;
}

.btn-primary-action:hover { opacity: 0.9; }

.btn-google {
  width: 100%;
  background: white;
  color: var(--text-dark);
  border: 1px solid #E5E7EB;
  padding: 12px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.btn-checkout {
  width: 100%;
  background: #25D366;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.form-group { 
  margin-bottom: 16px; 
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 6px;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: var(--primary);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* CHAMP DE MOT DE PASSE AVEC ICÔNE D'ŒIL */
.input-password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-password-wrapper input {
  padding-right: 42px;
}

.toggle-password-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid #E5E7EB;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-toggle-link {
  text-align: center;
  margin-top: 15px;
  font-size: 0.85rem;
  color: var(--secondary);
  cursor: pointer;
  font-weight: 600;
}

/* PROFIL UTILISATEUR */
.profile-option-btn {
  width: 100%;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  margin-bottom: 10px;
}

.profile-option-btn:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  transform: translateX(3px);
}

.profile-option-btn:active {
  transform: scale(0.98);
}

/* COMMANDES ET CARTE DE TICKET */
.order-card, .ticket-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px dashed #E5E7EB;
  padding-bottom: 6px;
}

.ticket-id {
  font-weight: 800;
  color: var(--secondary);
  font-size: 0.9rem;
}

.ticket-status {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-en_cours { background: #FEF3C7; color: #D97706; }
.status-executing, .status-exécuté { background: #D1FAE5; color: #059669; }
.status-canceled, .status-annulé { background: #FEE2E2; color: #DC2626; }
.status-delivred, .status-délivré { background: #E0E7FF; color: #4338CA; }

.ticket-details {
  font-size: 0.85rem;
  color: var(--text-dark);
  line-height: 1.4;
  word-break: break-word;
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-admin-action {
  flex: 1;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.75rem;
  cursor: pointer;
  color: white;
}

.btn-approve { background: var(--success); }
.btn-reject { background: var(--danger); }
.btn-deliver { background: var(--secondary); }

/* ADMIN SECTION */
.admin-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.admin-img-preview {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  margin-top: 8px;
  display: none;
  background: #F3F4F6;
}

.admin-img-preview.active {
  display: block;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 0.9rem;
}

.admin-table th, 
.admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

.admin-table th {
  background: #F8FAFC;
  color: var(--text-muted);
  font-weight: 700;
}

/* MODALE DE RÉINITIALISATION ET CUSTOM MODALS */
.custom-modal-overlay, #resetPasswordModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.custom-modal-overlay.active, #resetPasswordModal.active {
  display: flex !important;
}

.custom-modal-box {
  background: white;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.custom-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.btn-cancel-modal {
  flex: 1;
  background: #E2E8F0;
  color: var(--text-dark);
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

.btn-confirm-modal {
  flex: 1.5;
  background: #25D366;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* NOTIFICATIONS TOAST */
#toastContainer {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(17, 24, 39, 0.95);
  color: white;
  padding: 12px 22px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

/* EMPTY STATES & LOADERS */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg, 
.empty-state img {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.85rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

/* FOOTER & SOCIALS */
.social-btn-group {
  display: flex;
  gap: 12px;
  margin-top: 15px;
}

.social-link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  color: white;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9rem;
}

.btn-wa { background: #25D366; }
.btn-tt { background: #000000; }

footer {
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 30px;
  border-top: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-socials {
  display: flex;
  gap: 15px;
}

.footer-socials a {
  color: var(--text-dark);
  text-decoration: none;
}

/* AJISTEMAN ESPESYAL POU TI EKRAN (TELEFÒN) */
@media (max-width: 480px) {
  header {
    padding: 8px 12px;
  }

  .brand img {
    height: 28px;
  }

  .header-socials {
    gap: 8px;
  }

  .user-profile-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .user-profile-btn span {
    display: none;
  }
/* =========================================================
   ALLYSHOP.IA - CHAT MODERNE
   ========================================================= */

.ai-chat-screen {
  padding-bottom: 90px !important;
}

/* TITRE PAGE */
.ai-page-header {
  margin-bottom: 10px !important;
}

.ai-page-header h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 1.25rem;
  color: #005696;
}

.ai-page-header h2 i {
  color: #ff5e13;
}


/* =========================================================
   CHAT APP
   ========================================================= */

.ai-chat-app {
  width: 100%;
  max-width: 850px;
  height: calc(100vh - 180px);
  min-height: 500px;

  margin: 0 auto;

  display: flex;
  flex-direction: column;

  background: #ffffff;

  border: 1px solid #dbe3ea;
  border-radius: 16px;

  overflow: hidden;

  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.08);
}


/* =========================================================
   HEADER CHAT
   ========================================================= */

.ai-chat-header {
  flex-shrink: 0;

  height: 68px;

  padding: 10px 16px;

  background: #005696;

  display: flex;
  align-items: center;
  justify-content: space-between;

  color: white;
}


/* USER INFO */

.ai-chat-user {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* AVATAR */

.ai-avatar {
  width: 44px;
  height: 44px;

  border-radius: 50%;

  background: white;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  border: 2px solid rgba(255,255,255,0.8);
}

.ai-avatar img {
  width: 100%;
  height: 100%;

  object-fit: cover;
}


/* NAME */

.ai-name {
  font-size: 1rem;
  font-weight: 800;

  color: #ff5e13;

  line-height: 1.1;
}

.ai-name span {
  color: white;
}

.ai-name b {
  color: #ff5e13;
}


/* STATUS */

.ai-status {
  display: flex;
  align-items: center;

  gap: 5px;

  margin-top: 3px;

  font-size: 0.72rem;

  color: #d1fae5;
}

.ai-online-dot {
  width: 7px;
  height: 7px;

  background: #10b981;

  border-radius: 50%;

  box-shadow: 0 0 5px rgba(16,185,129,0.8);
}


/* HEADER MENU */

.ai-header-icon {
  width: 34px;
  height: 34px;

  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  color: rgba(255,255,255,0.85);

  cursor: pointer;
}


/* =========================================================
   MESSAGE AREA
   ========================================================= */

.ai-messages {

  position: relative;

  flex: 1;

  min-height: 0;

  overflow-y: auto;

  padding: 18px 14px 20px;

  display: flex;
  flex-direction: column;

  gap: 10px;

  background:
    linear-gradient(
      rgba(248,250,252,0.96),
      rgba(248,250,252,0.96)
    );

  scroll-behavior: smooth;
}


/* SCROLLBAR */

.ai-messages::-webkit-scrollbar {
  width: 5px;
}

.ai-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}


/* WATERMARK */

.ai-watermark {

  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  width: 180px;

  opacity: 0.035;

  pointer-events: none;

  z-index: 0;
}

.ai-watermark img {
  width: 100%;
  height: auto;
}


/* Tout contenu message au-dessus watermark */

.ai-messages > *:not(.ai-watermark) {
  position: relative;
  z-index: 1;
}


/* =========================================================
   BULLES MESSAGES
   ========================================================= */

/*
   Ces règles couvrent les différents styles
   que ton JavaScript peut générer.
*/

.ai-message,
.ai-bubble {
  max-width: 82% !important;

  padding: 10px 13px !important;

  border-radius: 15px !important;

  font-size: 0.94rem !important;

  line-height: 1.45 !important;

  word-wrap: break-word;

  overflow-wrap: anywhere;

  box-shadow: 0 1px 3px rgba(0,0,0,0.08);

  position: relative;
}


/* MESSAGE IA */

.ai-message.ai-message-ai,
.ai-bubble.ai-bubble-ai,
.ai-message.bot,
.ai-bubble.bot {

  align-self: flex-start !important;

  background: #ffffff !important;

  color: #1e293b !important;

  border: 1px solid #e2e8f0 !important;

  border-top-left-radius: 5px !important;
}


/* MESSAGE UTILISATEUR */

.ai-message.ai-message-user,
.ai-bubble.ai-bubble-user,
.ai-message.user,
.ai-bubble.user {

  align-self: flex-end !important;

  background: #dcfce7 !important;

  color: #1e293b !important;

  border: 1px solid #bbf7d0 !important;

  border-top-right-radius: 5px !important;
}


/* =========================================================
   TIMESTAMP
   ========================================================= */

.ai-message-time,
.ai-bubble-time {

  display: block;

  margin-top: 4px;

  font-size: 0.68rem !important;

  color: #94a3b8 !important;

  text-align: right;
}


/* =========================================================
   INPUT AREA
   ========================================================= */

.ai-input-area {

  flex-shrink: 0;

  background: #ffffff;

  border-top: 1px solid #e2e8f0;

  padding: 10px 12px 8px;
}


/* FORM */

.ai-input-form {

  display: flex;

  align-items: center;

  gap: 8px;

  width: 100%;
}


/* INPUT */

#aiChatInput {

  flex: 1;

  min-width: 0;

  height: 44px;

  padding: 0 14px;

  border: 1px solid #cbd5e1;

  border-radius: 22px;

  background: #f8fafc;

  color: #1e293b;

  font-size: 0.92rem;

  outline: none;

  transition: 0.2s ease;
}

#aiChatInput:focus {

  border-color: #005696;

  background: #ffffff;

  box-shadow: 0 0 0 3px rgba(0,86,150,0.08);
}

#aiChatInput::placeholder {
  color: #94a3b8;
}


/* SEND BUTTON */

.ai-send-button {

  flex-shrink: 0;

  width: 44px;
  height: 44px;

  border: none;

  border-radius: 50%;

  background: #ff5e13;

  color: white;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition: 0.2s ease;

  box-shadow: 0 3px 8px rgba(255,94,19,0.25);
}

.ai-send-button:hover {
  background: #e94e08;
  transform: scale(1.04);
}

.ai-send-button:active {
  transform: scale(0.94);
}

.ai-send-button i {
  font-size: 0.9rem;
}


/* HINT */

.ai-input-hint {

  text-align: center;

  margin-top: 5px;

  font-size: 0.65rem;

  color: #94a3b8;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

  .ai-chat-screen {
    padding-left: 8px !important;
    padding-right: 8px !important;

    padding-bottom: 75px !important;
  }


  .ai-page-header {
    padding: 8px 0 !important;
  }


  .ai-page-header h2 {
    font-size: 1.1rem;
  }


  .ai-chat-app {

    height: calc(100vh - 155px);

    min-height: 0;

    border-radius: 14px;

    box-shadow: 0 4px 18px rgba(0,0,0,0.07);
  }


  .ai-chat-header {
    height: 62px;

    padding: 8px 12px;
  }


  .ai-avatar {
    width: 40px;
    height: 40px;
  }


  .ai-name {
    font-size: 0.95rem;
  }


  .ai-messages {
    padding: 14px 9px 18px;

    gap: 8px;
  }


  .ai-message,
  .ai-bubble {

    max-width: 86% !important;

    padding: 9px 11px !important;

    font-size: 0.91rem !important;
  }


  .ai-input-area {
    padding: 8px 9px 7px;
  }


  #aiChatInput {
    height: 42px;

    font-size: 0.9rem;
  }


  .ai-send-button {
    width: 42px;
    height: 42px;
  }


  .ai-input-hint {
    font-size: 0.6rem;
  }
}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {

  .ai-chat-app {
    height: calc(100vh - 150px);
  }

  .ai-messages {
    padding-left: 7px;
    padding-right: 7px;
  }

  .ai-message,
  .ai-bubble {
    max-width: 90% !important;
  }

}
}


/* Allyshop improvements */
.checkout-summary-box { background:#F8FAFC; border:1px solid #E2E8F0; border-radius:12px; padding:12px; font-size:.9rem; }
.admin-stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; }
.admin-stat-card { background:#fff; border:1px solid #E2E8F0; border-radius:14px; padding:16px; text-align:left; box-shadow:0 2px 8px rgba(15,23,42,.05); }
.admin-stat-card .value { font-size:1.35rem; font-weight:800; margin-top:5px; }
button[disabled] { opacity:.6; cursor:not-allowed; }
@media (max-width:600px){ .admin-stats-grid{grid-template-columns:repeat(2,minmax(0,1fr));} }


/* ========================================
   ADMIN — SOURCE / PRÉVISUALISATION IMAGE
   ======================================== */
.admin-image-source-box {
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 12px;
  background: #F8FAFC;
}
.image-source-options {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}
.image-source-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.image-upload-status {
  min-height: 22px;
  margin-top: 8px;
  font-size: .85rem;
  font-weight: 600;
}
.image-upload-status.loading { color: #005696; }
.image-upload-status.success { color: #10B981; }
.image-upload-status.error { color: #EF4444; }
.image-upload-preview {
  margin-top: 10px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  text-align: center;
}
.image-upload-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
}
.toast-error { border-left: 4px solid #EF4444; }
.toast-warning { border-left: 4px solid #F59E0B; }

.cart-validation-notice{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;margin-bottom:12px;border:1px solid #F59E0B;border-radius:8px;background:#FFFBEB;color:#92400E;font-size:.86rem;}

/* Phase 3 + 4 Business / Allyshop.IA */
.quick-action-btn{border:1px solid #CBD5E1;background:#fff;color:#0F172A;border-radius:9px;padding:8px 11px;cursor:pointer;font-weight:700;font-size:.8rem}.form-grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.business-kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px}.business-kpi{background:#fff;border:1px solid #E2E8F0;border-radius:14px;padding:15px;text-align:left}.business-kpi i{color:#FF5E13}.business-kpi small{display:block;color:#64748B;margin-top:7px}.business-kpi strong{display:block;font-size:1.3rem;margin-top:4px}.promo-row{display:flex;justify-content:space-between;gap:10px;align-items:center;border:1px solid #E2E8F0;border-radius:10px;padding:10px;margin:8px 0}.promo-row small{display:block;color:#64748B}.promo-status{font-size:.68rem;padding:4px 7px;border-radius:99px;font-weight:800}.promo-status.on{background:#DCFCE7;color:#166534}.promo-status.off{background:#FEE2E2;color:#991B1B}.loyalty-hero{background:linear-gradient(135deg,#005696,#FF5E13);color:#fff;border-radius:16px;padding:20px;text-align:center}.loyalty-points{font-size:2.8rem;font-weight:900}.loyalty-progress{height:10px;background:rgba(255,255,255,.25);border-radius:99px;overflow:hidden;margin:14px 0}.loyalty-progress span{display:block;height:100%;background:#fff}.loyalty-row{display:flex;justify-content:space-between;padding:10px 0;border-bottom:1px solid #E2E8F0}.loyalty-row .plus{color:#059669}.loyalty-row .minus{color:#DC2626}.tracking-head{display:flex;justify-content:space-between;gap:12px}.tracking-timeline{margin:22px 0}.tracking-step{display:flex;gap:12px;min-height:62px;position:relative;color:#94A3B8}.tracking-step.done{color:#005696}.tracking-step.current{color:#FF5E13}.tracking-dot{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#F1F5F9;border:1px solid #CBD5E1}.tracking-step small{display:block;color:#64748B}.tracking-summary{background:#F8FAFC;border:1px solid #E2E8F0;border-radius:10px;padding:12px}.ticket-chip{background:#EFF6FF;color:#005696;padding:5px 9px;border-radius:99px;font-size:.75rem;font-weight:800}@media(max-width:600px){.form-grid-2{grid-template-columns:1fr}.promo-row,.tracking-head{flex-direction:column;align-items:flex-start}}

.ai-product-recommendations{align-self:flex-start;max-width:92%;background:#fff;border:1px solid #E2E8F0;border-radius:12px;padding:10px}.ai-product-recommendation-title{font-weight:800;color:#005696;margin-bottom:8px}.ai-product-recommendation-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.ai-product-card{border:1px solid #E2E8F0;background:#fff;border-radius:9px;padding:7px;text-align:left;cursor:pointer}.ai-product-card img{width:100%;height:90px;object-fit:contain;background:#F8FAFC;border-radius:6px}.ai-product-card span,.ai-product-card b{display:block;margin-top:4px}.ai-product-card span{font-size:.78rem}.ai-product-card b{font-size:.8rem;color:#FF5E13}@media(max-width:420px){.ai-product-recommendation-grid{grid-template-columns:1fr}}

/* ==========================================================
   UI PREMIUM — MODALES UNIFIÉES + CHOIX PERSONNALISÉS
   ========================================================== */
.custom-modal-overlay {
  background: rgba(15, 23, 42, .64) !important;
  backdrop-filter: blur(7px) saturate(110%);
  -webkit-backdrop-filter: blur(7px) saturate(110%);
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.custom-modal-box {
  position: relative;
  width: min(100%, 560px) !important;
  max-height: min(88dvh, 760px);
  overflow: auto;
  padding: 24px !important;
  border: 1px solid rgba(226,232,240,.95);
  border-top: 5px solid #FF5E13 !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 28px 70px rgba(15,23,42,.28), 0 8px 25px rgba(15,23,42,.14);
  -webkit-overflow-scrolling: touch;
}

.custom-modal-box h3,
.custom-modal-box h2 {
  color: #005696 !important;
  font-weight: 800;
  letter-spacing: -.02em;
}

.custom-modal-box input,
.custom-modal-box textarea,
.custom-modal-box select {
  min-height: 46px;
  border: 1px solid #CBD5E1 !important;
  border-radius: 11px !important;
  background: #fff;
  color: #0F172A;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.custom-modal-box input:focus,
.custom-modal-box textarea:focus,
.custom-modal-box select:focus {
  outline: none;
  border-color: #005696 !important;
  box-shadow: 0 0 0 3px rgba(0,86,150,.10);
}

.custom-modal-actions {
  gap: 10px !important;
}

.custom-modal-actions button {
  min-height: 46px;
  border-radius: 11px !important;
  font-size: .92rem;
  font-weight: 800;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}

.custom-modal-actions button:active { transform: scale(.98); }
.custom-modal-actions .btn-cancel-modal { background: #64748B !important; color: #fff !important; }
.custom-modal-actions .btn-confirm-modal { background: #FF5E13 !important; color: #fff !important; }

/* Tous les SELECT deviennent visuellement plus propres avant ouverture du choix custom. */
select {
  min-height: 42px;
  border-radius: 10px !important;
  cursor: pointer;
}

.choice-modal-box { max-width: 480px !important; padding: 22px !important; }
.choice-modal-header { justify-content: flex-start !important; text-align: left; margin-bottom: 16px !important; }
.choice-modal-header h3 { margin: 0 !important; }
.choice-modal-icon,
.pwa-install-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg,#FFF1E9,#EAF4FF);
  color: #FF5E13;
  font-size: 1.15rem;
}
.choice-modal-options { display: grid; gap: 8px; max-height: 58dvh; overflow: auto; padding: 2px; }
.choice-option {
  width: 100%;
  min-height: 54px;
  border: 1px solid #E2E8F0;
  background: #fff;
  color: #0F172A;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}
.choice-option:hover { border-color: #FF5E13; background: #FFF8F4; }
.choice-option.active { border-color: #FF5E13; background: #FFF4ED; color: #005696; box-shadow: 0 0 0 2px rgba(255,94,19,.08); }
.choice-option .choice-check { opacity: 0; color: #FF5E13; }
.choice-option.active .choice-check { opacity: 1; }
.choice-modal-actions { margin-top: 12px !important; }

/* Installation PWA */
.pwa-install-box { max-width: 520px !important; }
.pwa-install-header { justify-content: flex-start !important; text-align: left; align-items: center !important; }
.pwa-install-header h3 { margin: 0 0 4px !important; font-size: 1.25rem; }
.pwa-install-header p { margin: 0; color: #64748B; font-size: .88rem; line-height: 1.45; }
.pwa-install-instructions { margin-top: 18px; }
.pwa-install-card { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 14px; padding: 14px; }
.pwa-install-card strong { color: #005696; }
.pwa-install-steps { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.pwa-install-steps li { display: flex; align-items: flex-start; gap: 10px; color: #334155; font-size: .9rem; line-height: 1.4; }
.pwa-step-num { width: 25px; height: 25px; min-width: 25px; border-radius: 50%; display: grid; place-items: center; background: #005696; color: #fff; font-size: .75rem; font-weight: 800; }
.pwa-install-actions { margin-top: 18px !important; }

@media (max-width: 600px) {
  .custom-modal-overlay { padding: 10px !important; align-items: flex-end !important; }
  .custom-modal-box {
    width: 100% !important;
    max-height: 90dvh;
    padding: 18px !important;
    border-radius: 20px 20px 14px 14px !important;
    animation: modalSlideUp .22s ease-out;
  }
  .choice-modal-box, .pwa-install-box { max-width: 100% !important; }
  .custom-modal-header { gap: 10px !important; }
  .custom-modal-box h3 { font-size: 1.08rem; }
  .custom-modal-actions { flex-direction: row !important; }
  .custom-modal-actions button { min-width: 0; }
}

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

@media (min-width: 601px) {
  .custom-modal-box { animation: modalPop .22s ease-out; }
}

/* Respecte les écrans très petits et les claviers mobiles. */
@media (max-height: 600px) {
  .custom-modal-box { max-height: 94dvh; }
}

body.modal-open { overflow: hidden; touch-action: none; }


/* ==========================================================
   FIX CRITIQUE — POPUPS / MENUS TOUJOURS VISIBLES
   ========================================================== */
.custom-modal-overlay[style*="display: flex"],
.custom-modal-overlay.active,
#resetPasswordModal[style*="display: flex"],
#resetPasswordModal.active {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 10000 !important;
}

.custom-modal-overlay {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}

.custom-modal-overlay.active,
.custom-modal-overlay[style*="display: flex"] {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.custom-modal-box {
  pointer-events: auto !important;
  position: relative;
  z-index: 10001;
}

body.modal-open {
  overflow: hidden !important;
}

/* Le menu de choix doit toujours passer au-dessus des écrans/nav */
#choiceModal,
#pwaInstallModal,
#customAlertModal,
#customConfirmModal,
#resetPasswordModal,
#addReviewModal,
#cancelOrderModal,
#adminRefuseOrderModal,
#editProductSelectModal,
#sendMessageModal {
  z-index: 10000 !important;
}


/* ===== Allyshop invoice preview / HTML PDF V4 ===== */
/* Important: the global `header` rule makes backgrounds black. The receipt
   also uses a <header>, so reset those inherited storefront styles here. */
.allyshop-receipt-page .receipt-top{
  background:#fff !important;
  color:#0f172a !important;
  position:static !important;
  top:auto !important;
  margin:0 !important;
  padding:0 0 10px !important;
  box-shadow:none !important;
  border-bottom:3px solid #005696;
}
.allyshop-receipt-page .receipt-top h1,
.allyshop-receipt-page .receipt-top h2,
.allyshop-receipt-page .receipt-top h3,
.allyshop-receipt-page .receipt-top p{color:inherit;}
.allyshop-receipt-page .receipt-top .receipt-title-box h1{color:#005696;}

body.allyshop-invoice-open{overflow:hidden}
#allyshopInvoicePreview{position:fixed;inset:0;z-index:2147483000;display:flex;justify-content:center;background:rgba(15,23,42,.78)}
.allyshop-invoice-backdrop{position:absolute;inset:0}.allyshop-invoice-sheet{position:relative;z-index:1;width:min(100%,900px);height:100%;overflow:auto;background:#eef2f7}.allyshop-invoice-toolbar{position:sticky;top:0;z-index:10;min-height:58px;display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:#005696;color:#fff;box-shadow:0 2px 8px rgba(0,0,0,.18)}.allyshop-invoice-close,.allyshop-invoice-close-icon{border:0;background:transparent;color:#fff;cursor:pointer;font:inherit}.allyshop-invoice-close{display:inline-flex;gap:7px;font-weight:700}.allyshop-invoice-close-icon{font-size:28px}.allyshop-invoice-content{padding:20px 16px 45px}.allyshop-receipt-page{width:100%;max-width:794px;margin:auto;background:#fff;padding:22px;box-shadow:0 8px 30px rgba(15,23,42,.12);font-family:Arial,Helvetica,sans-serif;-webkit-print-color-adjust:exact;print-color-adjust:exact}.receipt-top{display:grid;grid-template-columns:1.2fr .8fr;gap:18px;border-bottom:3px solid #005696;padding-bottom:14px}.receipt-logo{display:block;width:280px;height:105px;object-fit:contain;object-position:left center}.receipt-tagline{font-size:14px;color:#005696;font-weight:700;margin:2px 0 10px}.receipt-highlights{display:flex;flex-wrap:wrap;gap:7px;font-size:9px;font-weight:700;color:#005696}.receipt-highlights span{padding:5px 7px;border-radius:7px;background:#eef6ff}.receipt-title-box{text-align:right}.receipt-title-box h1{margin:2px 0 8px;color:#005696;font-size:25px}.receipt-ticket{border:2px solid #ff5e13;border-radius:8px;padding:7px;color:#005696;font-size:11px}.receipt-ticket b{color:#ff5e13}.receipt-meta{display:grid;gap:5px;margin-top:9px;font-size:10px}.receipt-grid-two{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}.receipt-card,.receipt-table-card,.receipt-signature{border:1.5px solid #005696;border-radius:12px;overflow:hidden;background:#fff}.receipt-card-title{background:#005696;color:#fff;font-weight:800;font-size:11px;padding:8px 11px}.receipt-card-body{padding:9px 11px;font-size:10px;line-height:1.5}.receipt-card-body p{margin:4px 0}.receipt-status-grid{display:grid;grid-template-columns:1fr 1fr 1fr}.receipt-status-grid>div{padding:9px;border-right:1px solid #b9c9d9;text-align:center;font-size:9px}.receipt-status-grid>div:last-child{border-right:0}.receipt-status-grid small{display:block;color:#64748b;margin-bottom:4px}.receipt-status-grid strong{display:block;font-size:9px;color:#005696}.receipt-status-grid .status-ok{color:#159447}.delivery-card{margin-top:12px}.receipt-table-card{margin-top:12px}.receipt-products{width:100%;border-collapse:collapse;font-size:9px}.receipt-products th{background:#005696;color:#fff;padding:8px}.receipt-products td{padding:8px;border:1px solid #cbd5e1;vertical-align:top}.receipt-products th:nth-child(1){width:10%}.receipt-products th:nth-child(2){width:50%}.receipt-products th:nth-child(3),.receipt-products th:nth-child(4){width:20%}.receipt-products .qty{text-align:center;font-weight:800}.receipt-products .num{text-align:right;white-space:nowrap}.receipt-products .accent{color:#ff5e13;font-weight:800}.receipt-products small{display:block;color:#64748b;margin-top:2px}.receipt-bottom-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:12px}.summary-lines{padding:10px 12px;font-size:10px}.summary-lines>div{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px dotted #9ca3af}.summary-lines .grand-total{border-top:2px solid #005696;border-bottom:0;margin-top:4px;padding-top:10px;color:#ff5e13;font-size:13px;font-weight:900}.receipt-thanks{margin-top:10px;border:1px solid #d8e7f3;border-radius:10px;background:#f6fbff;padding:10px;text-align:center;display:grid;gap:3px;font-size:9px}.receipt-thanks strong{color:#ff5e13;font-size:12px}.history-card{min-height:185px}.receipt-timeline{padding:10px 12px;position:relative}.receipt-timeline:before{content:"";position:absolute;left:18px;top:16px;bottom:16px;width:2px;background:#cbd5e1}.receipt-timeline-item{position:relative;display:flex;gap:10px;padding:5px 0 7px;font-size:9px}.receipt-timeline-item .dot{width:11px;height:11px;border-radius:50%;background:#fff;border:3px solid #005696;z-index:1;margin-left:1px;margin-top:2px}.receipt-timeline-item.current .dot{border-color:#ff5e13}.receipt-timeline-item strong{display:block;color:#005696}.receipt-timeline-item small{display:block;color:#64748b;margin-top:2px}.receipt-signature{margin-top:10px;height:72px;padding:9px 12px;display:flex;flex-direction:column;justify-content:space-between;text-align:center;font-size:10px}.receipt-signature span{border-bottom:1px dotted #334155;width:70%;align-self:center}.receipt-footer-grid{display:grid;grid-template-columns:1.35fr .7fr 1fr;gap:10px;margin-top:12px}.receipt-contact,.receipt-note{border:1px solid #cbd5e1;border-radius:10px;padding:9px;font-size:8px;display:flex;gap:10px;align-items:center}.receipt-contact>div:last-child{display:grid;gap:2px}.receipt-contact b{color:#005696}.receipt-contact span{display:block}.receipt-code{min-width:74px;height:58px;display:grid;place-items:center;border:2px solid #005696;border-radius:8px;background:#eef6ff;color:#005696;font-weight:900;font-size:10px;text-align:center;padding:5px}.receipt-seal{border:2px dashed #005696;border-radius:50%;width:95px;height:95px;margin:auto;display:grid;place-items:center;text-align:center;color:#005696;font-weight:900;font-size:10px}.receipt-seal small{font-size:6px}.receipt-note{display:block}.receipt-note b{color:#005696;font-size:10px}.receipt-note p{margin:5px 0;line-height:1.4}.receipt-final-footer{margin-top:12px;background:linear-gradient(90deg,#ff5e13,#005696,#ff5e13);color:#fff;text-align:center;padding:9px;border-radius:8px;font-weight:900;font-size:11px}.receipt-actions-preview{max-width:794px;margin:14px auto 0;display:flex;gap:10px;justify-content:center}.allyshop-pdf-btn,.allyshop-print-btn{min-height:46px;border:0;border-radius:9px;padding:11px 18px;font-size:14px;font-weight:800;cursor:pointer}.allyshop-pdf-btn{background:#ff5e13;color:#fff}.allyshop-print-btn{background:#005696;color:#fff}@media(max-width:650px){.allyshop-invoice-content{padding:12px 8px 35px}.allyshop-receipt-page{padding:12px}.receipt-top,.receipt-grid-two,.receipt-bottom-grid,.receipt-footer-grid{grid-template-columns:1fr}.receipt-title-box{text-align:left}.receipt-logo{width:230px;height:90px}.receipt-table-card{overflow-x:auto}.receipt-products{min-width:600px}.receipt-actions-preview{flex-direction:column}.allyshop-pdf-btn,.allyshop-print-btn{width:100%}}@media print{body{background:#fff}.allyshop-invoice-toolbar,.receipt-actions-preview{display:none!important}.allyshop-invoice-sheet{width:100%;height:auto;overflow:visible;background:#fff}.allyshop-invoice-content{padding:0}.allyshop-receipt-page{max-width:none;margin:0;padding:0;box-shadow:none}}

/* Promotion spéciale */
.special-promotion-banner {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #FFB38A;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFF7F2, #EFF7FF);
  color: #0F172A;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.special-promotion-banner strong { color: #005696; }
.special-promotion-banner .promo-percent { color: #FF5E13; font-weight: 800; }
@media (max-width: 600px) {
  .special-promotion-banner { font-size: .9rem; padding: 12px; }
}

.allyshop-invoice-seals{display:flex;flex-wrap:wrap;gap:7px;margin:12px 0 18px}
.allyshop-seal{display:inline-flex;align-items:center;padding:5px 8px;border:1px solid #FF5E13;border-radius:6px;background:#FFF7F2;color:#005696;font-size:.72rem;font-weight:800}

/* Checkout payment selector */
.payment-option-card{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:15px;border:1px solid #E2E8F0;border-radius:14px;background:#fff;color:#0F172A;cursor:pointer;text-align:left;transition:.2s ease;box-shadow:0 4px 14px rgba(15,23,42,.05)}
.payment-option-card:hover,.payment-option-card.selected{border-color:#FF5E13;box-shadow:0 6px 18px rgba(255,94,19,.12);transform:translateY(-1px)}
.payment-option-card span{display:flex;flex-direction:column;gap:4px}.payment-option-card b{color:#005696;font-size:.95rem}.payment-option-card small{color:#64748B;font-size:.78rem}.payment-option-card i{color:#FF5E13}
.payment-selector-btn:hover{border-color:#FF5E13!important;background:#FFF8F4!important}
@media(max-width:600px){.payment-option-card{padding:13px}.payment-option-card b{font-size:.88rem}.payment-option-card small{font-size:.72rem}}
.payment-copy-btn{border:0;border-radius:8px;padding:8px 10px;background:#FFF1EA;color:#D94A0A;font-weight:700;font-size:.75rem;cursor:pointer;white-space:nowrap}.payment-copy-btn:hover{background:#FFE3D6}


/* ===== Commandes V3 — workflow professionnel, sans changement de structure ===== */
.order-management-card{background:#fff;border:1px solid #CBD5E1;border-radius:14px;padding:14px;margin:0 0 14px;box-shadow:0 3px 12px rgba(15,23,42,.05)}
.order-management-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;margin-bottom:10px}.order-management-head>div{display:flex;gap:7px;align-items:center;flex-wrap:wrap}.order-status-badge{display:inline-flex;padding:4px 8px;border-radius:999px;background:#EFF6FF;color:#005696;font-size:.72rem;font-weight:800}.order-management-client{display:grid;gap:3px;font-size:.82rem;color:#64748B;margin-bottom:10px}.order-management-client b{color:#1E293B;font-size:.92rem}.order-items-title{font-size:.82rem;font-weight:800;color:#005696;margin:8px 0}.order-items-summary{border:1px solid #E2E8F0;border-radius:10px;overflow:hidden}.order-item-row{display:flex;justify-content:space-between;gap:10px;padding:9px 10px;border-bottom:1px solid #E2E8F0}.order-item-row:last-child{border-bottom:0}.order-item-main{display:grid;gap:2px;min-width:0}.order-item-main b{font-size:.82rem;color:#1E293B}.order-item-main small{font-size:.72rem;color:#64748B}.order-item-price{font-weight:800;font-size:.78rem;white-space:nowrap;color:#005696}.order-items-empty{padding:10px;color:#94A3B8;font-size:.8rem}.order-management-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}.order-next-btn{background:#005696!important;color:#fff!important}.order-cancel-btn{background:#EF4444!important;color:#fff!important}.order-locked-note{display:flex;gap:7px;align-items:center;margin-top:10px;padding:9px 10px;border-radius:9px;background:#F8FAFC;border:1px solid #E2E8F0;color:#64748B;font-size:.76rem}.order-cancel-info{display:grid;gap:3px;margin-top:10px;padding:9px 10px;background:#FEF2F2;border:1px solid #FECACA;border-radius:9px;color:#991B1B;font-size:.78rem}.tracking-summary .order-items-summary{margin-top:10px}
@media(max-width:600px){.order-management-card{padding:11px}.order-management-head{align-items:flex-start}.order-item-row{padding:8px}.order-management-actions .quick-action-btn{flex:1;min-width:120px}}

/* ===== Receipt PDF one-page stabilization ===== */
@media print{
  @page{size:A4 portrait;margin:5mm}
  html,body{width:210mm;min-height:297mm;background:#fff !important}
  .allyshop-receipt-page{
    width:100% !important;
    max-width:none !important;
    padding:0 !important;
    margin:0 !important;
    box-shadow:none !important;
    font-size:8px !important;
  }
  .allyshop-receipt-page .receipt-top{
    padding-bottom:6px !important;
    border-bottom-width:2px !important;
  }
  .allyshop-receipt-page .receipt-logo{width:210px;height:72px}
  .allyshop-receipt-page .receipt-tagline{font-size:10px;margin:0 0 5px}
  .allyshop-receipt-page .receipt-highlights{gap:4px;font-size:6.8px}
  .allyshop-receipt-page .receipt-highlights span{padding:3px 5px}
  .allyshop-receipt-page .receipt-title-box h1{font-size:19px;margin:0 0 5px}
  .allyshop-receipt-page .receipt-ticket{padding:5px;font-size:8px;border-width:1.5px}
  .allyshop-receipt-page .receipt-meta{gap:2px;margin-top:5px;font-size:7.5px}
  .allyshop-receipt-page .receipt-grid-two,
  .allyshop-receipt-page .receipt-bottom-grid{gap:7px;margin-top:7px}
  .allyshop-receipt-page .receipt-card,
  .allyshop-receipt-page .receipt-table-card,
  .allyshop-receipt-page .receipt-signature{border-radius:7px;border-width:1px}
  .allyshop-receipt-page .receipt-card-title{font-size:7.5px;padding:5px 7px}
  .allyshop-receipt-page .receipt-card-body{padding:5px 7px;font-size:7.5px;line-height:1.25}
  .allyshop-receipt-page .receipt-card-body p{margin:2px 0}
  .allyshop-receipt-page .receipt-status-grid>div{padding:5px;font-size:7px}
  .allyshop-receipt-page .receipt-status-grid small{margin-bottom:2px}
  .allyshop-receipt-page .receipt-status-grid strong{font-size:7px}
  .allyshop-receipt-page .delivery-card,
  .allyshop-receipt-page .receipt-table-card{margin-top:7px}
  .allyshop-receipt-page .receipt-products{font-size:7px}
  .allyshop-receipt-page .receipt-products th{padding:5px}
  .allyshop-receipt-page .receipt-products td{padding:4px}
  .allyshop-receipt-page .receipt-products small{margin-top:1px}
  .allyshop-receipt-page .summary-lines{padding:5px 7px;font-size:7.5px}
  .allyshop-receipt-page .summary-lines>div{padding:3px 0}
  .allyshop-receipt-page .summary-lines .grand-total{padding-top:5px;font-size:10px}
  .allyshop-receipt-page .receipt-thanks{margin-top:6px;padding:5px;font-size:6.8px}
  .allyshop-receipt-page .receipt-thanks strong{font-size:8.5px}
  .allyshop-receipt-page .history-card{min-height:0}
  .allyshop-receipt-page .receipt-timeline{padding:5px 7px}
  .allyshop-receipt-page .receipt-timeline:before{left:12px;top:10px;bottom:10px}
  .allyshop-receipt-page .receipt-timeline-item{gap:6px;padding:2px 0 3px;font-size:6.8px}
  .allyshop-receipt-page .receipt-timeline-item .dot{width:7px;height:7px;border-width:2px;margin-left:1px}
  .allyshop-receipt-page .receipt-signature{height:48px;margin-top:6px;padding:5px 7px;font-size:7px}
  .allyshop-receipt-page .receipt-footer-grid{gap:7px;margin-top:7px}
  .allyshop-receipt-page .receipt-contact,
  .allyshop-receipt-page .receipt-note{padding:5px;font-size:6.5px;gap:6px}
  .allyshop-receipt-page .receipt-code{min-width:55px;height:40px;font-size:7px;border-width:1px}
  .allyshop-receipt-page .receipt-seal{width:64px;height:64px;font-size:7px;border-width:1.5px}
  .allyshop-receipt-page .receipt-seal small{font-size:4.5px}
  .allyshop-receipt-page .receipt-note b{font-size:7px}
  .allyshop-receipt-page .receipt-note p{margin:3px 0}
  .allyshop-receipt-page .receipt-final-footer{margin-top:7px;padding:6px;font-size:8px;border-radius:6px}
  .allyshop-invoice-toolbar,
  .receipt-actions-preview{display:none !important}
  .allyshop-invoice-sheet{width:100% !important;height:auto !important;overflow:visible !important;background:#fff !important}
  .allyshop-invoice-content{padding:0 !important}
  .receipt-top,.receipt-grid-two,.receipt-bottom-grid,.receipt-footer-grid{break-inside:avoid}
}


/* =========================================================
   ALLYSHOP V3 — NOTIFICATIONS & ADMIN CHAT RESPONSIVE
   ========================================================= */
#adminChatScreen .card-box { min-height: 420px; }
#adminChatMessagesBox { scrollbar-width: thin; }
#adminNotificationsListContainer > div,
#userNotificationsListContainer > div { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  #adminChatScreen.container { padding-left: 8px; padding-right: 8px; }
  #adminChatScreen .screen-header { margin-bottom: 8px; }
  #adminChatScreen .screen-header h2 { font-size: 1rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #adminChatScreen .card-box {
    height: calc(100vh - 150px) !important;
    min-height: 0 !important;
    padding: 8px !important;
    border-radius: 10px !important;
  }
  #adminChatMessagesBox {
    padding: 8px !important;
    margin-bottom: 8px !important;
    gap: 6px !important;
  }
  #adminToAdminChatForm { gap: 6px !important; }
  #adminChatInput { min-width: 0; font-size: 16px; }
  #adminToAdminChatForm button { min-width: 44px; }
  #adminNotificationsScreen .screen-header,
  #userNotificationsScreen .screen-header { gap: 6px; }
  #adminNotificationsScreen .screen-header h2,
  #userNotificationsScreen .screen-header h2 { font-size: 1.05rem; }
}

/* Global Allyshop action loading */
button.allyshop-loading,
input.allyshop-loading {
  opacity: .78;
  cursor: wait !important;
  pointer-events: none;
}
.allyshop-loading {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.allyshop-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: allyshop-spin .7s linear infinite;
}
@keyframes allyshop-spin { to { transform: rotate(360deg); } }


/* ALLYSHOP — menus popup premium et fidélité */
.choice-modal-box{background:linear-gradient(180deg,#ffffff 0%,#f8fafc 100%)!important;border:1px solid rgba(0,86,150,.10)!important;border-radius:22px!important;box-shadow:0 28px 70px rgba(15,23,42,.24)!important;overflow:hidden!important}
.choice-modal-header{padding:2px 2px 8px!important}
.choice-modal-icon{background:linear-gradient(135deg,#fff1e9 0%,#eaf4ff 100%)!important;border:1px solid rgba(255,94,19,.12);box-shadow:0 8px 22px rgba(0,86,150,.10)}
.choice-modal-header h3{font-size:1.08rem!important;font-weight:800!important;color:#0f172a!important}
.choice-modal-options{gap:9px!important;max-height:60dvh!important;padding:4px!important}
.choice-option{min-height:58px!important;border:1px solid #e2e8f0!important;border-radius:15px!important;background:#fff!important;box-shadow:0 3px 12px rgba(15,23,42,.045);transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease!important}
.choice-option:active{transform:scale(.985)}
.choice-option:hover,.choice-option.active{border-color:#ff5e13!important;background:linear-gradient(90deg,#fff8f4,#f7fbff)!important;box-shadow:0 7px 20px rgba(255,94,19,.10)!important}
.choice-option.active{color:#005696!important}
.choice-option .choice-check{font-size:.95rem}
.choice-modal-actions{padding-top:4px!important}
.choice-modal-actions .btn-cancel-modal{border:1px solid #e2e8f0;background:#f1f5f9!important;color:#475569!important;border-radius:13px!important}
#signupDepartment,#signupCommune{background:linear-gradient(135deg,#fff,#f8fbff);border:1px solid #dbe5ef!important;font-weight:700;color:#334155;box-shadow:0 4px 14px rgba(0,86,150,.06)}
#signupDepartment:focus,#signupCommune:focus{border-color:#ff5e13!important;box-shadow:0 0 0 4px rgba(255,94,19,.10)!important}
.loyalty-redeem-btn{border-radius:14px!important;font-weight:800!important;box-shadow:0 8px 22px rgba(37,211,102,.18);transition:.18s ease}
.loyalty-redeem-btn:disabled{opacity:.58;cursor:not-allowed;box-shadow:none;filter:grayscale(.15)}
.loyalty-redeem-btn.loyalty-ready{animation:loyaltyPulse 1.8s ease-in-out infinite}
@keyframes loyaltyPulse{0%,100%{box-shadow:0 8px 22px rgba(37,211,102,.16)}50%{box-shadow:0 10px 30px rgba(37,211,102,.32)}}

/* Petit indicateur de notification visible partout, même depuis la boutique */
.user-profile-btn { position: relative; }
.profile-notification-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #EF4444;
  border: 2px solid #fff;
  display: none;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(239,68,68,.12);
}
.profile-notification-dot.is-visible { display: block; }
