/* ==========================================================================
   Fijate Tools - Grabador de pantalla, webcam y audio online
   Estilos específicos de la herramienta
   ========================================================================== */

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

  /* Tema claro */
  --bg-recorder-card: #ffffff;
  --bg-recorder-inner: #f8fafc;
  --bg-recorder-viewport: #0b0f17;
  --border-recorder-subtle: #e2e8f0;
  --border-recorder-strong: #cbd5e1;
  --text-recorder-main: #0f172a;
  --text-recorder-muted: #475569;
  --accent-recorder: #2563eb;
  --accent-recorder-hover: #1d4ed8;
  --accent-recorder-light: #eff6ff;
  --danger-rec: #dc2626;
  --danger-rec-hover: #b91c1c;
  --success-recorder: #059669;
  --modal-bg: #ffffff;
  --modal-overlay: rgba(15, 23, 42, 0.65);
}

[data-theme="dark"] {
  --bg-recorder-card: #131b2e;
  --bg-recorder-inner: #0d1424;
  --bg-recorder-viewport: #070a10;
  --border-recorder-subtle: #26334d;
  --border-recorder-strong: #334466;
  --text-recorder-main: #f1f5f9;
  --text-recorder-muted: #94a3b8;
  --accent-recorder: #3b82f6;
  --accent-recorder-hover: #60a5fa;
  --accent-recorder-light: rgba(59, 130, 246, 0.15);
  --danger-rec: #ef4444;
  --danger-rec-hover: #dc2626;
  --success-recorder: #10b981;
  --modal-bg: #162035;
  --modal-overlay: rgba(3, 7, 18, 0.8);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body, #f8fafc);
  color: var(--text-recorder-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] body {
  background-color: #0b1120;
}

.tool-layout h1,
.tool-layout h2,
.tool-layout h3,
.tool-layout h4 {
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
  color: var(--text-recorder-main);
  margin-top: 0;
}

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

/* Tarjeta principal */
.recorder-card {
  background: var(--bg-recorder-card);
  border: 1px solid var(--border-recorder-subtle);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

@media (max-width: 640px) {
  .recorder-card {
    padding: 1rem;
    border-radius: 0.75rem;
  }
}

/* Badge de privacidad */
.privacy-badge {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--text-recorder-main);
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 1.5rem;
}

.privacy-badge svg {
  flex-shrink: 0;
  color: var(--accent-recorder);
}

/* Selector de modos de grabación */
.mode-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .mode-selector-grid {
    grid-template-columns: 1fr;
  }
}

.mode-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  border-radius: 0.625rem;
  border: 1px solid var(--border-recorder-subtle);
  background: var(--bg-recorder-inner);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  font-family: var(--font-main);
  color: var(--text-recorder-main);
  min-height: 48px;
}

.mode-card:hover {
  border-color: var(--accent-recorder);
  background: rgba(37, 99, 235, 0.04);
}

.mode-card.active {
  border-color: var(--accent-recorder);
  background: var(--accent-recorder-light);
  box-shadow: 0 0 0 1px var(--accent-recorder);
}

.mode-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-recorder);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mode-title {
  font-size: 0.9375rem;
  font-weight: 700;
}

.mode-desc {
  font-size: 0.75rem;
  color: var(--text-recorder-muted);
  line-height: 1.35;
}

/* Barra de configuración */
.recorder-config-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.875rem;
  background: var(--bg-recorder-inner);
  border: 1px solid var(--border-recorder-subtle);
  border-radius: 0.625rem;
  padding: 0.875rem;
  margin-bottom: 1.25rem;
  align-items: end;
}

.config-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.config-label {
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-recorder-main);
}

.config-label svg {
  color: var(--accent-recorder);
}

/* Desplegables responsivos */
.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  min-height: 40px;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-recorder-strong);
  background-color: var(--bg-recorder-card);
  color: var(--text-recorder-main);
  font-family: var(--font-main);
  font-size: 0.875rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

.form-select:focus {
  outline: 2px solid var(--accent-recorder);
  outline-offset: 1px;
}

.config-item-prompter {
  display: flex;
  justify-content: flex-end;
}

/* Teleprompter */
.prompter-panel {
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.prompter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-wrap: wrap;
}

.prompter-title-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: #38bdf8;
}

.prompter-controls {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.prompter-ctrl-label {
  font-size: 0.8125rem;
  color: #cbd5e1;
}

.prompter-speed-slider {
  width: 90px;
  accent-color: #38bdf8;
  cursor: pointer;
}

.prompter-scroll-box {
  max-height: 150px;
  overflow-y: auto;
  margin-top: 0.75rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  scrollbar-width: thin;
}

.prompter-content {
  font-size: 1.125rem;
  line-height: 1.7;
  color: #f8fafc;
  outline: none;
  white-space: pre-wrap;
}

/* Visor de grabación y canvas */
.stream-viewport-container {
  width: 100%;
  margin-bottom: 1.25rem;
}

.stream-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  background: var(--bg-recorder-viewport);
  border-radius: 0.875rem;
  overflow: hidden;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6), 0 4px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Placeholder */
.viewport-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: rgba(11, 15, 23, 0.94);
  color: #f8fafc;
  z-index: 10;
}

.placeholder-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.placeholder-title {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.placeholder-text {
  color: #94a3b8;
  font-size: 0.9375rem;
  max-width: 440px;
  margin-bottom: 1.5rem;
}

/* Badge de REC */
.rec-status-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.875rem;
  border-radius: 2rem;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ffffff;
  font-size: 0.875rem;
  z-index: 20;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: pulseRec 1.2s infinite ease-in-out;
}

@keyframes pulseRec {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.85);
  }
}

.rec-label {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ef4444;
  font-size: 0.75rem;
}

.rec-timer {
  font-weight: 600;
  font-size: 0.875rem;
}

/* Vúmetro de audio */
.vumeter-box {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
  color: #60a5fa;
  z-index: 20;
}

.vumeter-track {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.vumeter-bar {
  width: 0%;
  height: 100%;
  background: #10b981;
  transition: width 0.06s linear;
}

/* Botones y acciones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-main);
  font-size: 0.9375rem;
  font-weight: 600;
  min-height: 42px;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent-recorder);
  color: #ffffff;
  border-color: var(--accent-recorder);
}

.btn-primary:hover {
  background: var(--accent-recorder-hover);
}

.btn-secondary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-recorder);
  border-color: rgba(37, 99, 235, 0.25);
}

.btn-secondary:hover {
  background: rgba(37, 99, 235, 0.18);
}

.btn-danger {
  background: var(--danger-rec);
  color: #ffffff;
  border-color: var(--danger-rec);
}

.btn-danger:hover {
  background: var(--danger-rec-hover);
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-rec-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.btn-outline {
  background: transparent;
  color: var(--text-recorder-main);
  border-color: var(--border-recorder-strong);
}

.btn-outline:hover {
  background: var(--bg-recorder-inner);
}

.btn-ghost {
  background: transparent;
  color: var(--text-recorder-muted);
  border-color: transparent;
}

.btn-sm {
  min-height: 34px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .btn:not(.btn-sm) {
    width: 100%;
    min-height: 44px;
  }
}

.recorder-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-recorder-subtle);
  flex-wrap: wrap;
}

.actions-left {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quality-tag {
  font-size: 0.8125rem;
  color: var(--text-recorder-muted);
}

@media (max-width: 640px) {
  .recorder-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .actions-left {
    flex-direction: column;
  }
}

/* Sección de resultado y previsualización */
.download-result-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px dashed var(--border-recorder-subtle);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.result-title-box {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.result-title {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text-recorder-main);
}

.result-meta {
  font-size: 0.875rem;
  color: var(--text-recorder-muted);
}

.video-preview-player-box {
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #000000;
  margin-bottom: 1rem;
}

#video-preview-player {
  width: 100%;
  max-height: 60vh;
  display: block;
}

.download-buttons-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .download-buttons-row {
    flex-direction: column;
  }
}

/* Modales */
.feedback-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.feedback-modal-dialog {
  background: var(--modal-bg);
  color: var(--text-recorder-main);
  border: 1px solid var(--border-recorder-subtle);
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-recorder-subtle);
}

.feedback-modal-title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0;
}

.feedback-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-recorder-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
}

.feedback-modal-body {
  padding: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-recorder-muted);
}

.feedback-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-recorder-subtle);
  background: var(--bg-recorder-inner);
}
