/* GoldChat — champagne & gold, light and warm. Design language: by iSinkwaMtase. */
:root {
  --bg: #f6efe0;
  --bg2: #faf6ec;
  --panel: #ffffff;
  --panel2: #f4ecd9;
  --line: #ecdfc2;
  --text: #3b3122;
  --muted: #a3947a;
  --accent: #c79a2e;
  --accent-bright: #e9cd7a;
  --gold-grad: linear-gradient(135deg, #ecd085 0%, #c79a2e 100%);
  --gold-deep: #a87e18;
  --danger: #c94f5f;
  --gold: #b28a2e;
  --card-shadow: 0 6px 24px rgba(170, 135, 45, 0.14);
  --soft-shadow: 0 2px 10px rgba(170, 135, 45, 0.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; outline: none; width: 100%;
}
input::placeholder, textarea::placeholder { color: #b9ab90; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(199,154,46,.15); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.screen { position: fixed; inset: 0; }

/* ===== auth ===== */
#screen-auth { display: flex; align-items: center; justify-content: center; background:
  radial-gradient(1100px 600px at 15% -10%, #fdf8ea 0%, transparent 60%),
  radial-gradient(900px 500px at 110% 110%, #f2e3bb 0%, transparent 55%), var(--bg); padding: 16px; }
.auth-card {
  width: 400px; max-width: 96vw; background: var(--panel);
  border-radius: 24px; padding: 32px 28px; text-align: center; box-shadow: var(--card-shadow);
}
.auth-logo { width: 88px; height: 88px; margin: 0 auto 8px; display: block; }
h1 b, h2 b { font-weight: 800; }
.wm-light { font-weight: 300; color: #5a5040; letter-spacing: .5px; }
.auth-card h1 { margin: 4px 0 0; letter-spacing: .5px; }
.brand-sub { font-size: 10.5px; letter-spacing: 2.5px; color: var(--gold); font-weight: 700; margin: 2px 0 10px; }
.auth-tag { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; line-height: 1.5; }
.auth-toggle { display: flex; background: var(--panel2); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.auth-toggle button { flex: 1; padding: 8px; border-radius: 999px; color: var(--muted); }
.auth-toggle button.on { background: var(--gold-grad); color: #fff; font-weight: 700; box-shadow: var(--soft-shadow); }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.privacy-note { font-size: 12px; color: var(--muted); text-align: left; line-height: 1.5; background: var(--panel2); padding: 10px 12px; border-radius: 14px; }
.btn-primary { background: var(--gold-grad); color: #fff; font-weight: 800; padding: 12px; border-radius: 999px; box-shadow: var(--soft-shadow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { color: var(--muted); padding: 8px; }
.btn-soft { background: var(--panel2); padding: 9px 14px; border-radius: 999px; font-size: 13.5px; }
.btn-danger { background: var(--danger); color: #fff; padding: 11px; border-radius: 999px; font-weight: 700; }
.btn-danger:hover { filter: brightness(1.1); }
.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }
#otp-input { text-align: center; letter-spacing: 10px; font-size: 22px; }
.dev-otp { font-size: 12.5px; color: var(--gold); background: rgba(199,154,46,.08); border: 1px dashed rgba(199,154,46,.4); padding: 8px; border-radius: 10px; }

/* ===== app layout ===== */
.app { display: flex; background: var(--bg); }
#sidebar { width: 380px; min-width: 300px; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
#main { flex: 1; display: flex; flex-direction: column; background:
  radial-gradient(1000px 500px at 80% -10%, #fbf4e2 0%, transparent 60%), var(--bg); }

.sb-header { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px; background: var(--bg2); }
.me-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-meta { display: flex; flex-direction: column; min-width: 0; }
.me-meta b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-meta span { font-size: 12.5px; }
.sb-actions { display: flex; gap: 2px; }
.sb-actions button { font-size: 16px; padding: 7px 8px; border-radius: 10px; }
.sb-actions button:hover { background: var(--panel2); }

.avatar {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff; user-select: none;
  background: var(--gold-grad); box-shadow: var(--soft-shadow);
}

.sb-tabs { display: flex; padding: 0 8px; gap: 2px; border-bottom: 1px solid var(--line); }
.sb-tabs button { flex: 1; padding: 11px 4px; color: var(--muted); font-weight: 700; font-size: 13.5px; border-bottom: 3px solid transparent; }
.sb-tabs button.on { color: var(--gold-deep); border-bottom-color: var(--accent); }
.badge { background: var(--gold-grad); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11.5px; font-weight: 800; }

.sb-pane { flex: 1; overflow-y: auto; }
.pane-h { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 14px 16px 6px; }
.list { display: flex; flex-direction: column; padding: 6px 8px; gap: 2px; }
.empty { padding: 40px 24px; text-align: center; line-height: 1.7; }

/* moments (status strip) */
.moments { display: flex; gap: 14px; padding: 12px 14px 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.moment { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: none; cursor: pointer; width: 58px; }
.moment .avatar { width: 50px; height: 50px; border-radius: 16px; }
.moment span { font-size: 11px; color: var(--muted); max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moment.mine .avatar { background: var(--panel); color: var(--gold-deep); border: 2px dashed var(--accent); box-shadow: none; font-size: 22px; }
.moment .status-ring { padding: 2px; border-radius: 19px; border: 2.5px solid var(--accent); }
.moment .status-ring.seen { border-color: var(--line); }

.row-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px; cursor: pointer;
  border-radius: 16px;
}
.row-item:hover { background: var(--panel); box-shadow: var(--soft-shadow); }
.row-item.active { background: linear-gradient(135deg, rgba(236,208,133,.35), rgba(199,154,46,.18)); }
.ri-main { flex: 1; min-width: 0; }
.ri-top { display: flex; justify-content: space-between; gap: 8px; }
.ri-top b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-time { font-size: 11.5px; color: var(--muted); flex: none; }
.ri-bottom { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.ri-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-actions { display: flex; gap: 8px; margin-top: 6px; }
.ri-actions .btn-primary { padding: 6px 14px; font-size: 13px; }
.ri-actions .btn-soft { padding: 6px 14px; font-size: 13px; }

.status-ring { padding: 2px; border-radius: 17px; border: 2.5px solid var(--accent); }
.status-ring.seen { border-color: var(--line); }

.status-compose { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }

.sb-foot { padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.brandline { font-size: 11px; color: var(--gold); font-weight: 700; letter-spacing: .6px; }
.datafree-pill { font-size: 11px; color: var(--muted); }

/* ===== chat view ===== */
.main-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 20px; }
#chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.chat-head-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head-meta b { font-size: 15.5px; }
.chat-head-meta span { font-size: 12.5px; }
#btn-add-member, #btn-block, #btn-report { font-size: 15px; padding: 6px 10px; border-radius: 10px; }
#btn-add-member:hover, #btn-block:hover, #btn-report:hover { background: var(--panel2); }
#btn-back { font-size: 20px; padding: 4px 8px; }
.only-mobile { display: none; }

#messages { flex: 1; overflow-y: auto; padding: 18px 7%; display: flex; flex-direction: column; gap: 4px; }
.date-pill, .chat-note {
  align-self: center; background: var(--panel); color: var(--muted); font-size: 11.5px;
  font-weight: 700; letter-spacing: .5px; padding: 5px 14px; border-radius: 999px;
  box-shadow: var(--soft-shadow); margin: 10px 0 4px;
}
.chat-note { font-weight: 400; letter-spacing: 0; }
.msg {
  max-width: 68%; padding: 9px 13px 6px; border-radius: 16px; background: var(--panel);
  align-self: flex-start; position: relative; font-size: 14.2px; line-height: 1.45;
  word-wrap: break-word; box-shadow: var(--soft-shadow);
  border-bottom-left-radius: 6px;
}
.msg.mine {
  background: var(--gold-grad); color: #fff; align-self: flex-end;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(199, 154, 46, 0.35);
}
.msg.first { margin-top: 10px; }
.msg .m-from { font-size: 12.5px; font-weight: 700; color: var(--gold); margin-bottom: 2px; }
.msg .m-text { white-space: pre-wrap; }
.msg .m-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.msg.mine .m-meta { color: rgba(255,255,255,.75); }
.msg .ticks { color: rgba(255,255,255,.55); }
.msg .ticks.read { color: #fff; text-shadow: 0 0 6px rgba(255,255,255,.6); }
.msg img { max-width: 100%; border-radius: 12px; margin-bottom: 4px; display: block; cursor: pointer; }
.msg audio { max-width: 240px; width: 240px; height: 38px; display: block; }
.msg.system { align-self: center; background: var(--panel2); color: var(--muted); font-size: 12.5px; padding: 5px 14px; border-radius: 999px; max-width: 90%; text-align: center; margin: 10px 0 4px; box-shadow: none; }

#composer { display: flex; align-items: center; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--bg2); border-top: 1px solid var(--line); }
#composer input[type="text"] { flex: 1; border-radius: 999px; box-shadow: var(--soft-shadow); border-color: transparent; }
#composer > button, #btn-attach { font-size: 19px; padding: 8px; border-radius: 50%; flex: none; cursor: pointer; }
#composer > button:hover, #btn-attach:hover { background: var(--panel2); }
#btn-send {
  background: var(--gold-grad); color: #fff; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--soft-shadow);
}
#btn-send:hover { background: var(--gold-grad); filter: brightness(1.05); }
#recorder { display: flex; align-items: center; gap: 12px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg2); border-top: 1px solid var(--line); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
#rec-send { color: var(--gold-deep); font-weight: 800; }
#rec-cancel { color: var(--muted); }

/* ===== modals ===== */
.modal { position: fixed; inset: 0; background: rgba(80, 62, 20, 0.35); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
.modal-card { width: 420px; max-width: 96vw; background: var(--panel); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 12px; max-height: 86vh; overflow-y: auto; box-shadow: var(--card-shadow); }
.modal-card h3 { font-size: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.row .btn-primary { width: auto; flex: none; padding: 11px 18px; }
#search-result { display: flex; flex-direction: column; gap: 8px; }
.found-card { display: flex; align-items: center; gap: 12px; background: var(--panel2); border-radius: 16px; padding: 12px; }
.found-card .ri-main b { display: block; }
textarea#status-text { min-height: 110px; resize: vertical; }
.color-dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-dot.on { border-color: var(--gold-deep); }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.pick-row:hover { background: var(--panel2); }
.pick-row input { width: auto; }
#account-info b { font-size: 15px; }

/* ===== status viewer / lightbox (stories stay immersive-dark) ===== */
.viewer { position: fixed; inset: 0; background: #171204; z-index: 40; display: flex; flex-direction: column; color: #fff; }
.viewer-top { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(rgba(23,18,4,.8), transparent); z-index: 2; }
#viewer-bars { display: flex; gap: 4px; }
#viewer-bars .bar { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
#viewer-bars .bar i { display: block; height: 100%; width: 0%; background: #ecd085; }
#viewer-bars .bar.done i { width: 100%; }
.viewer-user { display: flex; align-items: center; gap: 10px; }
.viewer-user .muted { color: rgba(255,255,255,.6); }
#viewer-close { position: absolute; top: 14px; right: 12px; font-size: 20px; color: #fff; z-index: 3; padding: 6px 10px; }
#viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; min-height: 0; }
#viewer-body .status-text-view { font-size: 26px; font-weight: 600; line-height: 1.5; padding: 30px; border-radius: 20px; max-width: 640px; word-wrap: break-word; color: #fff; }
#viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; }
#viewer-body .status-caption { position: absolute; bottom: 90px; left: 0; right: 0; text-align: center; font-size: 15px; text-shadow: 0 1px 4px #000; padding: 0 20px; }
.viewer-foot { padding: 14px 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: linear-gradient(transparent, rgba(23,18,4,.8)); }
.viewer-foot .btn-soft { background: rgba(255,255,255,.14); color: #fff; }
.viewer-foot .muted { color: rgba(255,255,255,.6); }
.viewer-nav { position: absolute; top: 0; bottom: 0; width: 30%; z-index: 1; }
.viewer-nav.prev { left: 0; }
.viewer-nav.next { right: 0; }
.lb-close { position: absolute; top: 14px; right: 14px; font-size: 22px; color: #fff; z-index: 2; }
#lightbox { align-items: center; justify-content: center; }
#lightbox img { max-width: 94vw; max-height: 92vh; object-fit: contain; margin: auto; }

/* ===== toast ===== */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #3b3122; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 60; font-size: 13.5px; box-shadow: 0 8px 30px rgba(59,49,34,.35); }

/* ===== mobile ===== */
@media (max-width: 760px) {
  #sidebar { width: 100%; min-width: 0; border-right: none; }
  #main { position: fixed; inset: 0; transform: translateX(100%); transition: transform .2s; z-index: 10; background: var(--bg); }
  .app.chat-open #main { transform: translateX(0); }
  .only-mobile { display: block; }
  #messages { padding: 14px 4%; }
  .msg { max-width: 82%; }
}
