/**
 * Fijate Tools - Probador de Cejas y Visagismo
 * Hoja de estilo responsiva de alta fidelidad estética
 */

:root {
  --bg-base: #0b0f17;
  --bg-surface: #131b26;
  --bg-surface-elevated: #1a2434;
  --bg-surface-subtle: #223044;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #ebb95f;
  --accent-gold: #ebb95f;
  --accent-gold-glow: rgba(235, 185, 95, 0.25);
  --accent-rose: #f472b6;
  --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: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-surface-subtle: #e2e8f0;
  --border-subtle: rgba(0, 0, 0, 0.09);
  --border-focus: #d97706;
  --accent-gold: #b45309;
  --accent-gold-glow: rgba(180, 83, 9, 0.15);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

/* Reset y contención de viewport */
*, *::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 de selección de modelo de estudio */
.studio-model-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.studio-model-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
}

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

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

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

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

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

.model-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 2. Barra de looks virales a 1 clic */
.viral-presets-bar {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.25rem;
}

.presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.presets-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-surprise-look {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: linear-gradient(135deg, rgba(235, 185, 95, 0.2), rgba(244, 114, 182, 0.2));
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-full);
  color: var(--accent-gold);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-surprise-look:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px var(--accent-gold-glow);
}

.presets-scroll-wrap {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  min-width: 0;
  max-width: 100%;
  scrollbar-width: thin;
}

.presets-scroll-wrap::-webkit-scrollbar {
  height: 4px;
}
.presets-scroll-wrap::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}

.btn-preset-pill {
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-preset-pill.active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* 3. Escenario interactivo (Grid 2 columnas: Visor + Panel de Controles) */
.stage-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.25rem;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 991px) {
  .stage-wrapper {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Visor del Canvas */
.stage-viewport {
  position: relative;
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
  min-width: 0;
  max-width: 100%;
}

.stage-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  user-select: none;
  touch-action: none;
  cursor: pointer;
}

/* HUD superior */
.stage-hud-top {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

.stage-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  color: var(--text-main);
  pointer-events: auto;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

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

/* HUD inferior con acciones */
.stage-hud-bottom {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 5;
  flex-wrap: wrap;
}

.btn-hud {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: rgba(19, 27, 38, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  pointer-events: auto;
  transition: var(--transition);
  white-space: nowrap;
  height: 38px;
}

.btn-hud:hover {
  background: rgba(34, 48, 68, 0.95);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-hud.active {
  background: var(--bg-surface-subtle);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.btn-hud.highlight {
  background: linear-gradient(135deg, #ebb95f, #d97706);
  border-color: transparent;
  color: #0b0f17;
  font-weight: 600;
}

.btn-hud.highlight:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(235, 185, 95, 0.4);
}

/* 4. Panel de controles interactivo */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  max-width: 100%;
}

.control-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  min-width: 0;
  max-width: 100%;
}

.card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.card-section-title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.control-val-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  background: var(--bg-surface-subtle);
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  color: var(--accent-gold);
}

/* Grilla de diagnóstico de cejas actuales */
.brows-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.btn-brow-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  min-height: 72px;
}

.btn-brow-type:hover {
  background: var(--bg-surface-subtle);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.btn-brow-type.active {
  background: var(--bg-surface-subtle);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.btn-brow-type svg {
  color: currentColor;
}

.btn-brow-type span {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tarjeta informativa de diagnóstico */
.diagnosis-banner {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-top: 0.4rem;
}

.diag-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.diag-brow-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.diag-tech-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(235, 185, 95, 0.15);
  color: var(--accent-gold);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.diag-brow-text {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.diag-tech-advice {
  font-size: 0.74rem;
  color: var(--text-main);
  line-height: 1.35;
  font-weight: 500;
}

/* Botones de forma de rostro */
.face-shapes-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.btn-face-shape {
  padding: 0.45rem 0.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-face-shape:hover,
.btn-face-shape.active {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
  border-color: var(--accent-gold);
}

.btn-face-shape.active {
  color: var(--accent-gold);
  font-weight: 600;
}

/* Grilla de técnicas de salón */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.btn-tech-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  min-height: 44px;
}

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

.btn-tech-option.active {
  background: var(--bg-surface-subtle);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.tech-icon-box {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Barra de acabados */
.finishes-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.btn-finish-option {
  padding: 0.45rem 0.3rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-finish-option:hover,
.btn-finish-option.active {
  background: var(--bg-surface-subtle);
  color: var(--text-main);
}

.btn-finish-option.active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  font-weight: 600;
}

/* Sliders de ajuste fino */
.sliders-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.range-slider {
  width: 100%;
  accent-color: var(--accent-gold);
  height: 6px;
  border-radius: 3px;
  background: var(--bg-surface);
  cursor: pointer;
}

/* Paleta de tonos de pigmento (Lección 395: Swatches perlados 3D) */
.swatches-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.swatch-card {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.4), inset 0 -3px 5px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.swatch-card:hover {
  transform: scale(1.12);
  z-index: 2;
}

.swatch-card.active {
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 10px var(--accent-gold);
}

.color-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.color-status-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.active-color-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.color-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.color-input-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  background: none;
}

.color-input-btn::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-input-btn::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-full);
}

/* Sidebar publicitario desktop (>= 1536px) */
.tool-ad-sidebar {
  display: none;
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 1.5rem;
}

@media (min-width: 1536px) {
  .tool-ad-sidebar {
    display: block;
  }
}

.ad-sidebar-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
}

.ad-sidebar-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

/* Adaptación responsive en pantallas pequeñas (< 640px) */
@media (max-width: 639px) {
  .tool-layout {
    padding: 0 0.5rem;
  }
  .card-main {
    padding: 0.75rem 0.6rem;
  }
  .studio-model-bar {
    padding: 0.6rem 0.5rem;
  }
  .model-pills-wrap {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .btn-model-pill {
    justify-content: center;
    padding: 0.4rem 0.3rem;
    font-size: 0.74rem;
  }
  .brows-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .face-shapes-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tech-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .swatches-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .stage-hud-bottom {
    justify-content: stretch;
  }
  .btn-hud {
    flex: 1 1 0%;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0.4rem 0.5rem;
  }
}
