/* ==========================================================================
   Test de velocidad de clic (CPS) y Aim Trainer - Estilos visuales
   ========================================================================== */

:root {
  --primary-color: #ec4899;
  --primary-hover: #db2777;
  --primary-light: rgba(236, 72, 153, 0.15);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;

  --bg-app: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-header: #19243d;
  --bg-input: #0f172a;
  --border-color: #1e293b;
  --border-color-focus: #ec4899;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

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

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-header: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-color-focus: #ec4899;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-wrapper {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.tool-main-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Tabs de selección de modo */
.mode-tabs {
  display: flex;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-header);
}

.tab-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4);
}

/* Selector de tiempo */
.time-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.selector-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.time-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-time {
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-time:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-time.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Tarjetas de estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-card.stat-highlight {
  border-color: var(--primary-color);
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg-card) 100%);
}

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
}

.stat-highlight .stat-value {
  color: var(--primary-color);
}

/* Área de clic (Pad) */
.click-pad {
  position: relative;
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: all 0.15s ease-out;
  outline: none;
}

.click-pad:hover {
  border-color: var(--primary-color);
  background: var(--bg-card-header);
}

.click-pad:active, .click-pad.active-clicking {
  transform: scale(0.985);
  border-style: solid;
  border-color: var(--primary-color);
  box-shadow: 0 0 24px rgba(236, 72, 153, 0.25);
}

.pad-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  pointer-events: none;
  z-index: 2;
  padding: 20px;
}

.pad-icon-box {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  transition: transform 0.1s;
}

.click-pad:active .pad-icon-box {
  transform: scale(1.1);
}

.pad-content h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.pad-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Ripple de clic */
.click-ripple-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.click-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(236, 72, 153, 0.4);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-anim 0.4s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-anim {
  to {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}

/* Panel de Resultados */
.results-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease;
}

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

.results-header {
  text-align: center;
  margin-bottom: 20px;
}

.rank-badge {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 20px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.results-header h3 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.results-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.results-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.metric-title {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.metric-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-color);
  display: block;
}

.metric-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.chart-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.chart-box h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.chart-wrapper {
  position: relative;
  height: 200px;
}

.results-actions {
  display: flex;
  justify-content: center;
}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-main);
}

.btn-primary-action:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}

/* AIM TRAINER */
.aim-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.aim-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.aim-stat-item {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.aim-stat-item strong {
  font-family: var(--font-mono);
  color: var(--text-main);
}

.aim-canvas-container {
  position: relative;
  background: #060911;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: crosshair;
  height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#aimCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.aim-start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay-content {
  text-align: center;
  max-width: 400px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #ffffff;
}

.overlay-content svg {
  color: var(--primary-color);
}

/* Técnicas */
.techniques-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.techniques-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.techniques-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.tech-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.tech-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.tech-range {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.tech-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* FAQ & Sidebar & Modal standard */
.faq-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.faq-section h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card-header);
}

.faq-question {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question svg {
  transition: transform 0.2s;
  color: var(--primary-color);
}

.faq-item[open] .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 16px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.tool-sidebar {
  width: 300px;
}

.ad-sidebar-wrapper {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ad-sidebar-card {
  width: 300px;
  min-height: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-dev-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
}

.ad-size-badge {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: var(--bg-card-header);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px 18px;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
}

.modal-footer {
  padding: 12px 18px;
  background: var(--bg-card-header);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
}

/* Responsividad */
@media (max-width: 1024px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr;
  }
  .tool-sidebar {
    width: 100%;
  }
  .ad-sidebar-card {
    width: 100%;
    min-height: 250px;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .results-metrics {
    grid-template-columns: 1fr;
  }
  .aim-canvas-container {
    height: 320px;
  }
}
