/* TradeQA - Main Stylesheet */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --yellow-v: #f5a623;
  --text: #202124;
  --text-muted: #5f6368;
  --border: #e0e0e0;
  --bg: #f8f9fa;
  --white: #fff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.6; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
/* Header */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark { background: var(--primary); color: #fff; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; }
.search-form { flex: 1; max-width: 460px; display: flex; background: var(--bg); border: 1px solid var(--border); border-radius: 24px; overflow: hidden; }
.search-form input { flex: 1; border: 0; background: transparent; padding: 9px 16px; font-size: 14px; outline: none; }
.search-form button { border: 0; background: transparent; padding: 0 16px; cursor: pointer; color: var(--text-muted); }
.main-nav { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.main-nav > a { color: var(--text); font-size: 14px; }
.btn-primary { background: var(--primary); color: #fff !important; padding: 9px 18px; border-radius: var(--radius); border: 0; cursor: pointer; font-size: 14px; font-weight: 500; display: inline-block; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text) !important; padding: 9px 18px; border-radius: var(--radius); cursor: pointer; font-size: 14px; display: inline-block; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary) !important; text-decoration: none; }
.btn-link { color: var(--text); font-size: 14px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; display: inline-block; color: var(--text); }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-danger { color: #d93025; border-color: #f5c6c2; }
.btn-danger:hover { background: #fce8e6; color: #d93025; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px 5px 5px; cursor: pointer; font-size: 14px; }
.dropdown { display: none; position: absolute; right: 0; top: 110%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 180px; padding: 6px 0; }
.user-menu:hover .dropdown { display: block; }
.dropdown a { display: block; padding: 9px 16px; color: var(--text); font-size: 14px; }
.dropdown a:hover { background: var(--bg); text-decoration: none; }
.category-bar { background: var(--white); border-bottom: 1px solid var(--border); }
.cat-list { display: flex; gap: 22px; list-style: none; overflow-x: auto; padding: 10px 0; }
.cat-list a { color: var(--text-muted); font-size: 13.5px; white-space: nowrap; }
.cat-list a:hover { color: var(--primary); text-decoration: none; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 600; }
.avatar-xl { width: 88px; height: 88px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 36px; font-weight: 600; flex-shrink: 0; }
.badge-v { background: var(--yellow-v); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.badge-pending { background: #e8eaed; color: var(--text-muted); font-size: 11px; padding: 3px 8px; border-radius: 4px; }
.tag-ai { background: #e6f4ea; color: #137333; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
/* Main */
.site-main { padding: 24px 0 48px; min-height: 60vh; }
.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head h2 { font-size: 17px; }
.link-more { font-size: 13px; }
.empty { color: var(--text-muted); text-align: center; padding: 30px; }
.hint { color: var(--text-muted); font-size: 13.5px; margin-bottom: 12px; }
/* Hero */
.hero { text-align: center; padding: 48px 16px; background: linear-gradient(135deg, #e8f0fe 0%, #f8f9fa 100%); border-radius: 12px; margin-bottom: 24px; }
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.hero p { color: var(--text-muted); font-size: 16px; margin-bottom: 24px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
/* Home grid */
.home-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }
.home-side .panel { padding: 16px; }
/* Question list */
.question-list { list-style: none; }
.question-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.question-item:last-child { border-bottom: 0; }
.q-stats { display: flex; flex-direction: column; gap: 4px; min-width: 90px; text-align: center; }
.q-stats .stat { font-size: 12px; color: var(--text-muted); }
.q-stats .stat strong { display: block; font-size: 16px; color: var(--text); }
.q-body { flex: 1; }
.q-title { font-size: 16px; font-weight: 500; color: var(--text); display: block; margin-bottom: 6px; }
.q-title:hover { color: var(--primary); }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.tag { background: var(--bg); border: 1px solid var(--border); padding: 2px 10px; border-radius: 12px; font-size: 12px; color: var(--text-muted); }
.tag:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.dot { color: var(--border); }
/* Category grid */
.cat-grid { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-grid a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 6px; background: var(--bg); font-size: 13px; color: var(--text); }
.cat-grid a:hover { background: #e8f0fe; text-decoration: none; }
.cat-count { color: var(--text-muted); font-size: 12px; }
.hot-list { list-style: none; }
.hot-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.hot-list li:last-child { border-bottom: 0; }
.hot-meta { display: block; font-size: 12px; color: var(--text-muted); }
.merchant-list { list-style: none; }
.merchant-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.merchant-list li:last-child { border-bottom: 0; }
.merchant-list small { display: block; color: var(--text-muted); font-size: 12px; }
/* Question detail */
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.question-detail { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.q-header h1 { font-size: 24px; margin-bottom: 12px; }
.q-header .q-meta { margin-bottom: 20px; }
.q-content { font-size: 15.5px; line-height: 1.75; margin-bottom: 24px; }
.answers-section { border-top: 1px solid var(--border); padding-top: 24px; margin-top: 24px; }
.answers-section h2 { font-size: 18px; margin-bottom: 16px; }
.answer-list { list-style: none; }
.answer-item { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.answer-vote { text-align: center; min-width: 44px; }
.vote-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px; cursor: pointer; color: var(--text-muted); }
.vote-btn:hover { border-color: var(--primary); color: var(--primary); }
.vote-count { display: block; font-size: 14px; font-weight: 600; margin-top: 4px; }
.answer-body { flex: 1; }
.answer-content { font-size: 15px; line-height: 1.7; margin-bottom: 12px; }
.answer-meta { font-size: 13px; color: var(--text-muted); }
.merchant-card { display: flex; gap: 12px; background: #fffdf5; border: 1px solid #f5e6c2; border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.merchant-card p { font-size: 13px; color: var(--text-muted); margin: 4px 0 8px; }
.answer-form-section { border-top: 1px solid var(--border); padding-top: 24px; margin-top: 24px; }
.answer-form-section h2 { font-size: 18px; margin-bottom: 14px; }
.notice { color: var(--text-muted); font-size: 14px; padding: 16px; background: var(--bg); border-radius: var(--radius); }
/* Forms */
.form .field { margin-bottom: 16px; }
.form label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=url], .form input[type=number], .form select, .form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.1); }
.form textarea { resize: vertical; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 16px; cursor: pointer; }
.checkbox input { width: auto; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fce8e6; color: #c5221f; }
.alert-success { background: #e6f4ea; color: #137333; }
.alert-info { background: #e8f0fe; color: #1967d2; }
/* Auth */
.auth-wrap { display: flex; justify-content: center; padding: 40px 16px; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 36px; width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 22px; margin-bottom: 20px; text-align: center; }
.type-switch { display: flex; background: var(--bg); border-radius: var(--radius); padding: 4px; margin-bottom: 22px; }
.type-switch a { flex: 1; text-align: center; padding: 9px; border-radius: 6px; font-size: 14px; color: var(--text-muted); }
.type-switch a.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.type-switch a:hover { text-decoration: none; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
/* Dashboard */
.dash-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.dash-side { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; height: fit-content; }
.dash-user { text-align: center; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.dash-user .avatar-lg { margin: 0 auto 10px; }
.dash-user strong { display: block; font-size: 15px; }
.dash-user small { color: var(--text-muted); font-size: 12.5px; }
.dash-nav { display: flex; flex-direction: column; gap: 2px; }
.dash-nav a { padding: 9px 12px; border-radius: 6px; color: var(--text); font-size: 14px; }
.dash-nav a:hover { background: var(--bg); text-decoration: none; }
.dash-nav a.active { background: #e8f0fe; color: var(--primary); font-weight: 600; }
.dash-main h1 { font-size: 22px; margin-bottom: 20px; }
.dash-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.dash-head h1 { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-num { display: block; font-size: 26px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12.5px; color: var(--text-muted); }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Products */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.product-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.product-card img { width: 100%; height: 160px; object-fit: cover; }
.no-img { height: 160px; display: grid; place-items: center; background: var(--bg); color: var(--text-muted); font-size: 13px; }
.product-info { padding: 12px; }
.product-info h3 { font-size: 14.5px; margin-bottom: 6px; }
.product-info p { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; }
.price { display: block; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.product-actions { display: flex; gap: 6px; }
.img-preview-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.img-preview-row img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.video-preview { max-width: 240px; border-radius: 6px; margin-bottom: 8px; }
.avatar-preview { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; display: block; }
/* Chat */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; height: calc(100vh - 200px); min-height: 500px; }
.chat-side { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-y: auto; }
.chat-side h2 { font-size: 15px; margin-bottom: 12px; }
.chat-merchant-list { list-style: none; }
.chat-merchant-list a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.chat-merchant-list a:hover { background: var(--bg); text-decoration: none; }
.chat-merchant-list a.active { background: #e8f0fe; }
.chat-main { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.chat-notice { padding: 10px 18px; background: #fffdf5; border-bottom: 1px solid #f5e6c2; font-size: 12.5px; color: #8a6d1f; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 70%; padding: 10px 14px; border-radius: 14px; font-size: 14px; word-wrap: break-word; }
.chat-msg.mine { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.theirs { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 4px; }
.chat-msg-time { font-size: 10.5px; opacity: .7; margin-top: 4px; display: block; }
.chat-input { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.chat-input textarea { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; font-family: inherit; font-size: 14px; resize: none; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--text-muted); padding: 40px; text-align: center; }
/* Ads */
.ad-strip { margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.ad { display: block; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.ad:hover { text-decoration: none; }
.ad-image img { width: 100%; max-height: 120px; object-fit: cover; }
.ad-text { padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.ad-label { background: var(--bg); border: 1px solid var(--border); font-size: 10px; padding: 2px 6px; border-radius: 4px; color: var(--text-muted); }
.ad-content { font-size: 14px; color: var(--text); }
.ad-thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 4px; }
.ad-text-preview { font-size: 12px; color: var(--text-muted); }
/* Merchant cards */
.merchant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.merchant-card-lg { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--text); }
.merchant-card-lg:hover { border-color: var(--primary); text-decoration: none; box-shadow: var(--shadow); }
.merchant-card-lg .avatar-lg { margin: 0 auto 12px; }
.merchant-card-lg h3 { font-size: 16px; margin-bottom: 8px; }
.merchant-card-lg p { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.product-count { font-size: 12px; color: var(--primary); }
/* Shop */
.shop-header { display: flex; gap: 20px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.shop-header h1 { font-size: 22px; margin-bottom: 8px; }
.shop-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 14px; }
.contact-info { font-size: 14px; line-height: 1.7; }
/* Page head */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin-bottom: 6px; }
.page-desc { color: var(--text-muted); font-size: 14px; }
.sort-tabs { display: flex; gap: 8px; margin-top: 12px; }
.sort-tabs a { padding: 6px 14px; border-radius: 16px; font-size: 13.5px; color: var(--text-muted); background: #fff; border: 1px solid var(--border); }
.sort-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sort-tabs a:hover { text-decoration: none; }
/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a { padding: 7px 13px; border: 1px solid var(--border); border-radius: 6px; font-size: 13.5px; color: var(--text); background: #fff; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover { text-decoration: none; border-color: var(--primary); }
/* Answer admin list */
.answer-admin-list { list-style: none; }
.answer-admin-list li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.answer-admin-list li:last-child { border-bottom: 0; }
.aa-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.aa-q { font-weight: 500; color: var(--text); }
.aa-time { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.aa-content { font-size: 13.5px; color: var(--text-muted); }
/* Error / static */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 72px; color: var(--primary); margin-bottom: 12px; }
.static-page { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
/* Footer */
.site-footer { background: #202124; color: #bdc1c6; margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; padding: 40px 16px; }
.footer-col h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.footer-col p { font-size: 13.5px; line-height: 1.7; }
.footer-col a { display: block; color: #bdc1c6; font-size: 13.5px; padding: 4px 0; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom { border-top: 1px solid #3c4043; padding: 16px 0; font-size: 13px; text-align: center; }
/* Responsive */
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .dash-layout { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-side { max-height: 200px; }
  .footer-inner { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .search-form { order: 3; max-width: 100%; flex-basis: 100%; }
  .hero h1 { font-size: 24px; }
  .field-row { flex-direction: column; gap: 0; }
}
/* Members-only notice */
.members-only-notice { background: #fffdf5; border: 1px solid #f5e6c2; border-radius: 8px; padding: 14px 16px; color: #8a6d1f; font-size: 14px; }
.members-only-notice a { font-weight: 600; }
.q-no-detail { color: #9aa0a6; font-size: 13.5px; }
