/* ========================================
   AURORA THEME - FUTUREPORT
   Northern Lights Inspired Design
   Deep midnight + radiant cyan/violet gradients
   ======================================== */

:root {
  /* Core Color Palette */
  --bg: #060A12;           /* Main background - deep night sky */
  --bg-2: #0B1324;         /* Secondary background - panels, cards */
  --text: #E8F0FF;         /* High-contrast text */
  --muted: #9FB8D6;        /* Secondary text, labels, captions */

  /* Highlight Colors */
  --ice: #7DD3FC;          /* Cyan - active elements, links, buttons */
  --violet: #A78BFA;       /* Violet - accent gradients, CTAs */

  /* Status Colors */
  --green: #22C55E;        /* Success, gains */
  --rose: #FB7185;         /* Errors, losses */
  --amber: #F59E0B;        /* Warnings, risk */

  /* UI Structure */
  --slate: #13233D;        /* Borders, dividers */
  --ring: #23324d;         /* Focus rings, outlines */

  /* Legacy compatibility */
  --fg: #E8F0FF;
  --fg-dim: rgba(232, 240, 255, 0.8);
  --glass: rgba(14, 23, 42, 0.6);
  --glass-border: rgba(19, 35, 61, 1);
  --ok: #22C55E;
  --bad: #FB7185;
  --accent-purple: #A78BFA;
  --accent-cyan: #7DD3FC;
}

/* ========================================
   BODY & AURORA BACKGROUND
   ======================================== */

body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 600px at 80% -10%, rgba(167,139,250,.16), transparent 65%),
    radial-gradient(800px 500px at 20% 10%, rgba(125,211,252,.18), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(56,189,248,.10), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, system-ui, sans-serif;
  margin: 0;
  padding: 0;
  position: relative;
}

/* Prevent horizontal overflow */
html, body {
  overflow-x: hidden;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Ensure content is above any overlays */
#root, .page, main, header, nav {
  position: relative;
  z-index: 1;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1 {
  font-size: 2.5em;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 24px 0;
  text-align: center;
}

h2 {
  font-size: 1.75em;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 18px 0;
}

h3 {
  font-size: 1.35em;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px 0;
}

label {
  color: var(--text);
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}

/* Responsive typography */
@media (min-width: 1024px) {
  h1 {
    font-size: 2.8em;
    margin-bottom: 28px;
  }
  h2 {
    font-size: 2em;
    margin-bottom: 20px;
  }
  h3 {
    font-size: 1.5em;
    margin-bottom: 16px;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.75em;
    margin-bottom: 16px;
  }
  h2 {
    font-size: 1.35em;
    margin-bottom: 14px;
  }
  h3 {
    font-size: 1.15em;
    margin-bottom: 10px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5em;
    margin-bottom: 12px;
  }
  h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
  }
  h3 {
    font-size: 1.05em;
    margin-bottom: 8px;
  }
}

/* ========================================
   CONTAINERS
   ======================================== */

.glass-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 32px 20px 32px;
  box-sizing: border-box;
}

@media (min-width: 1600px) {
  .glass-container {
    max-width: 1600px;
    padding: 24px 48px;
    gap: 24px;
  }
}

@media (max-width: 1200px) {
  .glass-container {
    max-width: 100%;
    padding: 20px 24px;
    gap: 18px;
  }
}

@media (max-width: 768px) {
  .glass-container {
    padding: 16px;
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .glass-container {
    padding: 12px;
    gap: 12px;
  }
}

/* ========================================
   GLASS CARDS
   ======================================== */

.glass {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 16px;
  padding: 20px;
  margin: 0 auto;
  color: var(--text);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 1px rgba(125, 211, 252, 0.1);
}

.glass-card, .card, .form-container, .portfolio-summary {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 16px;
  padding: 20px;
  color: var(--text);
  box-sizing: border-box;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 1px rgba(125, 211, 252, 0.1);
  margin: 0;
}

@media (min-width: 1024px) {
  .glass {
    padding: 24px;
    border-radius: 18px;
  }

  .glass-card, .card, .form-container, .portfolio-summary {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  .glass {
    padding: 18px;
  }

  .glass-card, .card, .form-container, .portfolio-summary {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .glass {
    padding: 16px;
    border-radius: 16px;
  }

  .glass-card, .card, .form-container, .portfolio-summary {
    padding: 16px;
    border-radius: 16px;
  }
}

/* ========================================
   BUTTONS
   ======================================== */

button, .simulate-btn {
  background: linear-gradient(135deg, var(--ice), var(--violet));
  color: var(--bg);
  border: none;
  font-weight: bold;
  padding: 12px 24px;
  margin-top: 15px;
  border-radius: 16px;
  cursor: pointer;
  max-width: 250px;
  margin: 20px auto;
  display: block;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(125, 211, 252, 0.3);
}

button:hover, .simulate-btn:hover {
  background: linear-gradient(135deg, #9EEFFF, #C3B3FF);
  box-shadow: 0 6px 20px rgba(125, 211, 252, 0.5);
  transform: translateY(-2px);
  color: var(--bg);
}

.btn {
  padding: 14px 28px;
  border-radius: 16px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  max-width: none;
  margin: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ice), var(--violet));
  color: var(--bg);
  box-shadow: 0 4px 15px rgba(125, 211, 252, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #9EEFFF, #C3B3FF);
  box-shadow: 0 6px 20px rgba(125, 211, 252, 0.5);
  transform: translateY(-2px);
  color: var(--bg);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--ring);
}

.btn-secondary:hover {
  background: rgba(125, 211, 252, 0.1);
  border-color: var(--ice);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-icon {
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  button, .simulate-btn {
    font-size: 16px;
    padding: 13px 28px;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  button, .simulate-btn {
    font-size: 14px;
    padding: 10px 20px;
  }
}

/* ========================================
   INPUTS & FORMS
   ======================================== */

input, select, textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px 15px;
  margin: 10px 0;
  font-size: 16px;
  border: 1px solid var(--slate);
  border-radius: 16px;
  background: var(--bg-2);
  color: var(--text);
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ice);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.15);
}

.form-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  max-width: 100%;
  margin: 0;
}

.dropdown {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--slate);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 16px;
  font-family: inherit;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23E8F0FF' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 40px;
  transition: background-color 0.3s ease;
  cursor: pointer;
}

.dropdown:hover {
  background-color: rgba(11, 19, 36, 0.8);
}

input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--slate);
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  backdrop-filter: blur(12px);
  cursor: pointer;
}

@media (min-width: 768px) {
  input, select, textarea {
    font-size: 16px;
    padding: 13px 18px;
  }
}

@media (max-width: 480px) {
  input, select, textarea {
    font-size: 14px;
    padding: 10px 14px;
  }
}

/* ========================================
   TOGGLE SWITCH (APPLE STYLE)
   ======================================== */

.toggle-wrapper {
  display: flex;
  align-items: center;
  margin-top: 20px;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #555;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background: linear-gradient(135deg, var(--ice), var(--violet));
  box-shadow: 0 2px 8px rgba(125, 211, 252, 0.4);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* ========================================
   KPI GRID
   ======================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.kpi {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14, 23, 42, 0.7);
  border: 1px solid rgba(125, 211, 252, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(125, 211, 252, 0.2);
}

@media (max-width: 480px) {
  .kpi {
    padding: 10px 12px;
  }
}

.kpi .v {
  font-weight: 600;
  font-size: 20px;
  color: var(--text);
}

.kpi .l {
  opacity: .75;
  font-size: 13px;
  margin-top: 4px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .kpi .v { font-size: 18px; }
  .kpi .l { font-size: 12px; }
}

/* ========================================
   CHARTS
   ======================================== */

.chart-container {
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow: auto;
}

.plot-container .svg-container {
  max-width: 100% !important;
  height: auto !important;
}

/* Plotly transparency fix */
.js-plotly-plot .plotly,
.plotly .svg-container {
  background-color: transparent !important;
}

/* Chart block container */
.chart-block {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

#growth-chart,
#pie-chart {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 380px;
  max-height: 550px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

@media (min-width: 1024px) {
  #growth-chart,
  #pie-chart {
    min-height: 420px;
    max-height: 600px;
  }
}

@media (max-width: 768px) {
  #growth-chart,
  #pie-chart {
    min-height: 320px;
    max-height: 450px;
  }
}

@media (max-width: 480px) {
  #growth-chart,
  #pie-chart {
    min-height: 260px;
    max-height: 360px;
  }

  /* Ensure charts are fully visible on small screens */
  .chart-block {
    margin: 0;
    padding: 0;
  }
}

/* ========================================
   NAVIGATION
   ======================================== */

#main-nav {
  background: rgba(8, 12, 22, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid #0f1a2d;
  border-radius: 18px;
  padding: 12px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

  /* Enhanced sticky positioning */
  position: -webkit-sticky;
  position: sticky;
  top: 16px;
  z-index: 9999;
  will-change: transform;
  transition: all 0.3s ease;
}

#main-nav.scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  background: rgba(8, 12, 22, 0.9);
}

@media (max-width: 768px) {
  #main-nav {
    top: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
  }
}

#main-nav .logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--ice), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#main-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

#main-nav .nav-link {
  padding: 10px 18px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}

#main-nav .nav-link:hover {
  color: var(--text);
  background: rgba(125, 211, 252, 0.1);
  border-color: var(--ice);
}

#main-nav .nav-link.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.2), rgba(167, 139, 250, 0.2));
  border-color: var(--ice);
  box-shadow: 0 4px 12px rgba(125, 211, 252, 0.3);
}

#main-nav .nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

#main-nav .nav-user-info {
  font-size: 0.9rem;
  color: var(--muted);
}

#main-nav .nav-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ice), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s ease;
}

#main-nav .nav-user-avatar:hover {
  transform: scale(1.1);
}

/* Mobile Nav */
#mobile-nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 10px;
  margin: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  #main-nav .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    flex-direction: column;
    background: rgba(8, 12, 22, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--ice);
    border-radius: 18px;
    padding: 12px;
    z-index: 1000;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    animation: mobileNavSlideIn 0.3s ease-out;
  }

  #main-nav .nav-links.mobile-visible {
    display: flex;
  }

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

  #mobile-nav-toggle {
    display: block;
  }

  #main-nav {
    flex-wrap: wrap;
  }

  #main-nav .nav-link {
    width: 100%;
  }
}

/* ========================================
   MOBILE TOUCH BEHAVIOR
   ======================================== */

.js-plotly-plot,
.plotly,
.plot-container,
.chart-container,
.chart-block,
#growth-chart,
#pie-chart,
#stock-predictions-chart,
#portfolio-projection-chart,
#correlation-heatmap,
#heatmap-viz,
#sector-chart,
#prediction-block,
#prediction-horizon-block,
#news-signal-block,
.js-plotly-plot .plotly,
.js-plotly-plot .svg-container,
[class*="plotly"],
[id*="chart"],
[id*="heatmap"] {
  touch-action: manipulation !important;
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 768px) {
  .js-plotly-plot,
  .plotly,
  .plot-container,
  .chart-container {
    touch-action: manipulation !important;
    pointer-events: auto !important;
  }

  .modebar,
  .modebar-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .modebar-btn {
    padding: 8px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }

  .js-plotly-plot .plotly .main-svg,
  .js-plotly-plot .svg-container {
    pointer-events: auto !important;
    touch-action: manipulation !important;
  }

  .draglayer,
  .nsewdrag,
  .drag {
    pointer-events: auto !important;
    touch-action: none !important;
  }

  .chart-container,
  .chart-block {
    padding: 4px;
    isolation: isolate;
  }
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

#fp-loader {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

#fp-loader .fp-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#fp-loader .fp-loader-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(14, 23, 42, 0.95);
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 16px;
  padding: 24px 28px;
  color: var(--text);
  min-width: 220px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(125, 211, 252, 0.3);
}

#fp-loader .fp-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(125, 211, 252, 0.2);
  border-top-color: var(--ice);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: fp-spin 1s linear infinite;
  box-shadow: 0 0 15px rgba(125, 211, 252, 0.3);
}

@keyframes fp-spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   CHIPS & BADGES
   ======================================== */

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(14, 23, 42, 0.7);
  border: 1px solid rgba(125, 211, 252, 0.12);
  font-size: 13px;
}

.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--slate);
  opacity: .9;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  min-height: 40px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.2), rgba(167, 139, 250, 0.15));
  border: 1px solid var(--ice);
  border-radius: 20px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

.pill span {
  color: var(--text);
}

.pill button.rm {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0 0 0 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  box-shadow: none;
  max-width: none;
}

.pill button.rm:hover {
  background: rgba(251, 113, 133, 0.3);
  color: var(--text);
  transform: scale(1.1);
}

/* ========================================
   NEWS LIST
   ======================================== */

.news-list {
  list-style: none;
  margin: 12px 0 0 0;
  padding: 0;
}

.news-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--slate);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.news-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  opacity: .8;
  font-size: 12px;
  color: var(--muted);
}

.score-pos {
  color: var(--green);
}

.score-neg {
  color: var(--rose);
}

a.news-link {
  color: var(--text);
  text-decoration: none;
}

a.news-link:hover {
  text-decoration: underline;
}

.fav {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
  background: #333;
}

/* ========================================
   SKELETON LOADERS
   ======================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(125, 211, 252, 0.08) 0%,
    rgba(167, 139, 250, 0.12) 50%,
    rgba(125, 211, 252, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
  border-radius: 4px;
}

.skeleton-text.large {
  height: 24px;
}

.skeleton-text.small {
  height: 12px;
}

.skeleton-heading {
  height: 28px;
  width: 60%;
  margin: 12px 0;
  border-radius: 6px;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-button {
  height: 44px;
  width: 120px;
  border-radius: 12px;
}

.skeleton-card {
  background: rgba(14, 23, 42, 0.5);
  border: 1px solid rgba(125, 211, 252, 0.1);
  border-radius: 16px;
  padding: 20px;
  margin: 12px 0;
}

.skeleton-chart {
  height: 400px;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    rgba(125, 211, 252, 0.08) 0%,
    rgba(167, 139, 250, 0.08) 100%
  );
  position: relative;
  overflow: hidden;
}

.skeleton-chart::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(232, 240, 255, 0.1) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 2s ease-in-out infinite;
}

/* ========================================
   TOOLTIPS
   ======================================== */

.fp-tooltip-container {
  position: relative;
}

.fp-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fp-tooltip-icon:hover {
  opacity: 1 !important;
  transform: scale(1.1);
}

.fp-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: rgba(8, 12, 22, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--ice);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 250px;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
              0 0 20px rgba(125, 211, 252, 0.3);
  white-space: normal;
  text-align: left;
}

.fp-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgba(8, 12, 22, 0.98);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

.fp-tooltip-container:hover .fp-tooltip,
.fp-tooltip-icon:hover + .fp-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .fp-tooltip {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(5px);
    min-width: 220px;
    max-width: 280px;
    font-size: 12px;
  }

  .fp-tooltip::after {
    left: auto;
    right: 20px;
    transform: translateX(0);
  }

  .fp-tooltip-container:hover .fp-tooltip,
  .fp-tooltip-icon:hover + .fp-tooltip {
    transform: translateX(0) translateY(0);
  }
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

@keyframes slideIn {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.1);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes fpPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.fp-data-updated {
  animation: fpPulse 0.6s ease-in-out;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 10px;
  margin: 4px;
  border: 1px solid var(--slate);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.85), rgba(167, 139, 250, 0.85));
  border-radius: 10px;
  border: 2px solid rgba(6, 10, 18, 0.5);
  transition: background 0.3s ease;
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.3);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(158, 239, 255, 1), rgba(195, 179, 255, 1));
  box-shadow: 0 0 15px rgba(125, 211, 252, 0.6);
}

::-webkit-scrollbar-thumb:active {
  background: linear-gradient(135deg, #9EEFFF, #C3B3FF);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 211, 252, 0.85) var(--bg);
}

.thin-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.thin-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.5), rgba(167, 139, 250, 0.5));
  border-radius: 6px;
}

/* ========================================
   GRID LAYOUTS
   ======================================== */

.form-summary-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 24px;
  margin-bottom: 0;
  align-items: start;
}

@media (min-width: 1400px) {
  .form-summary-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

@media (max-width: 1024px) {
  .form-summary-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .form-summary-container {
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .form-summary-container {
    gap: 12px;
  }
}

.feature-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 0;
}

@media (min-width: 1024px) {
  .feature-showcase {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
  }
}

@media (min-width: 1400px) {
  .feature-showcase {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .feature-showcase {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ========================================
   PAGE CONTENT
   ======================================== */

#page-content {
  width: 100%;
  animation: fadeIn 0.3s ease-out;
}

.page-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(14, 23, 42, 0.5), rgba(14, 23, 42, 0.3));
  border-radius: 18px;
  border: 1px solid rgba(125, 211, 252, 0.15);
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--ice), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 12px 0;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 768px) {
  .page-header {
    padding: 20px;
    margin-bottom: 24px;
  }

  .page-title {
    font-size: 1.8rem;
  }

  .page-subtitle {
    font-size: 1rem;
  }
}

.section-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, var(--ice), var(--violet));
  border-radius: 2px;
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

@media (max-width: 1024px) {
  .form-summary-container {
    flex-direction: column;
    align-items: stretch;
  }

  .form-summary-container > * {
    flex: 1 1 100%;
    min-width: 100%;
  }

  input, select, textarea, button {
    max-width: 100% !important;
  }

  #tickers {
    max-width: 100% !important;
  }

  .glass-card, .card, .portfolio-summary {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
  }

  .chart-block, #growth-chart, #pie-chart {
    min-height: 340px;
    max-height: 480px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 0;
  }

  .glass-container {
    padding: 12px;
    gap: 12px;
  }

  .form-summary-container {
    gap: 12px;
  }

  label {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .toggle-wrapper {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  #tickers {
    font-size: 14px;
    padding: 10px 12px;
    max-width: 100% !important;
  }

  .portfolio-summary,
  .card,
  .glass-card {
    width: 100% !important;
    margin: 0;
  }

  #action-buttons button {
    width: 100%;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }

  .feature-showcase .glass-card {
    padding: 16px !important;
  }
}

/* Fix z-index for date picker dropdown */
.flatpickr-calendar {
  z-index: 1000 !important;
}

.autocomplete-items {
  z-index: 1000 !important;
}

/* Ticker Search Input Sizing */
#tickerSearch {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Inline ticker search loading spinner */
#tickerSearch.searching {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='%237DD3FC' stroke-width='2' stroke-dasharray='12.5 37.7' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 10 10' to='360 10 10' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 18px 18px;
  padding-right: 45px;
}

/* ========================================
   ADDITIONAL COMPONENTS
   (News cards, horizon selector, alerts, etc.)
   ======================================== */

.horizon-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.horizon-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--slate);
  background: rgba(14, 23, 42, 0.6);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  margin: 0;
  max-width: none;
  box-shadow: none;
}

.horizon-btn:hover {
  background: rgba(125, 211, 252, 0.1);
  border-color: var(--ice);
}

.horizon-btn.active {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.3), rgba(167, 139, 250, 0.2));
  border-color: var(--ice);
  color: var(--text);
}

@media (max-width: 768px) {
  .horizon-selector {
    width: 100%;
  }

  .horizon-btn {
    flex: 1;
    min-width: calc(50% - 4px);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  text-align: center;
  padding: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(125, 211, 252, 0.1);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.35);
  border-color: rgba(125, 211, 252, 0.25);
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-icon {
    font-size: 2rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 16px;
  }
}

/* Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .quick-actions-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Action Cards */
.action-card {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 180px;
  justify-content: center;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  width: 100%;
}

.action-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 32px rgba(125, 211, 252, 0.3);
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(14, 23, 42, 0.85);
}

.action-card:active {
  transform: translateY(-2px);
}

.action-icon {
  color: var(--ice);
  margin-bottom: 8px;
  filter: drop-shadow(0 0 16px rgba(125, 211, 252, 0.5));
}

.action-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.action-description {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .action-card {
    padding: 18px;
    min-height: 160px;
  }
}

@media (max-width: 480px) {
  .action-card {
    padding: 16px;
    min-height: 140px;
  }

  .action-title {
    font-size: 1.1rem;
  }

  .action-description {
    font-size: 0.9rem;
  }
}

/* Grid Containers for Card Items */
.market-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.watchlist-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.trending-stocks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Portfolio Configuration Grid (Select Assets + Analysis Configuration) */
.portfolio-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .portfolio-config-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
  .market-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
  }

  .sector-heatmap-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
  }

  .watchlist-grid,
  .trending-stocks-list {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .portfolio-config-grid {
    gap: 16px;
  }

  .market-overview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .sector-heatmap-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .watchlist-grid,
  .trending-stocks-list {
    gap: 8px;
  }
}

/* Portfolio History Items (Recent Analysis) */
.portfolio-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portfolio-history-item {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.portfolio-history-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(14, 23, 42, 0.85);
}

.portfolio-history-icon {
  color: var(--ice);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portfolio-history-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.portfolio-history-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.portfolio-history-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.portfolio-history-result {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

@media (max-width: 768px) {
  .portfolio-history-list {
    gap: 10px;
  }

  .portfolio-history-item {
    padding: 12px;
    gap: 12px;
  }

  .portfolio-history-title {
    font-size: 0.95rem;
  }

  .portfolio-history-meta {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .portfolio-history-list {
    gap: 8px;
  }

  .portfolio-history-item {
    padding: 10px;
    gap: 10px;
  }
}

/* Market Overview Stats */
.market-stat {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.market-stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(14, 23, 42, 0.85);
}

.market-stat-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.market-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 768px) {
  .market-stat {
    padding: 12px;
  }

  .market-stat-label {
    font-size: 0.85rem;
  }

  .market-stat-value {
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  .market-stat {
    padding: 10px;
  }
}

/* Watchlist Items */
.watchlist-item {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 12px;
  padding: 14px;
  padding-right: 45px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 8px 12px;
  cursor: pointer;
  position: relative;
}

.watchlist-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(14, 23, 42, 0.85);
}

.watchlist-remove-btn {
  position: absolute !important;
  z-index: 10;
}

.watchlist-ticker {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ice);
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
}

.watchlist-name {
  font-size: 0.9rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.watchlist-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  grid-column: 3;
  grid-row: 1;
}

.watchlist-change {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  grid-column: 3;
  grid-row: 2;
}

@media (max-width: 768px) {
  .watchlist-item {
    padding: 12px;
    padding-right: 40px;
    gap: 6px 10px;
  }

  .watchlist-ticker {
    font-size: 0.95rem;
  }

  .watchlist-name {
    font-size: 0.85rem;
  }

  .watchlist-price {
    font-size: 0.9rem;
  }

  .watchlist-change {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .watchlist-item {
    padding: 10px;
    padding-right: 35px;
    gap: 4px 8px;
  }

  .watchlist-ticker {
    font-size: 0.9rem;
  }

  .watchlist-name {
    font-size: 0.8rem;
  }

  .watchlist-price {
    font-size: 0.85rem;
  }

  .watchlist-change {
    font-size: 0.75rem;
  }
}

/* Sector Heatmap Items */
.sector-heatmap-item {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.sector-heatmap-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(14, 23, 42, 0.85);
}

.sector-heatmap-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  z-index: 1;
}

.sector-heatmap-change {
  font-size: 1.2rem;
  font-weight: 700;
  z-index: 1;
}

.sector-heatmap-badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 8px;
  align-self: flex-start;
  z-index: 1;
}

@media (max-width: 768px) {
  .sector-heatmap-item {
    padding: 12px;
  }

  .sector-heatmap-name {
    font-size: 0.95rem;
  }

  .sector-heatmap-change {
    font-size: 1.1rem;
  }

  .sector-heatmap-badge {
    font-size: 0.8rem;
    padding: 3px 10px;
  }
}

@media (max-width: 480px) {
  .sector-heatmap-item {
    padding: 10px;
  }
}

/* Trending Stock Items */
.trending-stock-item {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.trending-stock-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(14, 23, 42, 0.85);
}

.trending-stock-rank {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ice);
  min-width: 32px;
  text-align: center;
}

.trending-stock-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trending-stock-ticker {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.trending-stock-name {
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trending-stock-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  min-width: 80px;
}

.trending-stock-change {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
  min-width: 80px;
}

@media (max-width: 768px) {
  .trending-stock-item {
    padding: 12px;
    gap: 12px;
  }

  .trending-stock-rank {
    font-size: 1.1rem;
    min-width: 28px;
  }

  .trending-stock-ticker {
    font-size: 0.95rem;
  }

  .trending-stock-name {
    font-size: 0.8rem;
  }

  .trending-stock-price {
    font-size: 0.9rem;
    min-width: 70px;
  }

  .trending-stock-change {
    font-size: 0.85rem;
    min-width: 70px;
  }
}

@media (max-width: 480px) {
  .trending-stock-item {
    padding: 10px;
    gap: 10px;
  }
}

/* Analysis Insights */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.insight-item {
  background: rgba(14, 23, 42, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(125, 211, 252, 0.15);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.insight-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(125, 211, 252, 0.2);
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(14, 23, 42, 0.85);
}

.insight-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.insight-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 768px) {
  .insights-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
  }

  .insight-item {
    padding: 12px;
  }

  .insight-label {
    font-size: 0.85rem;
  }

  .insight-value {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .insights-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .insight-item {
    padding: 10px;
  }

  .insight-label {
    font-size: 0.8rem;
  }

  .insight-value {
    font-size: 1.1rem;
  }
}

/* Portfolio Presets */
.portfolio-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.preset-btn {
  background: rgba(14, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 12px;
  padding: 12px 20px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: inherit;
  white-space: nowrap;
}

.preset-btn:hover {
  background: rgba(14, 23, 42, 0.85);
  border-color: rgba(125, 211, 252, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(125, 211, 252, 0.25);
}

.preset-btn:active {
  transform: translateY(0);
}

.preset-btn.active {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.2), rgba(167, 139, 250, 0.2));
  border-color: var(--ice);
  box-shadow: 0 0 20px rgba(125, 211, 252, 0.4);
}

.preset-icon {
  color: var(--ice);
  display: flex;
  align-items: center;
}

@media (max-width: 768px) {
  .portfolio-presets {
    gap: 10px;
  }

  .preset-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .portfolio-presets {
    flex-direction: column;
    gap: 8px;
  }

  .preset-btn {
    width: 100%;
    justify-content: center;
  }
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(125, 211, 252, 0.15);
  border-top-color: var(--ice);
  border-right-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(125, 211, 252, 0.4);
}

.loading-state p {
  color: var(--muted);
  font-size: 1rem;
}

.status-message {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid var(--ice);
  color: var(--ice);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-message {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid var(--rose);
  color: var(--rose);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ========================================
   PREDICTION CHARTS MOBILE RESPONSIVE
   ======================================== */

#prediction-card {
  overflow-x: hidden;
}

#prediction-horizon-block .glass > div[style*="grid-template-columns"] {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px !important;
}

#stock-predictions-chart,
#portfolio-projection-chart {
  width: 100% !important;
  max-width: 100% !important;
  height: 350px !important;
  min-height: 300px !important;
  overflow: hidden !important;
}

#prediction-horizon-block table {
  font-size: 0.85rem;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#prediction-horizon-block thead {
  display: table;
  width: 100%;
  table-layout: fixed;
}

#prediction-horizon-block tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

#prediction-horizon-block th,
#prediction-horizon-block td {
  padding: 8px 6px !important;
  font-size: 0.8rem !important;
}

#prediction-horizon-block .glass > div[style*="flex"] {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 12px !important;
}

#prediction-horizon-block h3 {
  font-size: 1.1rem !important;
}

#prediction-horizon-block h4 {
  font-size: 0.95rem !important;
  margin-bottom: 8px !important;
}

@media (max-width: 768px) {
  #stock-predictions-chart,
  #portfolio-projection-chart {
    height: 280px !important;
    min-height: 280px !important;
    max-height: 320px !important;
  }

  .horizon-selector {
    justify-content: space-between;
  }

  .horizon-btn {
    flex: 1 1 calc(50% - 4px);
    padding: 8px 12px;
    font-size: 0.85rem;
    min-width: 0;
    text-align: center;
  }

  #prediction-horizon-block .glass > div:first-child {
    padding: 12px !important;
    margin-bottom: 16px !important;
  }

  #prediction-horizon-block table {
    font-size: 0.75rem !important;
  }

  #prediction-horizon-block th:first-child,
  #prediction-horizon-block td:first-child {
    position: sticky !important;
    left: 0 !important;
    background: rgba(8, 12, 22, 0.95) !important;
    z-index: 2 !important;
  }
}

@media (max-width: 480px) {
  #stock-predictions-chart,
  #portfolio-projection-chart {
    height: 240px !important;
    min-height: 240px !important;
    max-height: 280px !important;
  }

  .horizon-btn {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  #prediction-horizon-block h3 {
    font-size: 1rem !important;
  }

  #prediction-horizon-block table {
    font-size: 0.7rem !important;
  }

  #prediction-horizon-block th,
  #prediction-horizon-block td {
    padding: 6px 4px !important;
  }
}

/* ===========================
   Action Buttons Layout
   =========================== */
.action-buttons-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.action-buttons-row .btn {
  flex: 1 1 auto;
  min-width: 160px;
}

@media (max-width: 768px) {
  .action-buttons-row {
    flex-direction: column;
    gap: 10px;
  }

  .action-buttons-row .btn {
    width: 100%;
  }
}
