/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-body: #0a0a14;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(255, 255, 255, 0.7);
  --text-primary: #1a1a2e;
  --text-secondary: #3a3a5a;
  --border-color: rgba(0, 0, 0, 0.1);
  --accent: #00b894;
  --accent-hover: #00a381;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  --radius: 24px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html.dark {
  --bg-card: rgba(20, 20, 40, 0.88);
  --bg-input: rgba(40, 40, 70, 0.8);
  --text-primary: #f0f0f5;
  --text-secondary: #b0b0c8;
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin: 0;
  position: relative;
  overflow-x: hidden;
}

/* ===== FOND ANIMÉ ===== */
.background-waves {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: radial-gradient(circle at 20% 30%, #002b1f, #000000);
  overflow: hidden;
}

.wave {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform;
  animation: waveMove 20s infinite alternate ease-in-out;
}

.wave1 {
  width: 600px;
  height: 600px;
  top: -10%;
  left: -15%;
  animation-duration: 18s;
  background: radial-gradient(circle, rgba(0, 200, 150, 0.4), transparent 70%);
}
.wave2 {
  width: 800px;
  height: 800px;
  bottom: -20%;
  right: -20%;
  animation-duration: 22s;
  animation-delay: -5s;
  background: radial-gradient(circle, rgba(0, 150, 100, 0.3), transparent 70%);
}
.wave3 {
  width: 400px;
  height: 400px;
  top: 40%;
  left: 60%;
  animation-duration: 16s;
  animation-delay: -10s;
  background: radial-gradient(circle, rgba(0, 220, 170, 0.25), transparent 70%);
}
.wave4 {
  width: 900px;
  height: 900px;
  top: 10%;
  right: -30%;
  animation-duration: 25s;
  animation-delay: -3s;
  background: radial-gradient(circle, rgba(0, 130, 90, 0.2), transparent 70%);
}

@keyframes waveMove {
  0% { transform: translate(0,0) scale(1) rotate(0deg); }
  33% { transform: translate(40px,-30px) scale(1.1) rotate(5deg); }
  66% { transform: translate(-20px,40px) scale(0.9) rotate(-3deg); }
  100% { transform: translate(30px,-20px) scale(1.05) rotate(2deg); }
}

/* ===== CONTENU PRINCIPAL ===== */
.content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* ===== EN-TÊTE ===== */
.main-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  padding: 0 0.5rem;
  position: relative;
}

.brand-title {
  font-size: 4.5rem;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
.brand-title span {
  color: #00c89a;
  text-shadow: 0 0 40px rgba(0, 200, 154, 0.3);
}

.subtitle {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.85);
  max-width: 700px;
  line-height: 1.5;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin-top: 0.2rem;
}

.theme-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.theme-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}
html.dark .theme-btn {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

.logistics-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
.logistics-form .form-group select {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
}
@media (max-width: 780px) {
  .logistics-form {
    grid-template-columns: 1fr;
  }
}

/* ===== LISTE DES ARTICLES ===== */
.products-section {
  width: 100%;
  margin: 0.5rem 0 1.5rem 0;
}
.products-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: 1rem;
  text-align: center;
}
.products-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.products-scroll {
  display: flex;
  gap: 1.2rem;
  overflow-x: auto;
  padding: 0.8rem 0.5rem 1.5rem 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  cursor: grab;
  user-select: none;
}
.products-scroll.active { cursor: grabbing; }
.products-scroll::-webkit-scrollbar { display: none; }

.scroll-btn {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: var(--transition);
  flex-shrink: 0;
}
.scroll-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.scroll-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.product-item {
  flex: 0 0 200px;
  scroll-snap-align: start;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  padding: 0.8rem;
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.product-item:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--accent);
}
.product-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(0, 200, 154, 0.2);
}
.product-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
}
.product-item .product-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* ===== BLOC UNIQUE DE PERSONNALISATION ===== */
.main-customization {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.custom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.8rem;
}
html.dark .custom-header {
  background: rgba(255, 255, 255, 0.03);
}

.custom-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Petit bouton d'import du logo */
.import-logo-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.import-logo-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}
.import-logo-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.import-logo-btn i {
  font-size: 1rem;
}

.custom-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
  padding: 1.8rem;
}

/* Aperçu */
.preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}
.preview-image {
  position: relative;
  width: 100%;
  max-width: 350px;
  aspect-ratio: 1/1;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--border-color);
  overflow: hidden;
}
.preview-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 70%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  display: none;
  transition: transform 0.1s;
}
.file-preview-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  background: var(--bg-input);
  padding: 0.3rem 1rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

/* Zone des contrôles */
.controls-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  justify-content: center;
}
.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 1rem;
}
.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.option-group label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.color-options {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.color-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.color-circle:hover {
  transform: scale(1.1);
}
.color-circle.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}
.color-circle.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.size-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.size-btn {
  padding: 0.3rem 0.9rem;
  border: 2px solid var(--border-color);
  border-radius: 30px;
  background: var(--bg-input);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
  color: var(--text-primary);
}
.size-btn:hover {
  border-color: var(--accent);
}
.size-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.size-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-input);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
#qtyInput {
  width: 55px;
  text-align: center;
  padding: 0.3rem;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-input);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
#qtyInput:focus {
  outline: none;
  border-color: var(--accent);
}

/* Contrôles du logo */
.logo-controls-row {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}
.logo-size-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo-size-group label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 90px;
}
.logo-size-group input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.position-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.pos-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  font-size: 0.85rem;
}
.pos-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== SECTIONS COMMUNES ===== */
.section {
  width: 100%;
}
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 1.8rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}
.section-title i {
  color: var(--accent);
}

/* Instructions */
textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  background: var(--bg-input);
  color: var(--text-primary);
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 200, 154, 0.15);
}

/* ===== LOGISTIQUE (nouvelle version) ===== */
.logistics-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
.logistics-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.logistics-form .form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.logistics-form .form-group select {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: 0.2s;
}
.logistics-form .form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 200, 154, 0.15);
}
@media (max-width: 780px) {
  .logistics-form {
    grid-template-columns: 1fr;
  }
}

/* Formulaire */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group.full-width {
  grid-column: 1 / -1;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-group input {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  font-size: 0.95rem;
  background: var(--bg-input);
  color: var(--text-primary);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 200, 154, 0.12);
}

.btn-submit {
  margin-top: 1.8rem;
  width: 100%;
  padding: 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 40px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-submit:hover {
  background: var(--accent-hover);
  transform: scale(1.01);
}

.footer {
  margin-top: 1rem;
  padding: 1rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  text-align: center;
  width: 100%;
}

.status-annulee { background: #e74c3c; color: #fff; }

/* ===== RESPONSIVE ===== */
@media (max-width: 780px) {
  .custom-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .options-row {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  .preview-image {
    max-width: 250px;
    margin: 0 auto;
  }
  .brand-title {
    font-size: 3rem;
  }
  .subtitle {
    font-size: 1rem;
  }
  .theme-btn {
    position: relative;
    top: auto;
    right: auto;
    align-self: flex-end;
    margin-top: 0.5rem;
  }
  .scroll-btn {
    display: none;
  }
  .product-item {
    flex: 0 0 160px;
  }
  .product-item img {
    height: 110px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .logistics-grid {
    grid-template-columns: 1fr;
  }
  .custom-header {
    flex-direction: column;
    align-items: stretch;
  }
  .import-logo-btn {
    justify-content: center;
  }
}