/* Redesigned Premium Stacked Dashboard CSS - Wright Research Inspired */

.iv-dashboard-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scrollMarquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

@keyframes pulseLive {
  0% { transform: scale(0.9); opacity: 0.6; }
  55% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

@keyframes lightSweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

.animate-fade-in {
  animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Scrolling Ticker Wrap */
.iv-ticker-wrap {
  width: 100%;
  overflow: hidden;
  background: rgba(var(--iv-bg-alt-rgb), 0.4);
  border: 1px solid rgba(var(--iv-accent-rgb), 0.12);
  border-radius: 14px;
  margin-bottom: 24px;
  padding: 10px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.iv-ticker {
  display: flex;
  width: max-content;
  white-space: nowrap;
  animation: scrollMarquee 35s linear infinite;
}

.iv-ticker:hover {
  animation-play-state: paused;
}

.iv-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  border-right: 1px solid rgba(var(--iv-accent-rgb), 0.12);
  font-size: 13px;
  font-weight: 500;
}

.iv-ticker-item:last-child {
  border-right: none;
}

.ticker-label {
  color: var(--iv-text-muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.ticker-val {
  color: var(--iv-text);
  font-weight: 700;
}

.ticker-change {
  font-weight: 600;
  font-size: 11px;
}

.ticker-change.up {
  color: var(--iv-success);
}

.ticker-change.down {
  color: var(--iv-danger);
}

.ticker-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

.ticker-badge.fair {
  background: rgba(var(--iv-accent-rgb), 0.1);
  color: var(--iv-accent-light);
  border: 1px solid rgba(var(--iv-accent-rgb), 0.2);
}

.ticker-badge.expensive {
  background: rgba(var(--iv-warning-rgb), 0.1);
  color: var(--iv-warning);
  border: 1px solid rgba(var(--iv-warning-rgb), 0.2);
}

.ticker-badge.overvalued {
  background: rgba(var(--iv-danger-rgb), 0.1);
  color: var(--iv-danger);
  border: 1px solid rgba(var(--iv-danger-rgb), 0.2);
}

.ticker-badge.attractive {
  background: rgba(var(--iv-success-rgb), 0.1);
  color: var(--iv-success);
  border: 1px solid rgba(var(--iv-success-rgb), 0.2);
}

/* Head section (Now single full-width column) */
.iv-home-head {
  display: block;
  width: 100%;
  margin-bottom: 32px;
}

.iv-welcome-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 32px 28px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(var(--iv-accent-rgb), 0.15), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(var(--iv-accent-rgb), 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 100%;
}

/* Large Hero Card Option - covering 75% of screen height to push metrics off-screen on load */
.iv-welcome-card.large-hero {
  min-height: 75vh;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.iv-welcome-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--iv-accent-rgb), 0.05), transparent);
  animation: lightSweep 6s infinite linear;
  pointer-events: none;
}

.iv-engine-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--iv-accent-light);
  background: rgba(var(--iv-accent-rgb), 0.12);
  padding: 6px 14px;
  border-radius: 99px;
  margin-bottom: 18px;
  border: 1px solid rgba(var(--iv-accent-rgb), 0.18);
}

.iv-welcome-card h2 {
  font-size: 32px;
  font-weight: 850;
  margin: 0 0 14px;
  color: var(--iv-text);
  letter-spacing: -0.03em;
  max-width: 800px;
}

.iv-welcome-card.large-hero h2 {
  font-size: 40px;
  line-height: 1.25;
}

.iv-welcome-card p {
  color: var(--iv-text-secondary);
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  max-width: 800px;
}

/* Micro metrics cards */
.iv-home-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.iv-micro-card {
  border: 1px solid rgba(var(--iv-accent-rgb), 0.14);
  background: var(--iv-card-bg);
  border-radius: 20px;
  padding: 20px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.iv-micro-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--iv-accent-rgb), 0.35);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 0 20px rgba(var(--iv-accent-rgb), 0.12);
}

.iv-micro-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--iv-text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.iv-mini-icon {
  color: var(--iv-accent-light);
  font-weight: 700;
}

.iv-metric-flex {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.iv-micro-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--iv-accent-light);
  letter-spacing: -0.02em;
}

.iv-status-badge {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.iv-status-badge.success {
  background: rgba(var(--iv-success-rgb), 0.1);
  color: var(--iv-success);
  border: 1px solid rgba(var(--iv-success-rgb), 0.18);
}

.iv-status-badge.warn {
  background: rgba(var(--iv-accent-rgb), 0.1);
  color: var(--iv-accent-light);
  border: 1px solid rgba(var(--iv-accent-rgb), 0.18);
}

.iv-status-badge.info {
  background: rgba(var(--iv-info-rgb), 0.1);
  color: var(--iv-info);
  border: 1px solid rgba(var(--iv-info-rgb), 0.18);
}

.iv-gauge-bar {
  width: 100%;
  height: 5px;
  background: rgba(var(--iv-accent-rgb), 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

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

.iv-gauge-fill.valuation-fair {
  background: var(--iv-accent);
}

.iv-gauge-fill.gawp-active {
  background: var(--iv-success);
}

.iv-gauge-fill.health-good {
  background: var(--iv-success);
}

.iv-gauge-fill.tailwind-stable {
  background: var(--iv-info);
}

.iv-micro-sub {
  font-size: 11px;
  color: var(--iv-text-secondary);
  line-height: 1.4;
}

/* Scroll Reveal Effect Styles - Sliding up 140px from below bottom fold */
.iv-reveal-item {
  opacity: 0;
  transform: translateY(140px) scale(0.95);
  transition: 
    opacity 1s cubic-bezier(0.16, 1, 0.3, 1), 
    transform 1s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.iv-reveal-item.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Staggered load delays for Micro Metrics */
.iv-home-metrics .iv-micro-card:nth-child(1) { transition-delay: 0s; }
.iv-home-metrics .iv-micro-card:nth-child(2) { transition-delay: 0.1s; }
.iv-home-metrics .iv-micro-card:nth-child(3) { transition-delay: 0.2s; }
.iv-home-metrics .iv-micro-card:nth-child(4) { transition-delay: 0.3s; }

/* Dashboard Mobile Tabs (Hidden on Desktop) */
.iv-dashboard-tabs {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 16px 0;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.iv-dashboard-tabs::-webkit-scrollbar {
  display: none;
}

.iv-tab-btn {
  background: transparent;
  border: none;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--iv-text-secondary);
  cursor: pointer;
  border-radius: 99px;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  white-space: nowrap;
}

.iv-tab-btn.active {
  background: #121316 !important;
  color: #FFFFFF !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .iv-tab-btn.active {
  background: #FFFFFF !important;
  color: #121316 !important;
}

.iv-tab-btn:hover:not(.active) {
  color: var(--iv-text);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .iv-tab-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
}

/* Vertical Stacked Card Deck Scrolling Effect */
.iv-stacked-deck {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 40px;
}

.iv-stacked-card {
  position: sticky;
  border: 1px solid rgba(var(--iv-accent-rgb), 0.15);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 48px;
  box-shadow: var(--iv-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  background: #FAF8F4;
  transition: all 0.3s ease;
}

[data-theme="dark"] .iv-stacked-card {
  background: #121316;
}


/* Overlapping Stacking offsets */
#stackedCard1 {
  top: 90px;
  z-index: 1;
}

#stackedCard2 {
  top: 90px;
  z-index: 2;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2), var(--iv-shadow);
}

#stackedCard3 {
  top: 90px;
  z-index: 3;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.3), var(--iv-shadow);
}

/* Crazy Hover Effects for Stacked Cards */
.iv-stacked-card:hover {
  transform: scale(1.008) translateY(-4px);
  border-color: rgba(var(--iv-accent-rgb), 0.45);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.35), 
    0 0 35px rgba(var(--iv-accent-rgb), 0.22),
    0 -10px 30px rgba(0, 0, 0, 0.25);
}

.iv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.header-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.iv-stacked-num {
  font-size: 32px;
  font-weight: 850;
  color: rgba(var(--iv-accent-rgb), 0.18);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 0.9;
  letter-spacing: -0.05em;
  transition: color 0.3s ease;
}

.iv-stacked-card:hover .iv-stacked-num {
  color: rgba(var(--iv-accent-rgb), 0.55);
}

.iv-card-header h3 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--iv-accent-light);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.iv-card-header p {
  color: var(--iv-text-secondary);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
}

.iv-card-tag {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  color: var(--iv-text-muted);
  border: 1px solid var(--iv-border-subtle);
  padding: 4px 12px;
  border-radius: 8px;
  text-transform: uppercase;
}

.iv-card-tag.compound {
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
  background: rgba(99, 102, 241, 0.06);
}

.iv-card-tag.analysis {
  border-color: rgba(236, 72, 153, 0.3);
  color: #f472b6;
  background: rgba(236, 72, 153, 0.06);
}

.iv-card-tag.global {
  border-color: rgba(167, 139, 250, 0.3);
  color: #c084fc;
  background: rgba(167, 139, 250, 0.06);
}

/* Tools Grid inside Stacked Card */
.iv-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* Card 3 specific grid alignment */
#stackedCard3 .iv-quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Crazy Hover Effects for Quick Tool Cards */
.iv-quick-tool {
  background: rgba(var(--iv-bg-rgb), 0.35);
  border: 1px solid rgba(var(--iv-accent-rgb), 0.15);
  border-radius: 18px;
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.iv-quick-tool:hover {
  border-color: rgba(var(--iv-accent-rgb), 0.6);
  background: linear-gradient(135deg, rgba(var(--iv-accent-rgb), 0.09), rgba(255, 255, 255, 0.02));
  transform: translateY(-8px) scale(1.035);
  box-shadow: 
    0 15px 35px rgba(0, 0, 0, 0.3), 
    0 0 25px rgba(var(--iv-accent-rgb), 0.22);
}

.tool-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Rotating Interactive Icon */
.iv-quick-tool .iv-mini-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(var(--iv-accent-rgb), 0.12);
  border: 1px solid rgba(var(--iv-accent-rgb), 0.22);
  color: var(--iv-accent-light);
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.iv-quick-tool:hover .iv-mini-icon {
  transform: scale(1.25) rotate(360deg);
  background: linear-gradient(135deg, var(--iv-accent-light), var(--iv-accent));
  color: var(--iv-bg);
  border-color: var(--iv-accent);
  box-shadow: 0 0 15px rgba(var(--iv-accent-rgb), 0.5);
}

.tool-badge {
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.tool-badge.compound {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
}

.tool-badge.cashflow {
  background: rgba(244, 63, 94, 0.1);
  color: #fb7185;
}

.tool-badge.growth {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.tool-badge.index {
  background: rgba(167, 139, 250, 0.1);
  color: #c084fc;
}

.tool-badge.returns {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

.tool-badge.ranking {
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
}

.tool-badge.analysis {
  background: rgba(236, 72, 153, 0.1);
  color: #f472b6;
}

.iv-quick-tool:hover .tool-badge {
  transform: scale(1.05);
}

.tool-body b {
  display: block;
  font-size: 14.5px;
  font-weight: 750;
  color: var(--iv-text);
  margin-bottom: 5px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.tool-body small {
  display: block;
  color: var(--iv-text-secondary);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.4;
}

/* Directory Button inside last tool */
.iv-primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--iv-accent);
  color: var(--iv-bg);
  border: 1px solid rgba(var(--iv-accent-rgb), 0.24);
  padding: 14px 24px;
  border-radius: 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.iv-primary-btn:hover {
  background: var(--iv-accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--iv-accent-rgb), 0.25);
}

.arrow-btn {
  transition: transform 0.2s ease;
}

.iv-primary-btn:hover .arrow-btn {
  transform: translateX(3px);
}

/* Discipline Card (Full Width Bottom) */
.iv-discipline-card {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(var(--iv-accent-rgb), 0.04), rgba(255, 255, 255, 0.01));
  border-color: rgba(var(--iv-accent-rgb), 0.15);
  border-radius: 24px;
  padding: 24px 32px;
}

.iv-card-tag.warning {
  border-color: rgba(var(--iv-accent-rgb), 0.3);
  color: var(--iv-accent-light);
  background: rgba(var(--iv-accent-rgb), 0.05);
}

.iv-note {
  font-size: 11.5px;
  color: var(--iv-text-secondary);
  line-height: 1.6;
  border-left: 2px solid rgba(var(--iv-accent-rgb), 0.3);
  padding-left: 12px;
  margin-top: 14px;
}

/* Responsive */
@media (max-width: 980px) {
  .iv-home-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .iv-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  
  .iv-stacked-card {
    padding: 24px;
  }

  .iv-welcome-card.large-hero {
    min-height: 60vh;
    padding: 40px 32px;
  }

  .iv-welcome-card.large-hero h2 {
    font-size: 32px;
  }
}

@media (max-width: 768px) {
  .iv-dashboard-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px 0 16px 0;
    margin-bottom: 8px;
  }

  .iv-tab-btn {
    padding: 8px 4px;
    font-size: 11px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 12px;
  }

  .iv-stacked-card {
    display: none;
    position: relative !important;
    top: auto !important;
    margin-bottom: 32px !important;
  }

  .iv-stacked-card.active-tab {
    display: block !important;
  }
  
  #stackedCard1, #stackedCard2, #stackedCard3 {
    top: auto !important;
    position: relative !important;
  }
}

@media (max-width: 600px) {
  .iv-quick-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  
  .iv-home-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .iv-welcome-card.large-hero {
    min-height: 50vh;
    padding: 32px 20px;
  }

  .iv-welcome-card.large-hero h2 {
    font-size: 26px;
    margin-bottom: 10px;
  }

  .iv-welcome-card.large-hero p {
    font-size: 14px;
  }
}

.iv-protocol-list {
  margin: 18px 0 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style-type: decimal;
}

.iv-protocol-list li {
  font-size: 13px;
  color: var(--iv-text-secondary);
  line-height: 1.6;
}

.iv-protocol-list li strong {
  color: var(--iv-accent-light);
  font-weight: 700;
}


