/**
 * PSX GenAI Advisor — Final UI Upgrade
 * Premium light enterprise theme · 60-30-10 palette
 */

:root {
  --ux-bg: #F8FAFC;
  --ux-surface: #FFFFFF;
  --ux-navy: #0F172A;
  --ux-navy-soft: #1E293B;
  --ux-emerald: #10B981;
  --ux-gold: #F59E0B;
  --ux-border: #E2E8F0;
  --ux-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --ux-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --ux-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Back to Landing ── */
.btn-back-landing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-right: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ux-navy-soft);
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s var(--ux-ease);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.btn-back-landing:hover {
  border-color: var(--ux-emerald);
  color: var(--ux-emerald);
  transform: translateX(-2px);
}

.copilot-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-right: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ux-emerald);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s var(--ux-ease);
  white-space: nowrap;
}
.copilot-open-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

/* ── Reveal / stagger ── */
.ux-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s var(--ux-ease), transform 0.65s var(--ux-ease);
}
.ux-reveal.visible { opacity: 1; transform: translateY(0); }
.ux-stagger > * { opacity: 0; transform: translateY(12px); transition: opacity 0.5s var(--ux-ease), transform 0.5s var(--ux-ease); }
.ux-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: none; }
.ux-stagger.visible > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: none; }
.ux-stagger.visible > *:nth-child(3) { transition-delay: 0.15s; opacity: 1; transform: none; }
.ux-stagger.visible > *:nth-child(4) { transition-delay: 0.2s; opacity: 1; transform: none; }
.ux-stagger.visible > *:nth-child(5) { transition-delay: 0.25s; opacity: 1; transform: none; }
.ux-stagger.visible > *:nth-child(6) { transition-delay: 0.3s; opacity: 1; transform: none; }

/* ── Glass cards ── */
.ux-glass {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--ux-shadow);
}
.ux-card-premium {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--ux-shadow);
  transition: transform 0.25s var(--ux-ease), box-shadow 0.25s var(--ux-ease);
}
.ux-card-premium:hover {
  transform: translateY(-3px);
  box-shadow: var(--ux-shadow-lg);
}

/* ── Dashboard enhancements ── */
.ux-market-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.04), rgba(16, 185, 129, 0.08));
  border: 1px solid var(--ux-border);
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 13px;
}
.ux-market-ribbon strong { color: var(--ux-navy); }
.ux-insight-panel {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 70%, rgba(16, 185, 129, 0.2) 100%);
  color: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--ux-shadow-lg);
}
.ux-insight-panel h2 { margin: 0 0 8px; font-size: 1.35rem; }
.ux-insight-panel p { margin: 0; opacity: 0.88; line-height: 1.6; font-size: 14px; }
.ux-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.ux-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ux-navy-soft);
  text-decoration: none;
  transition: all 0.2s;
}
.ux-quick-action:hover { border-color: var(--ux-emerald); color: var(--ux-emerald); transform: translateY(-2px); }
.kpi .kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: 10px;
}

/* ── Data status ── */
.data-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.data-status-badge.live {
  background: rgba(16, 185, 129, 0.12);
  color: var(--ux-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.data-status-badge.live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ux-emerald);
  animation: ux-pulse 2s ease infinite;
}
.data-status-badge.cached {
  background: rgba(245, 158, 11, 0.12);
  color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
@keyframes ux-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Landing extensions ── */
.landing-premium {
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 45%, #F8FAFC 100%);
  color: var(--ux-navy);
}
.hero-visual-stack { display: flex; flex-direction: column; gap: 12px; }
.hero-heatmap-preview {
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}
.hero-heatmap-preview span { border-radius: 4px; min-height: 100%; }

.ux-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.ux-overview-card {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--ux-shadow);
}
.ux-overview-card:hover,
.ux-benefit-card:hover,
.ux-arch-tile:hover,
.ux-intel-panel:hover,
.landing-team-card:hover,
.screenshot-card:hover {
  box-shadow: var(--ux-shadow-lg);
}
.ux-overview-card .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #64748B; }
.ux-overview-card .val { font-family: 'Poppins', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--ux-navy); margin: 8px 0 4px; }
.ux-overview-card canvas { height: 40px !important; margin-top: 10px; }

.ux-flow-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 400px;
  margin: 0 auto;
}
.ux-flow-node {
  width: 100%;
  max-width: 320px;
  padding: 14px 20px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-left: 4px solid var(--ux-emerald);
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--ux-navy);
  box-shadow: var(--ux-shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.45s var(--ux-ease);
}
.ux-flow-node.visible { opacity: 1; transform: none; }
.ux-flow-line {
  width: 2px;
  height: 24px;
  background: linear-gradient(180deg, var(--ux-emerald), var(--ux-gold));
  opacity: 0;
  transition: opacity 0.3s;
}
.ux-flow-line.visible { opacity: 1; }

.ux-arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
}
.ux-arch-tile {
  padding: 16px 12px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ux-navy-soft);
  transition: transform 0.25s, border-color 0.25s;
  cursor: default;
}
.ux-arch-tile:hover { transform: scale(1.04); border-color: var(--ux-emerald); }
.ux-arch-tile.highlight { background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(245,158,11,0.08)); border-color: var(--ux-emerald); }

.ux-showcase-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 48px;
}
.ux-showcase-row.reverse { direction: rtl; }
.ux-showcase-row.reverse > * { direction: ltr; }
.ux-showcase-visual {
  background: linear-gradient(145deg, #0F172A, #1E293B);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  padding: 24px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--ux-shadow-lg);
}
.ux-showcase-visual canvas { max-height: 180px; }

.ux-benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.ux-benefit-card {
  text-align: center;
  padding: 28px 20px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 14px;
  box-shadow: var(--ux-shadow);
  transition: transform 0.25s;
}
.ux-benefit-card:hover { transform: translateY(-4px); }
.ux-benefit-card .icon { font-size: 32px; margin-bottom: 12px; }
.ux-benefit-card .metric { font-family: 'Poppins', sans-serif; font-size: 2rem; font-weight: 800; color: var(--ux-emerald); }
.ux-benefit-card h4 { margin: 8px 0 6px; color: var(--ux-navy); font-size: 15px; }
.ux-benefit-card p { margin: 0; font-size: 13px; color: #64748B; line-height: 1.5; }

.ux-intel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}
.ux-intel-panel {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 14px;
  padding: 20px;
  min-height: 200px;
}
.ux-intel-panel h4 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: #64748B; }

.ux-gantt {
  max-width: 800px;
  margin: 0 auto;
}
.ux-gantt-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
.ux-gantt-label { font-size: 13px; font-weight: 600; color: var(--ux-navy-soft); }
.ux-gantt-bar-wrap { background: #E2E8F0; border-radius: 8px; height: 28px; overflow: hidden; }
.ux-gantt-bar {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--ux-emerald), var(--ux-gold));
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  transition: width 1s var(--ux-ease);
}

.ux-trust-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.ux-trust-badge {
  padding: 14px 24px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ux-navy);
  box-shadow: var(--ux-shadow);
}
.ux-trust-badge.gold { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.08); }
.ux-trust-badge.emerald { border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.08); }

.landing-team-card {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--ux-shadow);
}
.landing-team-card h3 { color: var(--ux-navy); font-family: 'Poppins', sans-serif; margin: 0 0 10px; font-size: 1rem; }
.landing-team-card p { color: #64748B; font-size: 14px; line-height: 1.6; margin: 0; }

.ux-cta-section {
  text-align: center;
  padding: 64px 32px;
  background: linear-gradient(135deg, #0F172A, #1E293B);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  color: #fff;
  margin: 48px auto;
  max-width: 960px;
  box-shadow: var(--ux-shadow-lg);
}
.ux-cta-section h2 { margin: 0 0 12px; font-size: 2rem; }
.ux-cta-section p { margin: 0 0 28px; opacity: 0.85; }
.ux-cta-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ── Single stock visual shell ── */
.ux-stock-profile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #0F172A, #1E293B);
  border-radius: 16px;
  color: #fff;
  margin-bottom: 24px;
}
.ux-stock-profile .symbol { font-family: 'Poppins', sans-serif; font-size: 2rem; font-weight: 800; }
.ux-stock-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.ux-stock-badge {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
}
.ux-gauge-wrap { width: 80px; height: 80px; position: relative; }
.ux-gauge-wrap canvas { width: 80px !important; height: 80px !important; }

/* ── Shariah premium ── */
.ux-compliance-cert {
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(245,158,11,0.06));
  border: 2px solid rgba(16,185,129,0.3);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  margin-bottom: 24px;
}
.ux-compliance-cert h3 { margin: 0 0 8px; color: var(--ux-navy); }
.ux-ratio-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* ── Portfolio viz row ── */
.ux-portfolio-viz-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.ux-portfolio-viz-row .ux-card-premium { min-height: 200px; }
.ux-portfolio-viz-row h4 { margin: 0 0 12px; font-size: 13px; color: #64748B; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Global polish ── */
body { background: var(--ux-bg) !important; color: var(--ux-navy); }
.landing-premium > section {
  position: relative;
  background: #FFFFFF;
}
.landing-premium > section:nth-of-type(even) {
  background: linear-gradient(180deg, #F8FAFC 0%, #EEF2F7 100%);
}
.landing-premium > section.full-bleed {
  border-top: 1px solid var(--ux-border);
  border-bottom: 1px solid var(--ux-border);
}
.landing-premium #final-cta {
  background: #FFFFFF;
}
.landing-premium #final-cta .btn-hero-secondary {
  background: #FFFFFF !important;
  color: var(--ux-navy-soft) !important;
  border-color: var(--ux-border) !important;
}
.landing-premium #final-cta .btn-hero-secondary:hover {
  background: var(--ux-bg) !important;
  color: var(--ux-navy) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
.card, .panel { border-radius: 16px !important; }
.kpi { position: relative; overflow: hidden; }
.landing-premium .btn-hero-primary,
.landing-premium .btn-hero-secondary,
.landing-premium .landing-links a {
  transition: transform 0.2s var(--ux-ease), background 0.2s var(--ux-ease), border-color 0.2s var(--ux-ease), color 0.2s var(--ux-ease);
}
.landing-premium .btn-hero-primary:focus-visible,
.landing-premium .btn-hero-secondary:focus-visible,
.landing-premium .landing-links a:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.22);
  outline-offset: 3px;
}
.kpi::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ux-emerald), var(--ux-gold));
  opacity: 0;
  transition: opacity 0.25s;
}
.kpi:hover::after { opacity: 1; }

@media (max-width: 768px) {
  .ux-showcase-row { grid-template-columns: 1fr; }
  .ux-intel-grid { grid-template-columns: 1fr; }
  .btn-back-landing { font-size: 12px; padding: 6px 10px; }
}
