/**
 * Fijate Tools - Probador de Maquillaje Virtual
 * style.css: Hoja de estilos responsiva de alta estética cosmética
 */

:root {
  --bg-base: #0b0f17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1a2436;
  --bg-surface-subtle: #223048;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #f472b6;
  --accent-pink: #f472b6;
  --accent-pink-glow: rgba(244, 114, 182, 0.28);
  --accent-champagne: #fae8d2;
  --accent-gold: #ebb95f;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-subtle: #e2e8f0;
  --border-subtle: rgba(0, 0, 0, 0.09);
  --border-focus: #db2777;
  --accent-pink: #db2777;
  --accent-pink-glow: rgba(219, 39, 119, 0.16);
  --accent-champagne: #d97706;
  --accent-gold: #b45309;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

/* Reset y contención de layout */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tool-layout {
  max-width: 1240px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  min-width: 0;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
}

/* Tarjeta principal del probador */
.card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 10px 35px -5px rgba(0, 0, 0, 0.35);
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* 1. Barra superior: Modelos de estudio y Subida de foto */
.model-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.model-group-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.model-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.model-pills-wrap {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
}

.btn-model-pill:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-model-pill.active {
  background: var(--bg-surface-subtle);
  color: #ffffff;
  border-color: var(--accent-pink);
  box-shadow: 0 0 12px var(--accent-pink-glow);
}

.model-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

.btn-upload-photo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.15), rgba(244, 114, 182, 0.05));
  border: 1px dashed var(--accent-pink);
  border-radius: var(--radius-full);
  color: var(--accent-pink);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
}

.btn-upload-photo:hover {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.25), rgba(244, 114, 182, 0.1));
  box-shadow: 0 0 12px var(--accent-pink-glow);
}

/* 2. Escenario visual en 2 columnas */
.stage-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* Visor interactivo */
.stage-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  background: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  user-select: none;
  touch-action: none;
}

.stage-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modos de cámara y zoom */
.stage-viewport.zoom-full .stage-canvas {
  transform: scale(1);
}

.stage-viewport.zoom-eyes .stage-canvas {
  transform: scale(1.75) translateY(14%);
  transform-origin: 50% 40%;
}

.stage-viewport.zoom-lips .stage-canvas {
  transform: scale(2.05) translateY(-19%);
  transform-origin: 50% 64%;
}

/* HUD Superior */
.stage-hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 10;
}

.stage-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-main);
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.status-dot.ready {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.camera-zoom-bar {
  display: inline-flex;
  gap: 0.25rem;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.2rem;
  border-radius: var(--radius-full);
  pointer-events: auto;
}

.btn-zoom-option {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.btn-zoom-option:hover {
  color: var(--text-main);
}

.btn-zoom-option.active {
  background: var(--accent-pink);
  color: #ffffff;
}

/* HUD Inferior */
.stage-hud-bottom {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 10;
  flex-wrap: wrap;
}

.btn-hud {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  min-height: 38px;
}

.btn-hud:hover {
  background: rgba(26, 36, 52, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-hud.active {
  background: var(--accent-pink);
  color: #ffffff;
  border-color: var(--accent-pink);
  box-shadow: 0 0 14px var(--accent-pink-glow);
}

.btn-hud.highlight {
  background: linear-gradient(135deg, #f472b6, #db2777);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px var(--accent-pink-glow);
}

.btn-hud.highlight:hover {
  filter: brightness(1.1);
}

/* 3. Panel de configuración y pestañas del tocador */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

/* Pestañas de categoría */
.makeup-nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.makeup-nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.4rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 40px;
  white-space: nowrap;
}

.makeup-nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.makeup-nav-tab.active {
  background: var(--bg-surface-subtle);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border-bottom: 2px solid var(--accent-pink);
}

/* Contenedor de paneles de pestañas */
.tab-panel {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  animation: fadeIn 0.2s ease-in-out;
}

.tab-panel.active {
  display: block;
}

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

.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
}

.active-swatch-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.active-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Presets virales grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.btn-preset-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.65rem 0.8rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  min-height: 52px;
}

.btn-preset-pill:hover {
  background: var(--bg-surface-subtle);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-preset-pill.active {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.14), rgba(244, 114, 182, 0.04));
  border-color: var(--accent-pink);
  box-shadow: 0 0 10px var(--accent-pink-glow);
}

.preset-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.preset-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-surprise-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, #f472b6, #ec4899);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  min-height: 32px;
}

.btn-surprise-pill:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 10px var(--accent-pink-glow);
}

.preset-info-card {
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.info-tag {
  display: block;
  font-weight: 700;
  color: var(--accent-pink);
  margin-bottom: 0.3rem;
}

/* Grilla de muestras de color (Swatches) */
.swatches-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.lip-swatch, .shadow-swatch, .blush-swatch, .hl-swatch {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.lip-swatch:hover, .shadow-swatch:hover, .blush-swatch:hover, .hl-swatch:hover {
  transform: scale(1.12);
  border-color: #ffffff;
}

.lip-swatch.active, .shadow-swatch.active, .blush-swatch.active, .hl-swatch.active {
  transform: scale(1.18);
  border-color: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-pink);
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.color-picker-input {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0;
  background: none;
  cursor: pointer;
}

/* Subsecciones y opciones */
.sub-section {
  margin-bottom: 1rem;
}

.sub-title {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.options-pills-wrap {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-lip-finish, .btn-shadow-style, .btn-eyeliner-style, .btn-lashes-style, .btn-blush-pattern {
  flex: 1 1 calc(50% - 0.45rem);
  padding: 0.5rem 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  min-height: 40px;
}

.btn-lip-finish:hover, .btn-shadow-style:hover, .btn-eyeliner-style:hover, .btn-lashes-style:hover, .btn-blush-pattern:hover {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
}

.btn-lip-finish.active, .btn-shadow-style.active, .btn-eyeliner-style.active, .btn-lashes-style.active, .btn-blush-pattern.active {
  background: var(--bg-surface-subtle);
  color: #ffffff;
  border-color: var(--accent-pink);
  box-shadow: 0 0 10px var(--accent-pink-glow);
}

/* Deslizadores (Sliders) */
.slider-row {
  margin-bottom: 0.9rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.slider-header span:last-child {
  font-family: var(--font-mono);
  color: var(--accent-pink);
  font-weight: 700;
}

.range-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-full);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-pink);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-pink-glow);
  transition: var(--transition);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Checkbox toggle */
.toggle-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
}

.toggle-checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-pink);
  cursor: pointer;
}

/* Responsividad en pantallas medianas y móviles */
@media (max-width: 992px) {
  .stage-wrapper {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

@media (max-width: 640px) {
  .card-main {
    padding: 1rem;
  }

  .makeup-nav-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .swatches-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .presets-grid {
    grid-template-columns: 1fr;
  }

  .btn-hud span {
    font-size: 0.72rem;
  }
}

@media (max-width: 430px) {
  .model-selection-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-upload-photo {
    justify-content: center;
    width: 100%;
  }

  .model-pills-wrap {
    width: 100%;
  }

  .btn-model-pill {
    flex: 1 1 auto;
    justify-content: center;
  }
}
