/**
 * Estilos canónicos para el Generador de avatares y marcos del orgullo LGTBIQ+
 * Fijate Tools
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores base - Modo oscuro por defecto (Midnight Slate) */
  --bg-app: #0b0f17;
  --bg-surface: #141b26;
  --bg-surface-elevated: #1d2636;
  --bg-surface-subtle: #182232;
  --border-subtle: #243247;
  --border-focus: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.2);

  --accent-pride: linear-gradient(135deg, #e40303 0%, #ff8c00 20%, #ffed00 40%, #008026 60%, #004dff 80%, #750787 100%);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-subtle: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.14);
}

/* Base y contención */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.text-mono {
  font-family: var(--font-mono);
}

/* Layout canónico */
.tool-layout {
  max-width: 1240px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

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

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

/* Hero y cabecera de sección */
.hero-header {
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.1rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 780px;
}

.privacy-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.privacy-banner svg {
  flex-shrink: 0;
  color: var(--primary);
}

/* Grid del estudio de diseño */
.avatar-studio-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .avatar-studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel izquierdo: Canvas y controles de encuadre */
.canvas-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-viewport-wrap {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  background: #090d14;
  background-image: 
    linear-gradient(45deg, #131924 25%, transparent 25%),
    linear-gradient(-45deg, #131924 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #131924 75%),
    linear-gradient(-45deg, transparent 75%, #131924 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

#avatar-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.canvas-actions-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn-primary-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary-download:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 42px;
  padding: 0.6rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-reset:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

/* Panel de ajustes de imagen */
.adjustments-accordion {
  width: 100%;
  margin-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.25rem;
}

.adjustments-title {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

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

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

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.slider-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* Panel derecho: Configuración y selector de banderas */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.control-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Drop zone de subida */
.upload-drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-surface-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.upload-drop-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.upload-drop-hint {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* Botones selectores en pills */
.button-group-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mode-select-btn,
.shape-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

.mode-select-btn:hover,
.shape-select-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.mode-select-btn.active,
.shape-select-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Rejilla de selección de banderas */
.flags-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.flags-selection-grid::-webkit-scrollbar {
  width: 6px;
}

.flags-selection-grid::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

.flags-selection-grid::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

.flag-select-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.flag-select-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.flag-select-card.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 0 2px var(--primary);
}

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

.flag-select-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flag-dots-strip {
  display: flex;
  gap: 4px;
  height: 8px;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
}

.flag-mini-dot {
  flex: 1;
  height: 100%;
}

/* Input de texto personalizado */
.form-input-text {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input-text:focus {
  border-color: var(--border-focus);
}

/* Guía de medidas para redes sociales */
.social-specs-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.spec-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.spec-platform {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.spec-dimensions {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.spec-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Acordeón FAQ SEO */
.faq-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card);
}

.faq-title {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem 0;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.faq-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.6rem;
}

.faq-answer {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Toast de notificación accesible */
.app-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s ease;
}

.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.6rem;
  }

  .canvas-panel {
    padding: 1rem;
  }

  .canvas-viewport-wrap {
    max-width: 100%;
  }

  .control-card {
    padding: 1.25rem;
  }

  .flags-selection-grid {
    grid-template-columns: 1fr;
    max-height: 280px;
  }

  .app-toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
}
