/* ==========================================================================
   ALCALA TRADING - GLOBAL STYLESHEET (main.css)
   Diseñado para Alta Accesibilidad (WCAG 2.1 AA), Rendimiento y UX Profesional
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. VARIABLES CSS (DESIGN TOKENS)
   -------------------------------------------------------------------------- */
:root {
  /* Paleta de Colores Principal */
  --bg-primary: #0f172a;       /* Slate 900 */
  --bg-secondary: #1e293b;     /* Slate 800 */
  --bg-card: #1e293b;          /* Slate 800 */
  --bg-card-hover: #334155;    /* Slate 700 */
  --bg-input: #0f172a;
  
  --text-primary: #f8fafc;     /* Slate 50 */
  --text-secondary: #94a3b8;   /* Slate 400 */
  --text-muted: #64748b;       /* Slate 500 */
  
  --color-brand: #10b981;      /* Emerald 500 */
  --color-brand-hover: #059669;/* Emerald 600 */
  --color-accent: #06b6d4;     /* Cyan 500 */
  
  /* Colores Financieros (Trading) */
  --color-bullish: #10b981;    /* Emerald Green */
  --color-bullish-bg: rgba(16, 185, 129, 0.15);
  --color-bearish: #ef4444;    /* Red 500 */
  --color-bearish-bg: rgba(239, 68, 68, 0.15);
  --color-warning: #f59e0b;    /* Amber 500 */
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  
  /* Bordes y Sombra */
  --border-color: #334155;     /* Slate 700 */
  --border-focus: #06b6d4;     /* Cyan 500 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.2);
  
  /* Tipografía */
  --font-family-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;
  
  /* Espaciamiento y Bordes */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --max-width: 1280px;
  --header-height: 72px;
}

/* Modo Claro (Soporte dinámico) */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   2. RESET Y BASE SEMÁNTICA
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Accesibilidad: Enlace directo al contenido principal */
.skip-link {
  position: absolute;
  top: -40px;
  left: 10px;
  background: var(--color-brand);
  color: #ffffff;
  padding: 8px 16px;
  z-index: 10000;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 10px;
}

/* --------------------------------------------------------------------------
   3. ADVERTENCIA LEGAL Y BANNER DE RIESGO
   -------------------------------------------------------------------------- */
.risk-warning-banner {
  background-color: #1e1b4b;
  border-bottom: 2px solid #6366f1;
  color: #e0e7ff;
  padding: 10px 20px;
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.4;
}

.risk-warning-banner p {
  max-width: var(--max-width);
  margin: 0 auto;
}

.risk-warning-banner strong {
  color: #a5b4fc;
}

/* --------------------------------------------------------------------------
   4. NAVEGACIÓN Y ENCABEZADO
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
}

[data-theme="light"] .site-header {
  background-color: rgba(255, 255, 255, 0.92);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-brand), var(--color-accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: bold;
}

.logo-tag {
  font-size: 0.75rem;
  background: var(--bg-secondary);
  color: var(--color-accent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link:focus {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--color-brand);
  font-weight: 600;
  background-color: rgba(16, 185, 129, 0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.btn-theme-toggle:hover {
  background-color: var(--bg-card-hover);
}

.btn-simulator {
  background: linear-gradient(135deg, var(--color-brand), #059669);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-simulator:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.4);
}

/* Menú hamburguesa para móvil */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* --------------------------------------------------------------------------
   5. ESTRUCTURA Y SECCIONES PRINCIPALES
   -------------------------------------------------------------------------- */
main {
  flex: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px;
}

.section-title-group {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 48px auto;
}

.badge-tag {
  display: inline-block;
  background: rgba(6, 182, 212, 0.15);
  color: var(--color-accent);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.section-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.25;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   6. BOTONES GENERALES
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--color-brand);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-brand-hover);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

.btn-outline-cyan {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: transparent;
}

.btn-outline-cyan:hover {
  background: rgba(6, 182, 212, 0.1);
}

/* --------------------------------------------------------------------------
   7. PIE DE PÁGINA (FOOTER)
   -------------------------------------------------------------------------- */
.site-footer {
  background-color: #090d16;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 60px 0 30px 0;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.footer-heading {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-brand);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-legal-notice {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 900px;
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE MEDIA QUERIES
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    display: none;
    box-shadow: var(--shadow-lg);
  }
  
  .nav-menu.is-active {
    display: flex;
  }
  
  .nav-toggle {
    display: block;
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .section-title {
    font-size: 1.75rem;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  .header-actions .btn-simulator {
    display: none;
  }
}
