/* Estilos del Comunicador con Pictogramas y Voz (CAA) - Fijate Tools */

:root {
  --bg-app: #080d1a;
  --bg-card: #12192b;
  --bg-card-secondary: #1a243a;
  --bg-card-hover: #22304d;
  --border-color: #25334e;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-color: #a855f7;
  --accent-hover: #9333ea;
  --color-speak: #22c55e;
  --color-speak-hover: #16a34a;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-secondary: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
}

select, .form-control {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

select {
  background-color: var(--bg-card-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 2rem 0.6rem 0.85rem;
  font-size: 0.9rem;
}

select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
}

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

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

.card-main {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

/* TIRA DE FRASE (Superior persistente) */
.phrase-strip-wrapper {
  background: var(--bg-card-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

.phrase-strip-scroll {
  display: flex;
  gap: 0.75rem;
  min-height: 85px;
  overflow-x: auto;
  align-items: center;
  padding-bottom: 0.4rem;
}

.phrase-empty-hint {
  color: var(--text-dim);
  font-size: 0.95rem;
  font-style: italic;
  margin: auto;
  text-align: center;
}

/* Chips de pictogramas en la tira */
.phrase-card-chip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  min-width: 70px;
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.phrase-chip-svg svg {
  width: 38px;
  height: 38px;
}

.phrase-chip-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
}

/* Barra de controles de la frase (Hablar, Deshacer, Borrar) */
.phrase-controls-bar {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.btn-speak-huge {
  flex: 2;
  min-height: 52px;
  background: var(--color-speak);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.35);
  transition: all 0.15s ease;
}

.btn-speak-huge:hover:not(:disabled) {
  background: var(--color-speak-hover);
  transform: translateY(-2px);
}

.btn-speak-huge:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-speak-huge.speaking {
  animation: pulseSpeak 0.8s infinite alternate;
}

@keyframes pulseSpeak {
  from { transform: scale(1); }
  to { transform: scale(1.03); background: #15803d; }
}

.btn-control-action {
  flex: 1;
  min-height: 52px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-control-action:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: var(--bg-card-hover);
}

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

/* Pestañas de categorías */
.categories-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.btn-category-tab {
  flex-shrink: 0;
  min-height: 38px;
  padding: 0 1rem;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-category-tab:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.btn-category-tab.active {
  background: var(--cat-color, var(--accent-color));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Cuadrícula táctil de pictogramas */
.caa-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.caa-grid-card {
  min-height: 115px;
  background: var(--bg-card-secondary);
  border: 2px solid var(--item-cat-color, var(--border-color));
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.caa-grid-card:hover {
  transform: translateY(-3px);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.caa-grid-card:active {
  transform: scale(0.96);
}

.caa-card-icon svg {
  width: 44px;
  height: 44px;
}

.caa-card-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  line-height: 1.2;
}

/* Ajustes de voz en modal */
.voice-slider-group {
  margin-bottom: 1.25rem;
}

.voice-slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-color);
}

.custom-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.custom-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  padding: 1.75rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Responsividad móvil */
@media (max-width: 768px) {
  .card-main {
    padding: 1rem;
  }

  .caa-grid-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
  }

  .caa-grid-card {
    min-height: 95px;
    padding: 0.6rem 0.35rem;
  }

  .caa-card-icon svg {
    width: 34px;
    height: 34px;
  }

  .caa-card-label {
    font-size: 0.75rem;
  }

  .phrase-controls-bar {
    flex-wrap: wrap;
  }

  .btn-speak-huge {
    width: 100%;
    order: -1;
  }
}
