:root {
  --bg-dark: #F8F9FA;
  --bg-card: #FFFFFF;
  --bg-header: #0F172A;
  
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  
  --gold-primary: #D97706;
  
  --accent-blue: #1D4ED8;
  --accent-green: #10B981;
  --accent-red: #EF4444;
  
  --border-subtle: #E5E7EB;
  
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-serif: 'Playfair Display', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: all 0.2s; }

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ════ MEGA HEADER ═════════════════════════════════════ */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

.ticker-bar {
  background: #090E17;
  color: #F8FAFC;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  overflow: hidden;
  font-family: monospace;
}

.ticker-label {
  padding: 0 1.5rem;
  color: var(--gold-primary);
  background: #090E17;
  z-index: 2;
  text-transform: uppercase;
}

.ticker-track {
  white-space: nowrap;
  animation: scroll 30s linear infinite;
}

@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.header-main {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.header-main .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: #0F172A;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span { color: var(--gold-primary); font-style: italic; }

.search-bar {
  flex: 0 1 400px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background: #F1F5F9;
  font-family: var(--font-sans);
}

.header-nav {
  background: var(--bg-card);
}

.header-nav ul {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

.header-nav a {
  display: block;
  padding: 1rem 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid transparent;
}

.header-nav a:hover, .header-nav a.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* ════ LAYOUT GRID ═════════════════════════════════════ */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 3rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (max-width: 1024px) {
  .layout-grid { grid-template-columns: 1fr; }
}

/* ════ HERO NEWS GRID ══════════════════════════════════ */
.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.news-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #0F172A;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.news-card img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: transform 0.5s;
}

.news-card:hover img { transform: scale(1.05); }

.news-content {
  position: relative;
  z-index: 2;
  padding: 2rem;
  background: linear-gradient(0deg, rgba(15,23,42,1) 0%, rgba(15,23,42,0) 100%);
}

.category-tag {
  background: var(--accent-blue);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: inline-block;
}

.hero-lead { height: 500px; }
.hero-lead h2 { font-size: 2.2rem; line-height: 1.2; margin-bottom: 0.5rem; font-family: var(--font-serif); }

.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-sidebar .news-card { height: calc(500px / 3 - 1rem); }
.hero-sidebar .news-content { padding: 1rem 1.5rem; }
.hero-sidebar h2 { font-size: 1.1rem; line-height: 1.3; font-family: var(--font-sans); }

/* ════ MARKET DASHBOARD ════════════════════════════════ */
.market-dashboard {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 3rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.market-item {
  border-right: 1px solid var(--border-subtle);
  padding-right: 1.5rem;
}
.market-item:last-child { border-right: none; }

.market-name { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.market-price { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin: 0.2rem 0; }
.market-change.pos { color: var(--accent-green); }
.market-change.neg { color: var(--accent-red); }

/* ════ LATEST ARTICLES ═════════════════════════════════ */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-subtle);
  position: relative;
}

.section-title::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 60px; height: 2px; background: var(--accent-blue);
}

.list-article {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.list-article img {
  width: 200px; height: 130px; object-fit: cover; border-radius: 4px;
}

.list-article-content h3 {
  font-size: 1.3rem; margin-bottom: 0.5rem; color: var(--text-primary);
}

.list-article-content h3:hover { color: var(--accent-blue); }

.list-article-content p {
  color: var(--text-secondary); font-size: 0.95rem;
}

/* ════ SIDEBAR WIDGETS ═════════════════════════════════ */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--accent-blue);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.widget-title {
  font-size: 1.2rem; font-family: var(--font-sans); text-transform: uppercase;
  margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-subtle);
}

.trending-list li {
  display: flex; gap: 1rem; margin-bottom: 1rem; align-items: center;
}

.trending-num {
  font-size: 2rem; font-weight: 800; color: #E2E8F0; font-family: var(--font-serif);
}

.trending-title { font-size: 0.95rem; font-weight: 600; }
.trending-title:hover { color: var(--accent-blue); }

.widget.newsletter {
  background: #0F172A; color: white; border-top-color: var(--gold-primary);
}

.widget.newsletter .widget-title { border-bottom-color: rgba(255,255,255,0.1); }
.widget.newsletter input { width: 100%; padding: 0.8rem; margin-bottom: 0.5rem; border: none; border-radius: 4px; }
.widget.newsletter button { width: 100%; padding: 0.8rem; background: var(--gold-primary); color: white; border: none; font-weight: bold; border-radius: 4px; cursor: pointer; }

/* ════ BUTTONS ═════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.2rem; border-radius: 4px; font-weight: 600; cursor: pointer;
  border: none;
}
.btn-primary { background: var(--accent-blue); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--text-primary); color: var(--text-primary); }

/* ════ FOOTER ══════════════════════════════════════════ */
.site-footer {
  background: #0F172A;
  color: white;
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; margin-bottom: 3rem; }
.footer-grid h4 { margin-bottom: 1.5rem; color: var(--text-muted); text-transform: uppercase; font-size: 0.9rem; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 0.8rem; }
.footer-grid a { color: #CBD5E1; font-size: 0.95rem; }
.footer-grid a:hover { color: white; }
/* Dropdown Menus */
.header-nav ul li {
    position: relative;
}
.header-nav ul ul.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem 0;
}
.header-nav ul li:hover > ul.sub-menu {
    display: block;
}
.header-nav ul ul.sub-menu li {
    display: block;
    margin: 0;
}
.header-nav ul ul.sub-menu li a {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
}
.header-nav ul ul.sub-menu li a:hover {
    background: var(--background);
    color: var(--primary);
}


/* =========================================
   CUSTOM BINANCE TICKER ENGINE
   ========================================= */

/* Ticker Tape (Front Page) */
.wf-ticker-wrap {
    width: 100%;
    overflow: hidden;
    background: #0F172A;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    white-space: nowrap;
    padding: 0.8rem 0;
    position: relative;
    box-sizing: border-box;
}
.wf-ticker {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: ticker 25s linear infinite;
}
.wf-ticker:hover {
    animation-play-state: paused;
}
@keyframes ticker {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}
.wf-ticker-item {
    display: inline-block;
    padding: 0 2rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.wf-ticker-item .sym { color: var(--text-muted); font-size: 0.8rem; margin-right: 0.5rem; }
.wf-ticker-item .price { margin-right: 0.5rem; }
.wf-ticker-item .change { font-size: 0.85rem; }
.pos { color: #10B981; }
.neg { color: #EF4444; }

/* Grid Cards (Markets Page) */
.wf-market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.wf-market-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.2rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}
.wf-market-card:hover {
    transform: translateY(-3px);
    border-color: var(--gold-primary);
}
.wf-card-sym { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.wf-card-price { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin: 0.5rem 0; }
.wf-card-change { font-size: 0.9rem; font-weight: 600; }

/* Sidebar List (Blog Page) */
.wf-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.wf-sidebar-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.wf-sidebar-list li:last-child {
    border-bottom: none;
}
.wf-sb-sym { font-size: 1.1rem; font-weight: 600; }
.wf-sb-price { font-weight: bold; }
.wf-sb-change { font-size: 0.85rem; font-weight: 600; text-align: right; }


/* HIDE TRADINGVIEW COPYRIGHT NATIVELY */
.tradingview-widget-copyright {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ════ MOBILE RESPONSIVE QUERIES ══════════════════════════════════ */
@media (max-width: 768px) {
  /* Cabecera */
  .header-main .container {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .search-bar {
    display: none; /* Ocultar buscador en móviles para ahorrar espacio */
  }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
  }
  .mobile-toggle {
    display: block !important;
  }
  
  /* Menú Navegación Móvil */
  .header-nav {
    display: none;
    background: #0F172A;
    position: absolute;
    width: 100%;
    z-index: 100;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
  .header-nav.is-open {
    display: block;
  }
  .header-nav ul {
    flex-direction: column;
    gap: 0;
  }
  .header-nav a {
    padding: 1rem 1.5rem;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .header-nav a:hover, .header-nav a.active {
    background: #1E293B;
  }

  /* Ticker */
  .ticker-label {
    display: none;
  }

  /* Grid Layouts */
  .layout-grid {
    grid-template-columns: 1fr;
    padding-top: 1.5rem;
    gap: 2rem;
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-lead {
    height: 350px;
  }
  .hero-sidebar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .hero-sidebar .news-card {
    height: 200px;
  }
  
  /* Dashboard */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .market-item {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1rem;
  }
  .market-item:nth-child(3), .market-item:nth-child(4) {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* Artículos de lista */
  .list-article {
    flex-direction: column;
    gap: 1rem;
  }
  .list-article img {
    width: 100%;
    height: 200px;
  }

  /* Pie de Página */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  .footer-grid a.logo {
    justify-content: center;
  }
  .site-footer p {
    padding-right: 0;
    margin: 0 auto;
  }
  
  /* Componentes internos */
  .glass-container {
    grid-template-columns: 1fr;
    margin: -1rem 1rem 3rem;
  }
  .glass-panel {
    padding: 1.5rem;
  }
  .contact-hero {
    padding: 4rem 0 3rem;
  }
  .academy-hero h1 {
    font-size: 2.5rem;
  }
  .courses-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   GLOBAL RESPONSIVE CLASSES (Mobiles & Tablets)
   ========================================================================== */

/* Default Desktop 2 Columns */
.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Default Desktop Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

/* TABLET (1024px) */
@media (max-width: 1024px) {
    .calculator-grid {
        gap: 1.5rem;
    }
}

/* MOBILE (768px) */
@media (max-width: 768px) {
    /* Collapse Custom Grids */
    .grid-2-cols, 
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    /* Adjust specific paddings for mobile */
    .calculator-grid {
        padding: 1.5rem !important;
    }
    
    /* Adjust Premium Page Boxes */
    .section[style*="padding-top: 8rem"] {
        padding-top: 4rem !important;
    }
}


/* =========================================
   FIX DROPDOWN MENU (Sub-menu)
   ========================================= */

/* Fix Desktop Dropdown Background */
.header-nav ul ul.sub-menu {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-subtle, #E5E7EB);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.header-nav ul ul.sub-menu li a {
    color: var(--text-primary, #111827);
}
.header-nav ul ul.sub-menu li a:hover {
    background: #F1F5F9;
    color: var(--accent-blue, #1D4ED8);
}

/* Fix Mobile Dropdown Overlap & Colors */
@media (max-width: 768px) {
    .header-nav ul ul.sub-menu {
        position: static; /* Pushes content down instead of floating */
        display: none;
        box-shadow: none;
        border: none;
        background: rgba(0,0,0,0.15); /* Slightly darker than nav background */
        padding: 0;
        margin: 0;
        width: 100%;
    }
    .header-nav ul li.mobile-dropdown-open > ul.sub-menu,
    .header-nav ul li:hover > ul.sub-menu {
        display: block !important;
    }
    .header-nav ul ul.sub-menu li a {
        padding-left: 2.5rem; /* Indent child links */
        color: #94A3B8 !important; /* Lighter text for dark background */
        border-bottom: 1px solid rgba(255,255,255,0.02);
    }
    .header-nav ul ul.sub-menu li a:hover {
        background: rgba(255,255,255,0.05);
        color: white !important;
    }
}


/* =========================================
   COOKIE BANNER
   ========================================= */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-header, #0F172A);
    border: 1px solid var(--border-subtle, #334155);
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    z-index: 9999;
    padding: 1.5rem;
    color: var(--text-primary, #F1F5F9);
}

.cookie-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.cookie-content p {
    margin: 0;
    flex: 1 1 300px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.btn-cookie {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accept {
    background: var(--gold-primary, #D4AF37);
    color: #0F172A;
    border: none;
}
.btn-accept:hover {
    background: #E5C158;
}

.btn-reject {
    background: transparent;
    color: #94A3B8;
    border: 1px solid #334155;
}
.btn-reject:hover {
    background: #1E293B;
    color: white;
}

@media (max-width: 768px) {
    .cookie-banner {
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 12px 12px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        padding: 1rem;
    }
    .cookie-buttons {
        width: 100%;
        flex-direction: column;
    }
    .btn-cookie { width: 100%; }
}
