/* Bidhaus design language — light, warm paper, ink + cobalt, geometric. */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eeebe3;
  --border: #e3dfd4;
  --ink: #1b1917;
  --muted: #6f6a5f;
  --accent: #2743cc;
  --accent-soft: #e9ecfa;
  --live: #d92d20;
  --green: #1a7f4e;
  --green-soft: #e3f2ea;
  --red: #c62f24;
  --red-soft: #fbe9e7;
  --amber: #96690e;
  --amber-soft: #f7efdc;
  --stage: #17140f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(27,25,23,.05), 0 8px 24px -12px rgba(27,25,23,.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
button { font-family: var(--font); }
input, select, textarea {
  font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; outline: none; width: 100%;
}
input::placeholder, textarea::placeholder { color: #a39d90; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; font-weight: 700; }
code { background: var(--surface-2); border-radius: 5px; padding: 1px 5px; font-size: .92em; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px;
  padding: 0 22px; height: 64px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; gap: 9px; align-items: center; white-space: nowrap; }
.logomark { display: inline-flex; gap: 3px; align-items: flex-end; }
.logomark i { display: block; width: 11px; height: 11px; }
.logomark i:nth-child(1) { background: var(--live); border-radius: 50%; }
.logomark i:nth-child(2) { background: var(--accent); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.logomark i:nth-child(3) { background: var(--ink); }
.logotype { font-size: 21px; font-weight: 900; letter-spacing: -.03em; color: var(--ink); }
#mainnav { display: flex; gap: 2px; }
#mainnav a { color: var(--muted); font-weight: 700; font-size: 14px; padding: 7px 13px; border-radius: 999px; }
#mainnav a:hover { color: var(--ink); background: var(--surface-2); }
#mainnav a.active { color: var(--ink); background: var(--accent-soft); }
#searchform { flex: 1; display: flex; justify-content: center; min-width: 120px; }
#searchbox {
  max-width: 560px; border-radius: 999px; padding: 10px 20px 10px 42px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6a5f' stroke-width='2.4'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center;
}
#searchbox:focus { background-color: var(--surface); }
#userarea { display: flex; align-items: center; gap: 9px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #fff; flex: none; }
.wallet-chip { font-size: 13px; font-weight: 800; color: var(--green); background: var(--green-soft); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.bell { position: relative; background: none; border: none; font-size: 19px; cursor: pointer; padding: 7px; border-radius: 999px; }
.bell:hover { background: var(--surface-2); }
.bell .dot { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--live); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

#notif-panel {
  position: fixed; top: 70px; right: 16px; width: 360px; max-height: 480px; overflow-y: auto; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
#notif-panel.hidden { display: none; }
.notif { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--ink); }
.notif:hover { background: var(--bg); }
.notif.unread { background: var(--accent-soft); }
.notif b { display: block; font-size: 13.5px; }
.notif small { color: var(--muted); font-size: 12.5px; }

/* ---------- layout ---------- */
#app.page { max-width: 1280px; margin: 0 auto; padding: 24px 22px 80px; }
#app.full { padding: 0; }
h1 { font-size: 26px; margin: 6px 0 18px; letter-spacing: -.02em; }
h2 { font-size: 19px; margin: 26px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.small { font-size: 12.5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-wide { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.clickable:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--ink); color: #fff; border: none; border-radius: 999px;
  font-weight: 700; font-size: 14px; padding: 10px 18px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #33302b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--ink); }
.btn.secondary:hover { background: var(--border); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: #3a55e0; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #a52820; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #16693f; }
.btn.light { background: #fff; color: var(--ink); }
.btn.light:hover { background: #eee; }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn.lg { padding: 13px 26px; font-size: 15px; }
.btn.full { width: 100%; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 7px; text-transform: uppercase; letter-spacing: .4px; }
.badge.live { background: var(--live); color: #fff; }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.badge.scheduled { background: var(--accent-soft); color: var(--accent); }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- product cards ---------- */
.pcard { overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.pimg { width: 100%; aspect-ratio: 1 / .85; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 52px; position: relative; background: var(--surface-2); border-radius: 0; overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pbody { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ptitle { font-weight: 700; font-size: 14px; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.pprice { font-weight: 800; font-size: 17px; color: var(--ink); }
.pmeta { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: auto; }
.corner-badge { position: absolute; top: 10px; left: 10px; }

/* ---------- home (sidebar + feed) ---------- */
.home-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 64px); }
.sidebar {
  border-right: 1px solid var(--border); background: var(--surface);
  padding: 26px 18px; position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto; display: flex; flex-direction: column;
}
.sidegreet { font-size: 21px; font-weight: 900; letter-spacing: -.02em; margin: 0 8px 18px; }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a { color: var(--muted); font-weight: 600; font-size: 14.5px; padding: 8px 10px; border-radius: 9px; }
.sidenav a:hover { color: var(--ink); background: var(--surface-2); }
.sidenav a.active { color: var(--accent); font-weight: 800; }
.sidefoot { margin-top: auto; padding: 20px 10px 4px; font-size: 12px; color: var(--muted); line-height: 2; }
.sidefoot a { color: var(--muted); margin-right: 10px; }
.sidefoot a:hover { color: var(--ink); }
.home-main { padding: 26px 30px 80px; min-width: 0; }
.home-main > .section-head:first-child { margin-top: 0; }

/* show tiles (Live cards) */
.showgrid { display: grid; gap: 20px 14px; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); }
.showtile { min-width: 0; }
.showhost { display: flex; gap: 7px; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.showhost .avatar { width: 24px; height: 24px; font-size: 10px; }
.showcover {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2);
  font-size: 56px; transition: box-shadow .15s, transform .15s;
}
.showcover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.showcover img { width: 100%; height: 100%; object-fit: cover; }
.livebadge {
  position: absolute; top: 10px; left: 10px; background: var(--live); color: #fff;
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 8px;
}
.schedbadge {
  position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 8px;
}
.showtitle {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 8px; font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--ink);
}
.showcat { font-size: 12.5px; margin-top: 2px; }
.showcat a { font-weight: 700; }
.showcat span { color: var(--muted); }

/* category tiles */
.catrow { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.cattile {
  flex: none; width: 195px; height: 92px; border-radius: 12px; padding: 14px 16px;
  color: #fff; font-weight: 800; font-size: 14.5px; line-height: 1.25;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .15s, box-shadow .15s;
}
.cattile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cattile .cemoji { font-size: 20px; align-self: flex-end; }

/* ---------- show room (shop | stage | chat) ---------- */
.showroom { display: grid; grid-template-columns: 320px 1fr 340px; height: calc(100vh - 64px); background: var(--bg); }
.shoppane { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 18px 16px; }
.showmeta { margin-bottom: 14px; }
.showmeta b { font-size: 16px; line-height: 1.3; display: block; }
.shophead { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 10px; }
.shophead h3 { margin: 0; font-size: 17px; }
.hostbox { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 12px 0; }
.shoplist { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.shopitem { display: grid; grid-template-columns: 58px 1fr; gap: 4px 12px; align-items: start; }
.shopitem .thumb {
  width: 58px; height: 58px; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 26px; grid-row: span 2;
}
.shopitem .thumb img { width: 100%; height: 100%; object-fit: cover; }
.sititle { font-size: 13.5px; font-weight: 700; color: var(--ink); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.simeta { font-size: 12px; color: var(--muted); }
.shopitem .btn { grid-column: 2; margin-top: 5px; justify-self: stretch; }

.stagecol { position: relative; background: var(--stage); overflow: hidden; }
.stage {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px; color: #fff;
}
.stage .stage-note { color: rgba(255,255,255,.55); font-size: 12.5px; }
.stage .host-avatar { width: 96px; height: 96px; border-radius: 50%; font-size: 38px; box-shadow: 0 0 0 5px rgba(255,255,255,.14), 0 0 70px rgba(255,255,255,.12); }
.stage .eq { display: flex; gap: 4px; height: 22px; align-items: flex-end; }
.stage .eq i { width: 5px; background: #fff; opacity: .85; border-radius: 2px; animation: eq 1s infinite ease-in-out; }
.stage .eq i:nth-child(2) { animation-delay: .15s; } .stage .eq i:nth-child(3) { animation-delay: .3s; }
.stage .eq i:nth-child(4) { animation-delay: .45s; } .stage .eq i:nth-child(5) { animation-delay: .6s; }
@keyframes eq { 0%,100% { height: 6px; } 50% { height: 22px; } }
.stage-msg { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.stage-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; background: #000; }
#stage-placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#unmute-btn { position: absolute; bottom: 90px; left: 16px; z-index: 2; }
.stage-msg b { font-size: 20px; }
.stage-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 10px; align-items: center; z-index: 2; }
.hostchip {
  display: flex; gap: 9px; align-items: center; background: rgba(0,0,0,.5); color: #fff;
  padding: 6px 12px 6px 6px; border-radius: 999px; backdrop-filter: blur(6px);
}
.hostchip .avatar { width: 32px; height: 32px; font-size: 12px; }
.hostchip b { font-size: 13.5px; display: block; line-height: 1.2; }
.hostchip .sub { font-size: 11.5px; color: rgba(255,255,255,.65); }
.spacer { flex: 1; }
.viewers-chip { background: rgba(0,0,0,.5); color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; backdrop-filter: blur(6px); }
.auction-overlay {
  position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 2;
  background: rgba(20,17,13,.86); color: #fff; backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 14px 16px;
}
.auction-overlay .muted { color: rgba(255,255,255,.6); }
.auction-overlay input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.auction-overlay .timer { font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.hot { color: #ff6b5e; animation: pulse 1s infinite; }
.bidbar { display: flex; gap: 8px; margin-top: 10px; }
.bidbar input { max-width: 130px; }
.bidbar .btn { background: var(--accent); }
.bidbar .btn:hover { background: #3a55e0; }

.chatpane { display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); min-height: 0; }
.chathead { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 800; display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.chatlog { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.chatmsg { display: flex; gap: 9px; font-size: 13.5px; align-items: flex-start; }
.chatmsg .avatar { width: 28px; height: 28px; font-size: 11px; margin-top: 1px; }
.chatmsg .who { font-weight: 800; margin-right: 6px; }
.chatmsg .who.seller { color: var(--amber); }
.chatmsg .who.admin { color: var(--live); }
.chatinput { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chatinput input { border-radius: 999px; background: var(--bg); }
.msg-product-card { display: flex; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-top: 4px; align-items: center; max-width: 260px; }
.msg-product-card .thumb { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; flex: none; background: var(--surface-2); }
.msg-product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* standalone chatpane (communities) keeps a border-radius */
.community-layout .chatpane { border: 1px solid var(--border); border-radius: 14px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; color: var(--muted); font-weight: 700; font-size: 14px;
  padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- auth / forms ---------- */
.authbox { max-width: 420px; margin: 40px auto; }
.formcard { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.form-error { background: var(--red-soft); color: var(--red); border: 1px solid #f0c4bf; border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-top: 14px; }
.demo-hint { margin-top: 16px; font-size: 12.5px; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 10px 14px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 12px 18px; font-size: 13.5px; max-width: 360px;
  box-shadow: var(--shadow); animation: slidein .25s ease;
}
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

.loading-page { display: flex; justify-content: center; padding: 90px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.countdown { font-variant-numeric: tabular-nums; font-weight: 800; }
.bid-history { max-height: 260px; overflow-y: auto; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 14px; }
.section-head h2 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }

.host-avatar { width: 96px; height: 96px; border-radius: 50%; font-size: 38px; }

.channel-list { display: flex; flex-direction: column; gap: 2px; }
.channel-list a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.channel-list a:hover, .channel-list a.active { background: var(--surface-2); color: var(--ink); }
.community-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }

@media (max-width: 1080px) {
  .showroom { grid-template-columns: 260px 1fr 300px; }
}
@media (max-width: 960px) {
  #mainnav { display: none; }
  .home-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .sidenav { flex-direction: row; flex-wrap: wrap; }
  .sidefoot { display: none; }
  .showroom { grid-template-columns: 1fr; height: auto; }
  .stagecol { position: relative; height: 60vh; order: -1; }
  .shoppane, .chatpane { border: none; border-top: 1px solid var(--border); }
  .chatpane { height: 420px; }
  .community-layout { grid-template-columns: 1fr; }
}
