/* =========================================================
   qa.css (Q&A page)
   - 样式变量 / Header / 响应式缩放思路：参考你的 japan.css / Japan.html
   - 目标：非登录版智能问答 UI（无 New Chat、无头像）
========================================================= */

/* ============ Base / Reset ============ */
:root{
  --primary: #009a44;
  --primary-dark: #0b7d36;
  --accent: #f17c4e;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;

  --stroke: rgba(15,23,42,.10);
  --shadow-soft: 0 10px 30px rgba(0,0,0,.08);

  --radius-lg: 16px;
  --radius-md: 12px;

  --container: 1200px;
  --sidebar: clamp(260px, 25vw, 320px);
}

*{ box-sizing:border-box; margin:0; padding:0; }
html, body{ width:100%; }
body{
  font-family: "Inter","Segoe UI",Arial,sans-serif;
  background:
    radial-gradient(900px 360px at 20% 0%, rgba(0,154,68,.12), transparent 60%),
    radial-gradient(900px 360px at 80% 0%, rgba(241,124,78,.10), transparent 62%),
    var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x:hidden; /* 防横向滚动条 */
}
img{ max-width:100%; height:auto; display:block; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; }
button, input, textarea{ font:inherit; }
textarea{ resize:none; }

/* Utils */
.container{
  width:100%;
  max-width: var(--container);
  margin:0 auto;
  padding: 0 24px;
}
.sr-only{
  position:absolute;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  border:0;
}

/* ============ Header / Nav (same vibe as japan.css) ============ */
.site-header{
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.header-inner{
  height: 76px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  font-weight: 900;
  color: var(--primary);
}
.brand-mark{ height:42px; width:auto; }
.brand-text{
  display:flex;
  flex-direction:column;
  gap:2px;

  align-items:flex-start; /* ✅ 关键：子元素靠左 */
  text-align:left;        /* ✅ 防止被全局 text-align:center 影响 */
}
.brand-text img{
  height:30px;
  width:auto;
  object-fit:contain;

  display:block;          /* ✅ 防止 inline 元素受 text-align 影响 */
  margin:0;               /* ✅ 确保不被居中 */
}
.brand-subtitle{
  font-size: 12px;
  color: #6b7280;
  letter-spacing: 1px;
  line-height: 1.2;
}

/* Mobile nav toggle */
.nav-toggle{ display:none; }
.nav-toggle-label{
  display:none;
  font-size: 20px;
  cursor:pointer;
  color: var(--text);
}

.nav{ display:flex; align-items:center; }
.nav-links{
  display:flex;
  align-items:center;
  gap: 16px;
}

.nav-link,
.dropdown-toggle{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 4px;

  padding: 10px 12px;
  border-radius: 10px;
  transition: all .2s ease;

  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  font-weight: 700;
}
.nav-label{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-icon-fa{
  font-size: 17px;
  opacity: .55;
  transition: transform .2s ease, opacity .2s ease;
}

.nav-link:hover,
.nav-link.active,
.dropdown-toggle:hover,
.nav-item.open .dropdown-toggle{
  background: rgba(0,154,68,.08);
  color: var(--primary);
}
.nav-link:hover .nav-icon-fa,
.nav-link.active .nav-icon-fa,
.dropdown-toggle:hover .nav-icon-fa,
.nav-item.open .dropdown-toggle .nav-icon-fa{
  opacity: 1;
  transform: translateY(-1px);
}

/* Country chip */
.country-item{ position:relative; }
.country-toggle{
  flex-direction:row;
  gap: 10px;
  padding: 10px 12px;
}
.country-label{
  font-size: 13px;
  letter-spacing: .04em;
  text-transform:none;
  font-weight: 800;
  color: var(--text);
}
.country-flag{
  width: 22px;
  height: 14px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(15,23,42,.10);
}

/* Dropdown menu */
.dropdown-menu{
  position:absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  border-radius: 12px;
  padding: 10px;
  display:none;
  min-width: 220px;
  max-height: 320px;
  overflow:auto;
  z-index: 1000;
  border: 1px solid rgba(15,23,42,.06);
}
.dropdown-menu li a{
  display:block;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.dropdown-menu li a:hover{
  background: rgba(0,154,68,.12);
  color: var(--primary-dark);
}
/* 当前选中国家高亮 */
.dropdown-menu li a.active{
  background:rgba(16,185,129,.12);  /* 淡绿色底，和导航风格接近 */
  color:#059669;                    /* 绿色文字 */
  font-weight:600;
}
.nav-item:hover .dropdown-menu{ display:block; }
.nav-item.open .dropdown-menu{ display:block; }

/* Desktop hover-bridge */
@media (min-width: 993px){
  .nav-item.has-dropdown::after{
    content:"";
    position:absolute;
    left:-12px; right:-12px;
    top:100%;
    height: 12px;
  }
  .dropdown-menu{ overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 992px){
  .header-inner{ height:auto; padding:14px 0; flex-wrap:wrap; }
  .nav-toggle-label{ display:block; }
  .nav{ width:100%; }
  .nav-links{
    width:100%;
    flex-direction:column;
    align-items:flex-start;
    background: rgba(255,255,255,.92);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    padding: 8px 12px;

    max-height: 0;
    overflow:hidden;
    transition: max-height .25s ease;
  }
  .nav-toggle:checked ~ .nav .nav-links{ max-height: 680px; }
  .nav-links li{ width:100%; }
  .nav-link, .dropdown-toggle{
    width:100%;
    flex-direction:row;
    justify-content:flex-start;
    gap: 10px;
  }
  .dropdown-menu{
    position:relative;
    top:0; right:0;
    width:100%;
    box-shadow:none;
    margin-top: 6px;
    border: 1px solid rgba(15,23,42,.08);
  }
}

/* ============ Q&A Layout ============ */
.qa-main-wrap{
  padding: 18px 0 26px;
}
.qa-shell{
  display:grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* Sidebar */
.qa-sidebar{
  position: sticky;
  top: 92px; /* header height + margin */
  align-self: start;
}
.side-card{
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.06);
  border-radius: var(--radius-lg);
  box-shadow: none;
  overflow:hidden;
  margin-bottom: 14px;
}
.side-card-secondary{
  background: rgba(255,255,255,.86);
}
.side-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.side-head h3{
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: #334155;
}
.side-link{
  font-size: 12px;
  color: var(--primary);
  font-weight: 800;
}
.side-link:hover{ text-decoration: underline; }

.quick-list{
  padding: 10px 10px 12px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.quick-q{
  width:100%;
  text-align:left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.78);
  cursor:pointer;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.quick-q:hover{
  transform: translateY(-1px);
  background: rgba(0,154,68,.08);
  border-color: rgba(0,154,68,.20);
}
.quick-q:active{ transform: translateY(0); }

.chat-list{
  padding: 10px 10px 6px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.chat-item{
  display:flex;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor:pointer;
  transition: background .12s ease, border-color .12s ease;
}
.chat-item:hover{
  background: rgba(0,154,68,.06);
  border-color: rgba(0,154,68,.16);
}
.chat-item.active{
  background: rgba(0,154,68,.10);
  border-color: rgba(0,154,68,.22);
}
.chat-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 4px;
  flex-shrink:0;
}
.chat-title{
  font-weight: 900;
  font-size: 13px;
  color:#0f172a;
}
.chat-sub{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 2px;
}
.side-hint{
  padding: 10px 14px 14px;
  color: #64748b;
  font-size: 12px;
}

/* Main panel */
.qa-panel{
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.06);
  border-radius: var(--radius-lg);
  box-shadow: none;
  overflow:hidden;

  display:flex;
  flex-direction:column;
  min-height: clamp(520px, 72vh, 760px);
}

.panel-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.panel-title{
  display:flex;
  align-items:center;
  gap: 10px;
}
.dot-online{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,154,68,.14);
}
.panel-title h2{
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .02em;
}
.panel-actions{
  display:flex;
  align-items:center;
  gap: 8px;
}
.pill{
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.7);
  color: #0f172a;
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 800;
  font-size: 12px;
}
.pill:hover{
  background: rgba(0,154,68,.08);
  border-color: rgba(0,154,68,.22);
}

/* Stream */
.chat-stream{
  padding: 16px;
  overflow:auto;
  flex: 1;
}
.msg{
  display:flex;
  margin: 10px 0;
}
.msg-user{ justify-content:flex-end; }
.msg-bot{ justify-content:flex-start; }

.msg-bubble{
  max-width: min(720px, 92%);
  border-radius: 14px;
  padding: 12px 12px 10px;
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 6px 20px rgba(0,0,0,.04);
}
.msg-user .msg-bubble{
  background: rgba(0,154,68,.10);
  border-color: rgba(0,154,68,.18);
}
.msg-bot .msg-bubble{
  background: rgba(255,255,255,.86);
}
.msg-name{
  font-size: 12px;
  font-weight: 900;
  color: #334155;
  margin-bottom: 6px;
}
.msg-text{
  font-size: 14px;
  color:#0f172a;
  white-space: pre-wrap;
}

/* Input */
.chat-input{
  display:flex;
  gap: 10px;
  padding: 12px 12px;
  border-top: 1px solid rgba(15,23,42,.06);
  background: rgba(255,255,255,.92);
}
.chat-input textarea{
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.14);
  outline:none;
  background: rgba(255,255,255,.85);
}
.chat-input textarea:focus{
  border-color: rgba(0,154,68,.38);
  box-shadow: 0 0 0 4px rgba(0,154,68,.12);
}
.send-btn{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0,154,68,.25);
  background: var(--primary);
  color:#fff;
  cursor:pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
  transition: transform .12s ease, filter .12s ease;
}
.send-btn:hover{ transform: translateY(-1px); filter: brightness(1.03); }
.send-btn:active{ transform: translateY(0); filter: brightness(.98); }

.panel-foot{
  padding: 10px 16px 12px;
  color: #94a3b8;
  font-size: 12px;
}

/* Back to top */
.back-to-top{
  position:fixed;
  left: 20px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border:none;
  background: var(--primary);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-shadow: var(--shadow-soft);
  cursor:pointer;
  z-index: 998;
  opacity:0;
  pointer-events:none;
  transition: all .2s ease;
}
.back-to-top.visible{
  opacity:1;
  pointer-events:auto;
}

/* ============ Responsive ============ */
@media (max-width: 992px){
  .qa-shell{
    grid-template-columns: 1fr;
  }
  .qa-sidebar{
    position: relative;
    top: 0;
  }
  .qa-panel{
    min-height: 70vh;
  }
}


/* Separator in country dropdown */
.dropdown-menu li.menu-sep{
  height: 1px;
  padding: 0;
  margin: 6px 8px;
  background: rgba(15,23,42,.10);
  border-radius: 999px;
}

/* =======================
   Thinking indicator
   ======================= */
   .typing {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
    line-height: 1;
  }
  
  .typing-dots {
    display: inline-flex;
    gap: 4px;
  }
  
  .typing-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    animation: typingBounce 1s infinite;
    opacity: .35;
  }
  
  .typing-dots i:nth-child(2) { animation-delay: .15s; }
  .typing-dots i:nth-child(3) { animation-delay: .3s; }
  
  @keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: .35; }
    40% { transform: translateY(-4px); opacity: 1; }
  }  
