/* ═══════════════════════════════════════════════════════════════
   HKEX Fund — Premium Features CSS
   Advanced UI components for engagement and premium feel
   ═══════════════════════════════════════════════════════════════ */

/* ── Reading Progress Bar ──────────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  background: transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.reading-progress.visible { opacity: 1; }
.reading-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rise-orange), #ff8c42, var(--rise-orange));
  background-size: 200% 100%;
  animation: shimmerProgress 2s linear infinite;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(240, 90, 40, 0.4);
}
@keyframes shimmerProgress {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Keyboard Shortcuts Panel ──────────────────────────────── */
.keyboard-hints {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  z-index: 900;
}
.keyboard-hints__trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}
.keyboard-hints__trigger:hover {
  background: var(--bg-elevated);
  color: var(--rise-orange);
  transform: scale(1.1);
}
.keyboard-hints__panel {
  position: absolute;
  bottom: 56px;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(20px);
}
.keyboard-hints.open .keyboard-hints__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.keyboard-hints__title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.keyboard-hints__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) 0;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.keyboard-hints__item kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 var(--space-2);
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ── Sector Heatmap ────────────────────────────────────────── */
.heatmap__title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.heatmap__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.heatmap__cell {
  flex: 1 1 calc(50% - 6px);
  min-width: 100px;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.heatmap__cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0));
  pointer-events: none;
}
.heatmap__cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.heatmap__cell-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.heatmap__cell-count {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.heatmap__cell-value {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* ── Deal Timeline ─────────────────────────────────────────── */
.timeline__title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.timeline__chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  padding-top: var(--space-4);
}
.timeline__bar-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.timeline__bar {
  width: 100%;
  min-height: 4px;
  background: var(--rise-orange);
  border-radius: 3px 3px 0 0;
  transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  opacity: 0.7;
}
.timeline__bar--today {
  opacity: 1;
  background: linear-gradient(180deg, #ff8c42, var(--rise-orange));
  box-shadow: 0 0 12px rgba(240, 90, 40, 0.4);
}
.timeline__bar:hover {
  opacity: 1;
  transform: scaleY(1.05);
}
.timeline__bar-count {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--rise-orange);
}
.timeline__bar-label {
  font-size: 9px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
}

/* ── Sentiment Gauge ───────────────────────────────────────── */
.gauge__title {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.gauge__bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  gap: 2px;
}
.gauge__segment {
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 999px;
}
.gauge__segment--bullish { background: linear-gradient(90deg, #10b981, #059669); }
.gauge__segment--neutral { background: linear-gradient(90deg, #f59e0b, #d97706); }
.gauge__segment--bearish { background: linear-gradient(90deg, #ef4444, #dc2626); }

.gauge__labels {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
}
.gauge__label {
  font-size: 10px;
  font-weight: 600;
}
.gauge__label--bullish { color: #10b981; }
.gauge__label--neutral { color: #f59e0b; }
.gauge__label--bearish { color: #ef4444; }

/* ── Social Proof ──────────────────────────────────────────── */
.social-proof {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  justify-content: center;
}
.social-proof__avatars {
  display: flex;
}
.social-proof__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  border: 2px solid var(--bg-card);
  margin-left: -8px;
}
.social-proof__avatar:first-child { margin-left: 0; }
.social-proof__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.social-proof__text strong {
  color: var(--text-primary);
}

/* ── Live Notification Popup ───────────────────────────────── */
.live-notification {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  cursor: pointer;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(20px);
}
.live-notification.visible {
  opacity: 1;
  transform: translateX(0);
}
.live-notification:hover {
  border-color: var(--rise-orange);
}
.live-notification__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  margin-top: 6px;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}
.live-notification__title {
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #10b981;
  margin-bottom: 2px;
}
.live-notification__text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: 500;
}
.live-notification__time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Premium Card Glassmorphism Enhancements ───────────────── */
.deal-card {
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.deal-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.12), 0 0 0 1px var(--rise-orange) !important;
}
.deal-card--featured:hover {
  box-shadow: 0 24px 48px rgba(240, 90, 40, 0.15), 0 0 0 1px var(--rise-orange) !important;
}

/* Video card hover enhancement */
.video-card {
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.video-card:hover {
  transform: translateY(-6px) scale(1.02) !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2) !important;
}

/* Market pulse glass effect */
.market-pulse {
  backdrop-filter: blur(12px);
}

/* ── Animated gradient border on featured cards ────────────── */
.deal-card--featured {
  position: relative;
}
.deal-card--featured::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(135deg, var(--rise-orange), transparent 40%, transparent 60%, var(--rise-orange));
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.deal-card--featured:hover::before {
  opacity: 0.6;
}

/* ── Premium sidebar widgets ───────────────────────────────── */
.premium-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  animation: fadeInUp 0.6s ease both;
}
.premium-widget:nth-child(2) { animation-delay: 0.1s; }
.premium-widget:nth-child(3) { animation-delay: 0.2s; }
.premium-widget:nth-child(4) { animation-delay: 0.3s; }

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

/* ── Enhanced toast ────────────────────────────────────────── */
.toast {
  backdrop-filter: blur(20px) !important;
}

/* ── Search focus enhancement ──────────────────────────────── */
.filters__search-input:focus {
  box-shadow: 0 0 0 3px rgba(240, 90, 40, 0.2), var(--shadow-md);
  border-color: var(--rise-orange) !important;
}

/* ── Mobile Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .keyboard-hints { display: none; }
  .live-notification { 
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
    bottom: var(--space-4);
  }
  .heatmap__cell {
    flex: 1 1 calc(50% - 4px);
    min-width: 80px;
    padding: var(--space-2);
  }
  .timeline__chart { height: 60px; }
  .gauge__labels { font-size: 9px; }
}
