/* Voz a Claude — UI premium iOS-quality, accesible, alto contraste */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0b14;
  color: #f0f0f5;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
#topbar {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(11, 11, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

#status {
  font-size: 14px;
  font-weight: 500;
  color: #888;
  letter-spacing: 0.2px;
  transition: color 0.2s ease;
}

#status[data-kind="rec"]     { color: #ef4444; animation: blink 1.2s infinite; }
#status[data-kind="sending"] { color: #fbbf24; }
#status[data-kind="waiting"] { color: #60a5fa; }
#status[data-kind="ok"]      { color: #4ade80; }

@keyframes blink {
  50% { opacity: 0.5; }
}

#config-btn {
  background: rgba(255,255,255,0.05);
  color: #ccc;
  border: none;
  font-size: 20px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
#config-btn:active { background: rgba(255,255,255,0.12); }

/* ---------- Botones principales ---------- */
main#botones {
  position: fixed;
  top: calc(52px + env(safe-area-inset-top, 0));
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}

button.dest {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 28px;
  color: #fff;
  cursor: pointer;
  padding: 16px;
  transition: transform 0.1s cubic-bezier(.4,0,.2,1), box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

button.dest::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.18), transparent 60%);
  pointer-events: none;
}

button.dest .emoji {
  font-size: 60px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

button.dest .label {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

button.dest .hint {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.75;
  letter-spacing: 0.3px;
}

button.dest[data-destino="pc-casa"]   {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.35);
}
button.dest[data-destino="notebook"]  {
  background: linear-gradient(135deg, #14532d 0%, #22c55e 100%);
  box-shadow: 0 8px 32px rgba(34, 197, 94, 0.35);
}
button.dest[data-destino="oficina"]   {
  background: linear-gradient(135deg, #7c2d12 0%, #f97316 100%);
  box-shadow: 0 8px 32px rgba(249, 115, 22, 0.35);
}

button.dest:active { transform: scale(0.97); }

button.dest.grabando {
  animation: pulse 1.1s ease-in-out infinite;
  background: linear-gradient(135deg, #991b1b 0%, #ef4444 100%) !important;
  box-shadow: 0 8px 40px rgba(239, 68, 68, 0.55) !important;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 40px rgba(239, 68, 68, 0.55); }
  50%      { box-shadow: 0 8px 60px rgba(239, 68, 68, 0.85); }
}

button.dest:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ---------- Overlays ---------- */
/* Fix: el atributo hidden debe ganarle al display:flex */
[hidden] { display: none !important; }

#transcript-overlay, #respuesta-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadein 0.2s ease;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#transcript-card, #respuesta-card {
  background: linear-gradient(180deg, #1f1f2e 0%, #18182a 100%);
  border-radius: 28px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  animation: slideup 0.25s cubic-bezier(.4,0,.2,1);
}

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

#transcript-card h2, #respuesta-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #f0f0f5;
}

#transcript-texto, #respuesta-texto {
  margin: 0;
  font-size: 22px;
  line-height: 1.45;
  color: #f0f0f5;
  min-height: 88px;
  max-height: 50vh;
  overflow-y: auto;
  font-weight: 500;
  letter-spacing: 0.2px;
}

#transcript-acciones, #respuesta-acciones {
  display: flex;
  gap: 12px;
}

#transcript-acciones button,
#respuesta-acciones button {
  flex: 1;
  padding: 18px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

#transcript-acciones button:active,
#respuesta-acciones button:active { transform: scale(0.96); }

#cancelar-btn, #cerrar-respuesta-btn {
  background: rgba(255,255,255,0.08);
  color: #f0f0f5;
}

#enviar-btn, #repetir-btn {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

#enviar-btn:disabled {
  background: rgba(255,255,255,0.06);
  color: #555;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- Waveform ---------- */
#waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
}

.wave-bar {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, #ef4444, #fbbf24);
  transition: height 0.08s ease;
}

/* ---------- Config dialog ---------- */
dialog {
  border: none;
  border-radius: 24px;
  background: linear-gradient(180deg, #1f1f2e, #14141f);
  color: #f0f0f5;
  padding: 24px;
  max-width: 92vw;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.08);
}
dialog::backdrop {
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
}
dialog h2 {
  margin: 0 0 18px;
  font-size: 22px;
  font-weight: 700;
}
dialog label {
  display: block;
  margin: 14px 0;
  font-size: 13px;
  color: #ccc;
  font-weight: 500;
}
dialog label > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}
dialog label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #f0f0f5;
}
dialog label.check input[type=checkbox] {
  width: 20px;
  height: 20px;
  accent-color: #3b82f6;
}
dialog input[type="url"],
dialog input[type="password"],
dialog input[type="text"],
dialog select {
  width: 100%;
  padding: 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #f0f0f5;
  font-size: 14px;
  font-family: inherit;
}
dialog input[type="range"] {
  width: 100%;
  accent-color: #3b82f6;
}
dialog button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #f0f0f5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
dialog menu {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 22px 0 0;
}
dialog menu button {
  flex: 1;
  padding: 14px;
}
#cfg-cancelar { background: rgba(255,255,255,0.08); }
#cfg-guardar  { background: linear-gradient(135deg, #2563eb, #3b82f6); border: none; color: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(28px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 24px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  z-index: 200;
  animation: toast-in 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-width: 92vw;
  text-align: center;
}
.toast-ok    { background: linear-gradient(135deg, #15803d, #22c55e); color: white; }
.toast-error { background: linear-gradient(135deg, #991b1b, #ef4444); color: white; }
.toast-info  { background: rgba(40,40,60,0.95); color: #f0f0f5; }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
