/* ELNE LIFE DRESSING - Style Officiel V1.0 */
:root {
  --bg-primary: #0e0e12;
  --bg-secondary: #16161e;
  --bg-card: #1e1e28;
  --bg-card-hover: #262634;
  --accent-gold: #e5b358;
  --accent-gold-glow: rgba(229, 179, 88, 0.35);
  --accent-pink: #e965a1;
  --text-primary: #f5f5f7;
  --text-muted: #8e8e9f;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(229, 179, 88, 0.6);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden; /* STRICTEMENT AUCUN SCROLL SUR LA PAGE */
  background-color: var(--bg-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-primary);
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #1a1a26 0%, #0c0c10 100%);
}

/* HEADER SUPÉRIEUR */
.dressing-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(14, 14, 18, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
  flex-shrink: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
}

.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.look-title-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.look-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  padding: 4px 8px;
  border-radius: 6px;
  max-width: 160px;
}

.look-name-input:focus {
  outline: none;
  background: var(--bg-secondary);
  border-color: var(--border-focus);
}

/* ZONE CENTRALE (SCÈNE + CATALOGUE) */
.main-stage-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
}

/* SCÈNE PRINCIPALE DE RENDU */
.character-scene {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: 8px;
}

#character-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.7));
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#character-canvas.zoomed-face {
  transform: scale(2.4) translateY(28%);
}

/* OVERLAYS ET CONTRÔLES SUR LA SCÈNE */
.scene-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.view-switcher {
  display: flex;
  background: rgba(22, 22, 30, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.view-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 36px;
  min-width: 44px;
  transition: all 0.2s ease;
}

.view-btn.active {
  color: #0e0e12;
  background: var(--accent-gold);
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

.poses-bar {
  display: flex;
  background: rgba(22, 22, 30, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.pose-btn {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 36px;
  transition: all 0.2s ease;
}

.pose-btn.active {
  color: #0e0e12;
  background: var(--accent-gold);
  font-weight: 600;
}

.pose-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.scene-actions-right {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

/* ALERTE DE POSE INCOMPATIBLE */
.pose-alert-toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 40, 0.95);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 60;
  max-width: 90%;
}

.pose-alert-toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.pose-alert-btn {
  background: var(--accent-gold);
  color: #000;
  border: none;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* PANNEAU DU CATALOGUE (DESKTOP ET MOBILE) */
.wardrobe-panel {
  width: 380px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
  flex-shrink: 0;
}

.wardrobe-tabs {
  display: flex;
  overflow-x: auto;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 4px 8px;
  gap: 4px;
  scrollbar-width: none;
}
.wardrobe-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--accent-gold);
  background: var(--bg-card);
  font-weight: 600;
}

.wardrobe-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-card) transparent;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  min-height: 120px;
}

.item-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.item-card.selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 12px var(--accent-gold-glow);
  background: rgba(229, 179, 88, 0.08);
}

.item-thumb-wrapper {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
}

.item-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.item-title {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.3;
}

/* SECTION MAQUILLAGE & COULEURS */
.makeup-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.makeup-group {
  background: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.makeup-group-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.swatch-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.slider-row input[type=\"range\"] {
  flex: 1;
  accent-color: var(--accent-gold);
}

/* MODALES (PHOTO, IMPORT/EXPORT, TECHNIQUE) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.btn-primary {
  background: var(--accent-gold);
  color: #000;
  border: none;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #f1bf66;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* FORMATS PHOTO */
.format-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.format-btn {
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.format-btn.active {
  border-color: var(--accent-gold);
  background: rgba(229, 179, 88, 0.1);
  color: var(--accent-gold);
}

/* RESPONSIVE MOBILE (PORTRAIT) */
@media (max-width: 840px) {
  .main-stage-wrapper {
    flex-direction: column;
  }

  .character-scene {
    flex: 1;
    min-height: 52%;
  }

  .wardrobe-panel {
    width: 100%;
    height: 48%;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .item-card {
    min-height: 96px;
    padding: 6px;
  }

  .item-thumb-wrapper {
    height: 55px;
  }

  .item-title {
    font-size: 11px;
  }
}

/* ACCESSIBILITÉ & FOCUS */
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}
