/* ==========================================================================
   POCKETVEST - SISTEMA DE DISEÑO UI OSCURO, GLASSMORPHISM & NEON ACCENTS
   ========================================================================== */

:root {
  --bg-main: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(16, 185, 129, 0.3);

  /* Primary Neon Palette */
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --indigo-accent: #6366f1;
  --indigo-glow: rgba(99, 102, 241, 0.25);
  --cyan-accent: #06b6d4;
  --amber-warning: #f59e0b;
  --rose-danger: #f43f5e;

  /* Text Colors */
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-sub: #6b7280;

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Layout */
  --container-width: 1240px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 40%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* --- HEADER & NAVEGACIÓN --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  padding: 1rem 2rem;
}

.nav-container {
  max-width: var(--container-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
}

.logo-icon {
  font-size: 1.5rem;
}

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

.header-badge {
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  margin-left: 8px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

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

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

/* --- HERO SECTION --- */
.hero-section {
  max-width: var(--container-width);
  margin: 3rem auto 4rem auto;
  padding: 0 1.5rem;
  text-align: center;
}

.hero-tag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.12);
  color: var(--indigo-accent);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.2rem;
  max-width: 950px;
  margin-left: auto;
  margin-right: auto;
}

.gradient-text {
  background: linear-gradient(135deg, var(--emerald-primary), var(--cyan-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 780px;
  margin: 0 auto 2.5rem auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  padding: 1.2rem 2rem;
  border-radius: var(--radius-md);
  min-width: 200px;
}

.stat-val {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--emerald-primary);
}

.stat-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- SECCIONES PRINCIPALES --- */
.main-section {
  max-width: var(--container-width);
  margin: 4rem auto;
  padding: 0 1.5rem;
}

.section-header {
  margin-bottom: 2rem;
}

.section-tag {
  color: var(--emerald-primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  margin: 0.4rem 0;
}

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

/* --- GLASS PANELS --- */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* --- SECCIÓN ASESOR AI --- */
.advisor-container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .advisor-container {
    grid-template-columns: 1fr;
  }
}

.advisor-controls h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.4rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-group label strong {
  color: var(--emerald-primary);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--emerald-primary);
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
}

.select-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

.select-input:focus {
  border-color: var(--emerald-primary);
}

.btn-primary {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--emerald-primary), #059669);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--emerald-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.preset-questions {
  margin-top: 1.8rem;
  border-top: 1px solid var(--border-card);
  padding-top: 1.2rem;
}

.preset-questions span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.preset-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-primary);
  border-color: rgba(16, 185, 129, 0.3);
}

.advisor-recommendation-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 0 25px var(--emerald-glow);
}

.rec-header .badge-tag {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.rec-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.advisor-items-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.advisor-item-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.item-header .ticker {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--emerald-primary);
}

.item-amount {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.item-title {
  font-size: 1rem;
  margin-bottom: 4px;
}

.item-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.item-fraction-badge {
  background: rgba(99, 102, 241, 0.12);
  color: var(--indigo-accent);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.advisor-response-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.advisor-response-card h3 {
  font-family: var(--font-heading);
  color: var(--emerald-primary);
  margin-bottom: 1rem;
}

.response-body p {
  margin-bottom: 1rem;
}

.response-body ul {
  padding-left: 1.2rem;
  margin-bottom: 1rem;
}

.response-body li {
  margin-bottom: 8px;
  color: var(--text-muted);
}

.alert-info-box {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.alert-warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
}

/* --- SECCIÓN CALCULADORA --- */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }
}

.calc-panel h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
}

.input-note {
  display: block;
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 4px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .metrics-row {
    grid-template-columns: 1fr 1fr;
  }
}

.metric-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.metric-box .lbl {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-box .val {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.text-blue { color: var(--indigo-accent); }
.text-green { color: #34d399; }
.text-emerald { color: var(--emerald-primary); }
.text-purple { color: #a78bfa; }

.chart-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

/* --- SECCIÓN CATÁLOGO --- */
.catalog-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab:hover, .filter-tab.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  border-color: rgba(16, 185, 129, 0.4);
}

.warning-tab:hover, .warning-tab.active {
  background: rgba(244, 63, 94, 0.15) !important;
  color: var(--rose-danger) !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
}

.search-box input {
  padding: 8px 16px;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  color: var(--text-main);
  width: 280px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--emerald-primary);
}

.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.stock-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.stock-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
}

.warning-card {
  border-color: rgba(244, 63, 94, 0.3);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ticker-badge {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.category-tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.stock-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.stock-sector {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.stock-price-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.price-value {
  font-weight: 700;
  color: var(--emerald-primary);
}

.ratings-block {
  margin-bottom: 1rem;
}

.rating-item {
  margin-bottom: 8px;
}

.rating-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 3px;
  color: var(--text-muted);
}

.bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
}

.fraction-preview {
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
}

.fraction-preview strong {
  color: var(--indigo-accent);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.btn-detail {
  flex: 1;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-detail:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-add-portfolio {
  padding: 8px 14px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-portfolio:hover {
  background: var(--emerald-primary);
  color: #fff;
}

/* --- SECCIÓN PREVENCIÓN DE RIESGOS --- */
.risk-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.risk-card {
  padding: 1.8rem;
  border-radius: var(--radius-lg);
}

.risk-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.risk-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.risk-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.border-red { border: 1px solid rgba(244, 63, 94, 0.3); }
.border-amber { border: 1px solid rgba(245, 158, 11, 0.3); }
.border-purple { border: 1px solid rgba(167, 139, 250, 0.3); }
.border-green { border: 1px solid rgba(16, 185, 129, 0.3); }

/* --- SECCIÓN PORTAFOLIO --- */
.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 800px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
}

.portfolio-list-col h3, .portfolio-chart-col h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 1.2rem;
}

.portfolio-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portfolio-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 10px 14px;

}

.item-info strong {
  display: block;
  color: var(--emerald-primary);
  font-size: 0.95rem;
}

.item-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.item-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 180px;
}

.item-slider span {
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 35px;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--rose-danger);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 6px;
}

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

/* --- MODAL --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-content {
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.2rem;

}

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

.modal-desc {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.modal-metrics-grid .metric-card {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.modal-metrics-grid .lbl {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-metrics-grid .val {
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 550px) {
  .modal-pros-cons {
    grid-template-columns: 1fr;
  }
}

.pros-col h4, .cons-col h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.pros-col ul, .cons-col ul {
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pros-col li, .cons-col li {
  margin-bottom: 6px;
}

/* --- FOOTER --- */
.footer {
  border-top: 1px solid var(--border-card);
  padding: 3rem 1.5rem;
  margin-top: 6rem;
  background: rgba(9, 13, 22, 0.95);
  text-align: center;
}

.footer-container {
  max-width: var(--container-width);
  margin: 0 auto;
}

.footer-disclaimer {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 8px;
}

/* ANIMACIONES */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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