/* ============================================
   AIFEIN v5 — Live Platform Styles
   Chat · Persona · Status · Radar · Mobile bottom-nav · PWA
   ============================================ */

/* ============================================
   FEIN CHAT — floating button + panel
   ============================================ */
.fein-chat-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 400;
  box-shadow: 0 12px 40px rgba(200,169,106,0.4), 0 0 0 0 rgba(200,169,106,0.4);
  transition: all 0.3s ease;
  animation: chatPulse 3s ease-in-out infinite;
  border: none;
}

.fein-chat-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 20px 50px rgba(200,169,106,0.5);
}

.fein-chat-fab img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.fein-chat-fab::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: #5eb85e;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px #5eb85e;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 12px 40px rgba(200,169,106,0.4), 0 0 0 0 rgba(200,169,106,0.4); }
  50% { box-shadow: 0 12px 40px rgba(200,169,106,0.4), 0 0 0 16px rgba(200,169,106,0); }
}

@media (max-width: 720px) {
  .fein-chat-fab {
    bottom: 6rem; /* clear bottom-nav */
    right: 1rem;
    width: 54px;
    height: 54px;
  }
  .fein-chat-fab img { width: 34px; height: 34px; }
}

/* Chat panel */
.fein-chat {
  position: fixed;
  bottom: 7rem;
  right: 2rem;
  width: min(400px, calc(100vw - 2rem));
  height: min(580px, calc(100vh - 9rem));
  background: rgba(15,15,15,0.97);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 401;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  animation: chatSlideUp 0.3s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] .fein-chat {
  background: rgba(255,253,247,0.98);
}

.fein-chat.active { display: flex; }

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 720px) {
  .fein-chat {
    bottom: 5.5rem;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    height: calc(100vh - 8rem);
    max-height: 580px;
  }
}

.fein-chat__head {
  padding: 1.2rem 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(200,169,106,0.06), transparent);
}

.fein-chat__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fein-chat__avatar img {
  width: 26px;
  height: 26px;
}

.fein-chat__info { flex: 1; }
.fein-chat__name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--gold-2);
  line-height: 1.1;
}

[lang="zh"] .fein-chat__name { font-family: var(--font-cn); font-style: normal; }

.fein-chat__status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--ink-3);
  margin-top: 0.15rem;
}

.fein-chat__status-dot {
  width: 7px;
  height: 7px;
  background: #5eb85e;
  border-radius: 50%;
  box-shadow: 0 0 6px #5eb85e;
}

.fein-chat__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.fein-chat__close:hover { border-color: var(--gold); color: var(--gold); }

.fein-chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.fein-msg {
  max-width: 88%;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.fein-msg--fein {
  align-self: flex-start;
  background: linear-gradient(180deg, rgba(200,169,106,0.1), rgba(200,169,106,0.04));
  border: 1px solid rgba(200,169,106,0.2);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}

.fein-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #0a0a0a;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.fein-msg strong { font-weight: 600; color: var(--gold-2); }
.fein-msg--user strong { color: #0a0a0a; }

.fein-chat__thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  color: var(--ink-3);
  font-style: italic;
  font-family: var(--font-display);
}

.fein-chat__thinking span {
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: dotBounce 1.4s infinite both;
}
.fein-chat__thinking span:nth-child(2) { animation-delay: -0.2s; }
.fein-chat__thinking span:nth-child(3) { animation-delay: -0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.fein-chat__suggestions {
  padding: 0 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fein-chat__suggestion {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--ink-2);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.fein-chat__suggestion:hover {
  border-color: var(--gold);
  color: var(--gold-2);
}

.fein-chat__input-wrap {
  padding: 1rem 1.2rem 1.2rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0.5rem;
}

.fein-chat__input {
  flex: 1;
  padding: 0.8rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.3s ease;
}

[data-theme="light"] .fein-chat__input { background: rgba(0,0,0,0.04); }

.fein-chat__input:focus { border-color: var(--gold); }
.fein-chat__input::placeholder { color: var(--ink-3); }

.fein-chat__send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.fein-chat__send:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px -5px rgba(200,169,106,0.5);
}

.fein-chat__send svg { width: 18px; height: 18px; }

/* ============================================
   PERSONA ONBOARDING MODAL
   ============================================ */
.persona {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  z-index: 800;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.persona.active { display: flex; }

.persona__box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  padding: clamp(1.8rem, 4vw, 2.8rem);
  position: relative;
  animation: scaleIn 0.3s cubic-bezier(0.4,0,0.2,1);
  max-height: 90vh;
  overflow-y: auto;
}

.persona__head {
  text-align: center;
  margin-bottom: 2rem;
}

.persona__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--gold-2);
  margin-bottom: 0.5rem;
}

[lang="zh"] .persona__title { font-family: var(--font-cn); font-style: normal; font-weight: 500; }

.persona__progress {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.persona__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
  transition: all 0.3s ease;
}

.persona__dot--active {
  background: var(--gold);
  width: 28px;
  border-radius: 4px;
}

.persona__step__label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-2);
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

.persona__options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

@media (min-width: 540px) {
  .persona__options.grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.persona__option {
  padding: 1rem 0.8rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.25s ease;
  cursor: pointer;
}

[data-theme="light"] .persona__option { background: rgba(0,0,0,0.02); }

.persona__option:hover {
  border-color: var(--gold);
  background: rgba(200,169,106,0.08);
}

.persona__option--active {
  border-color: var(--gold);
  background: rgba(200,169,106,0.15);
  color: var(--gold-2);
}

.persona__foot {
  margin-top: 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.persona__skip {
  font-size: 0.85rem;
  color: var(--ink-3);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s ease;
}

.persona__skip:hover { text-decoration-color: var(--gold); }

.persona__continue {
  padding: 0.85rem 1.6rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #0a0a0a;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.persona__continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -10px rgba(200,169,106,0.5);
}

.persona__continue:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   FOR YOU SECTION
   ============================================ */
.foryou {
  background: linear-gradient(180deg, rgba(200,169,106,0.04) 0%, transparent 100%);
}

.foryou__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.foryou__reset {
  font-size: 0.8rem;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  transition: all 0.3s ease;
}

.foryou__reset:hover { border-color: var(--gold); color: var(--gold-2); }

/* ============================================
   NEW TOOLS RADAR
   ============================================ */
.radar__filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.radar__filter {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink-2);
  transition: all 0.3s ease;
}

.radar__filter:hover { border-color: var(--gold); color: var(--ink); }
.radar__filter--active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.radar__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.2rem;
}

.radar-card {
  position: relative;
  padding: 1.6rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: all 0.4s ease;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.radar-card::before {
  content: 'NEW';
  position: absolute;
  top: 1rem;
  right: -28px;
  padding: 0.3rem 2.5rem;
  background: linear-gradient(135deg, #ff7e5f, #feb47b);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  transform: rotate(45deg);
  box-shadow: 0 4px 12px rgba(255,126,95,0.4);
}

.radar-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,126,95,0.3);
  box-shadow: 0 25px 60px -20px rgba(255,126,95,0.2);
}

.radar-card__launch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}

.radar-card__platform {
  padding: 0.2rem 0.6rem;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  font-weight: 600;
  color: var(--ink-2);
}

.radar-card__days-ago {
  color: var(--gold-2);
  font-weight: 500;
}

.radar-card__name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

[lang="zh"] .radar-card__name { font-family: var(--font-cn); }

.radar-card__desc {
  font-size: 0.88rem;
  color: var(--ink-2);
}

.radar-card__position {
  font-size: 0.75rem;
  color: var(--gold-2);
  font-style: italic;
  font-family: var(--font-display);
}

[lang="zh"] .radar-card__position { font-family: var(--font-cn); font-style: normal; }

.radar-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.radar-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--gold-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 0.3s ease;
}

.radar-card__cta:hover {
  background: var(--gold);
  color: var(--bg);
}

/* ============================================
   STATUS INDICATOR (on tool cards)
   ============================================ */
.tool__status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

.tool__status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.tool__status--operational .tool__status__dot {
  background: #5eb85e;
  box-shadow: 0 0 6px rgba(94,184,94,0.6);
  animation: statusPulse 2s ease-in-out infinite;
}

.tool__status--degraded .tool__status__dot {
  background: #e8b75e;
  box-shadow: 0 0 6px rgba(232,183,94,0.6);
}

.tool__status--down .tool__status__dot {
  background: #e85e5e;
  box-shadow: 0 0 6px rgba(232,94,94,0.6);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tool__status--operational { color: rgba(94,184,94,0.9); }
.tool__status--degraded { color: rgba(232,183,94,0.9); }
.tool__status--down { color: rgba(232,94,94,0.9); }

/* ============================================
   CONFIDENCE BADGE
   ============================================ */
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.confidence--verified {
  background: rgba(94,184,94,0.12);
  color: rgba(150,210,150,1);
  border: 1px solid rgba(94,184,94,0.3);
}

.confidence--auto {
  background: rgba(232,183,94,0.12);
  color: rgba(232,183,94,1);
  border: 1px solid rgba(232,183,94,0.3);
}

.confidence--stale {
  background: rgba(232,94,94,0.12);
  color: rgba(232,150,150,1);
  border: 1px solid rgba(232,94,94,0.3);
}

[data-theme="light"] .confidence--verified { color: #2d6a2d; }
[data-theme="light"] .confidence--auto { color: #8a6a1a; }
[data-theme="light"] .confidence--stale { color: #8a2a2a; }

/* ============================================
   LIVE INDICATOR
   ============================================ */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  background: rgba(94,184,94,0.1);
  border: 1px solid rgba(94,184,94,0.3);
  border-radius: 999px;
  font-size: 0.7rem;
  color: rgba(150,210,150,1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.live-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #5eb85e;
  border-radius: 50%;
  box-shadow: 0 0 8px #5eb85e;
  animation: statusPulse 1.5s ease-in-out infinite;
}

[data-theme="light"] .live-pill { color: #2d6a2d; }

/* ============================================
   MOBILE BOTTOM NAV
   ============================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15,15,15,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line-2);
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0));
  z-index: 300;
}

[data-theme="light"] .mobile-bottom-nav {
  background: rgba(250,248,243,0.95);
}

.mobile-bottom-nav__inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 540px;
  margin: 0 auto;
}

.mobile-bottom-nav__item {
  flex: 1;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--ink-3);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s ease;
  text-decoration: none;
  position: relative;
}

.mobile-bottom-nav__item:hover,
.mobile-bottom-nav__item--active {
  color: var(--gold-2);
}

.mobile-bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

.mobile-bottom-nav__item__badge {
  position: absolute;
  top: 0.2rem;
  right: 50%;
  transform: translateX(14px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

@media (max-width: 720px) {
  .mobile-bottom-nav { display: block; }
  body { padding-bottom: 4.5rem; }
}

/* ============================================
   PWA INSTALL BANNER
   ============================================ */
.pwa-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 420px;
  margin: 0 auto;
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, rgba(15,15,15,0.97), rgba(25,25,25,0.97));
  backdrop-filter: blur(15px);
  border: 1px solid rgba(200,169,106,0.3);
  border-radius: 16px;
  display: none;
  align-items: center;
  gap: 1rem;
  z-index: 350;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: bannerSlideUp 0.4s cubic-bezier(0.4,0,0.2,1);
}

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

.pwa-banner.active { display: flex; }

@media (max-width: 720px) {
  .pwa-banner {
    bottom: 5.5rem;
  }
}

.pwa-banner__icon img {
  width: 44px;
  height: 44px;
}

.pwa-banner__text { flex: 1; }
.pwa-banner__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--gold-2);
  margin-bottom: 0.1rem;
}

[lang="zh"] .pwa-banner__title { font-family: var(--font-cn); font-style: normal; font-weight: 600; }

.pwa-banner__sub {
  font-size: 0.78rem;
  color: var(--ink-2);
}

.pwa-banner__btn {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #0a0a0a;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.pwa-banner__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 0.8rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pwa-banner__close:hover { border-color: var(--gold); color: var(--gold); }

/* ============================================
   REVIEWS SECTION (per tool — modal/expanded view)
   ============================================ */
.review {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--line);
}

.review:last-child { border-bottom: none; }

.review__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.review__author {
  font-weight: 600;
  font-size: 0.92rem;
}

.review__meta {
  font-size: 0.75rem;
  color: var(--ink-3);
  margin-top: 0.15rem;
}

.review__rating {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--gold-2);
  font-size: 0.85rem;
  white-space: nowrap;
}

.review__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

[lang="zh"] .review__title { font-family: var(--font-cn); font-style: normal; font-weight: 600; }

.review__body {
  font-size: 0.88rem;
  color: var(--ink-2);
  line-height: 1.55;
}

.review__helpful {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--ink-3);
}

.review__helpful::before {
  content: '👍 ';
}
