:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #06b6d4;
  --ai-color: #5a67d8;
  --light-color: #f8fafc;
  --dark-color: #1e293b;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --background-color: #f9fafb;
  --card-background: #ffffff;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --primary-color: #3b82f6;
  --secondary-color: #2563eb;
  --light-color: #1e293b;
  --dark-color: #f8fafc;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --border-color: #374151;
  --background-color: #0f172a;
  --card-background: #1e293b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

main {
  padding: 0 1rem;
}

section {
  max-width: 1200px;
  margin: 2rem auto;
}

/* Header Styles */
.header {
  background: var(--card-background);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-section { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon { font-size: 1.8rem; color: var(--primary-color); }
.logo-section h1 { font-size: 1.5rem; font-weight: 700; }

.controls-section { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.selector-group label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.selector-group select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background: var(--card-background);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.theme-toggle {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* Broker Section */
.broker-section h2 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.broker-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }
.broker-btn {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--card-background);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.broker-btn:hover { border-color: var(--primary-color); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.broker-btn img { max-height: 40px; max-width: 150px; object-fit: contain; }

/* Timeline Section */
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.current-currency h3 { font-size: 1.25rem; }
.current-currency span { color: var(--primary-color); font-weight: 700; }
.counter { font-weight: 500; color: var(--text-secondary); margin-top: 0.25rem; font-size: 0.9rem; }

.main-controls-container { flex-grow: 1; }
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.control-btn {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background: var(--card-background);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none; /* Para los enlaces que actúan como botones */
}
.control-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* --- INICIO DE CLASES DE BOTONES MODIFICADAS --- */
.btn-primary { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.btn-success { background-color: var(--success-color); color: white; border-color: var(--success-color); }
.btn-danger { background-color: var(--danger-color); color: white; border-color: var(--danger-color); }
.btn-warning { background-color: var(--warning-color); color: white; border-color: var(--warning-color); }
.btn-info { background-color: var(--info-color); color: white; border-color: var(--info-color); }
.btn-ai { background-color: var(--ai-color); color: white; border-color: var(--ai-color); }

.btn-full-width {
  width: 100%;
  justify-content: center;
}
/* --- FIN DE CLASES DE BOTONES MODIFICADAS --- */

.timeline-legend { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--text-secondary); }
.legend-color { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--border-color); }
.legend-color.green { background-color: var(--success-color); }
.legend-color.red { background-color: var(--danger-color); }
.legend-color.doji { background-color: var(--warning-color); }
.legend-color.empty { background-color: transparent; }

.timeline-container {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(300, 40px);
  gap: 2px;
  min-width: max-content;
}

.candle {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 0.6rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.candle.green { background-color: var(--success-color); color: white; }
.candle.red { background-color: var(--danger-color); color: white; }
.candle.doji { background-color: var(--warning-color); color: white; }
.candle.doji::after { content: "—"; position: absolute; font-weight: bold; font-size: 1rem; }
.candle:hover { transform: scale(1.1); box-shadow: var(--shadow); z-index: 10; }
.candle.current-candle { background-color: #ffd700; border: 2px solid #ff6b35; cursor: not-allowed; }
.candle:last-child { border-right: 3px solid var(--primary-color); }
.candle.block-marker { border-width: 2px; border-color: var(--primary-color); }

/* Strategy Section */
.strategy-section h2 { text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.strategy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.strategy-card {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}
.strategy-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.strategy-card h3 { color: var(--text-primary); margin-bottom: 0.5rem; font-size: 1.125rem; }
.strategy-card p { color: var(--text-secondary); margin-bottom: 1rem; font-size: 0.875rem; }
.strategy-results { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.result-item { padding: 0.5rem; border-radius: 0.25rem; }
.result-item.accuracy { background: rgba(37, 99, 235, 0.1); color: var(--primary-color); grid-column: 1 / -1; }
.result-item.win-percent { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.result-item.gale1-percent { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.result-item.gale2-percent { background: rgba(139, 69, 19, 0.1); color: #8b4513; }
.result-label { font-size: 0.75rem; opacity: 0.8; }
.result-value { font-weight: 700; font-size: 1rem; }
.strategy-info { font-size: 0.8rem; color: var(--text-secondary); }

/* Tutorial Section */
.tutorial-section { text-align: center; }
.tutorial-section h2 { margin-bottom: 1.5rem; font-size: 1.5rem; }
.tutorial-section iframe {
  max-width: 100%;
  width: 800px;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  border: none;
}

/* Modal Styles */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--card-background); border-radius: 0.5rem; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 1.25rem; }
.close-btn { background: none; border: none; font-size: 1.25rem; color: var(--text-secondary); cursor: pointer; }
.modal-body { padding: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 0.375rem; background: var(--card-background); color: var(--text-primary); font-size: 0.875rem; }
.checkbox-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.5rem; }
.checkbox-item { display: flex; align-items: center; gap: 0.5rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 1.5rem; }
.form-actions button { padding: 0.75rem 1.5rem; border-radius: 0.375rem; cursor: pointer; font-weight: 500; }
.form-actions button[type="submit"] { background: var(--primary-color); color: white; border: 1px solid var(--primary-color); }
.form-actions button[type="button"] { background: var(--card-background); border: 1px solid var(--border-color); }

/* Footer Styles */
.footer { background: var(--card-background); border-top: 1px solid var(--border-color); margin-top: 3rem; padding: 2rem 1rem; }
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1.5rem; }
.contact-info p { margin-bottom: 0.5rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.5rem; }
.contact-info a { color: var(--primary-color); text-decoration: none; }
.contact-info a:hover { text-decoration: underline; }
.paypal-btn { background: #0070ba; color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 0.375rem; cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }
.paypal-btn:hover { background: #005ea6; }

/* === Media Queries para Diseño Responsivo === */

/* Tablets y dispositivos medianos (hasta 992px) */
@media (max-width: 992px) {
  .header-content, .timeline-header {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  .controls-section {
    justify-content: center;
  }
}

/* Móviles grandes y tablets en vertical (hasta 768px) */
@media (max-width: 768px) {
  body { font-size: 14px; }
  main { padding: 0 0.5rem; }
  .footer-content { flex-direction: column; text-align: center; }
  .timeline { grid-template-columns: repeat(300, 35px); }
}

/* Móviles pequeños (hasta 480px) */
@media (max-width: 480px) {
  .timeline { grid-template-columns: repeat(300, 30px); gap: 1px; }
  
  .candle .candle-time {
    font-size: 0.5rem;
    line-height: 1;
    transform: scale(0.8);
  }

  .strategy-grid { grid-template-columns: 1fr; }
  .actions-grid { grid-template-columns: 1fr 1fr; }
  .timeline-legend { gap: 0.75rem; }
  .legend-item { font-size: 0.7rem; }
}