/* Secret Chat — temă întunecată, mobile-first. Deghizare: aplicația "Reports". */
:root {
  --bg: #0b0e14;
  --bg2: #111623;
  --card: #161d2e;
  --line: #232c44;
  --txt: #e8ecf5;
  --mut: #8b94ad;
  --acc: #4f8cff;
  --acc2: #2f6fe0;
  --ok: #35c26e;
  --danger: #e05252;
  --me: #1f6feb;
  --them: #1c2338;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; }

.boot {
  margin: auto; color: var(--mut); font-size: 15px;
}

/* ---------- butoane / inputuri ---------- */
.btn {
  display: inline-block; padding: 12px 18px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  font-weight: 600; font-size: 15px; text-align: center;
}
.btn.primary { background: var(--acc2); border-color: var(--acc2); color: #fff; }
.btn.danger { background: rgba(224,82,82,.14); border-color: var(--danger); color: #ff8a8a; }
.btn.ghost { background: transparent; }
.icon-btn {
  font-size: 22px; padding: 8px 10px; border-radius: 10px; line-height: 1;
  color: var(--txt);
}
.text-input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  font-size: 16px; outline: none;
}
.text-input:focus { border-color: var(--acc); }
.fld-label { font-size: 13px; color: var(--mut); margin: 14px 0 6px; font-weight: 600; }
.hint { font-size: 13px; color: var(--mut); line-height: 1.5; }

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 17px; font-weight: 700; flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: #232c44; color: var(--txt); padding: 12px 18px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s;
  max-width: 86vw; text-align: center; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- poartă ---------- */
.gate { position: relative; flex: 1; overflow: hidden; background: #000; }
.gate-media { position: absolute; inset: 0; }
.gate-fallback {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 20% 10%, #1c2b4d 0%, transparent 60%),
    radial-gradient(120% 90% at 85% 85%, #3d2350 0%, transparent 55%),
    linear-gradient(160deg, #101828 0%, #0b0e14 70%);
}
.gate-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; user-select: none; -webkit-user-drag: none; touch-action: none;
}
.gate-loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); z-index: 3;
}
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.2); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.setup-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
}
.setup-text { font-size: 15px; font-weight: 600; text-shadow: 0 1px 6px #000; }
.overlay { position: fixed; inset: 0; z-index: 50; background: #000; }
.overlay .gate-media { position: absolute; inset: 0; }

/* ---------- momeala "Reports" ---------- */
.rep { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.rep-list { flex: 1; overflow-y: auto; padding: 10px 12px 20px; display: flex; flex-direction: column; gap: 10px; }
.rep-row {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
}
.rep-row:active { background: var(--bg2); }
.rep-main { flex: 1; min-width: 0; }
.rep-name { font-size: 16px; font-weight: 700; }
.rep-sub { font-size: 13px; color: var(--mut); margin-top: 3px; }
.badge-sent {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: #7ee2a8; background: rgba(53,194,110,.16); border: 1px solid rgba(53,194,110,.5);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.rep-detail { flex: 1; overflow-y: auto; padding: 12px 12px 24px; display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.sec-title { font-size: 13px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.kv-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.kv-row:last-child { border-bottom: none; }
.kv-k { color: var(--mut); }
.kv-v { font-weight: 600; text-align: right; }
.kv-row.total .kv-k, .kv-row.total .kv-v { font-weight: 800; font-size: 16px; }

/* ---------- pair ---------- */
.pair { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; background: var(--bg2); border-bottom: 1px solid var(--line); }
.tab { flex: 1; padding: 14px; font-size: 15px; font-weight: 600; color: var(--mut); border-bottom: 3px solid transparent; }
.tab.active { color: var(--txt); border-bottom-color: var(--acc); }
.pair-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.qr-box {
  align-self: center; background: #fff; padding: 14px; border-radius: 16px; margin: 8px 0;
}
.qr-img { width: 260px; height: 260px; display: block; }
.scan-video {
  width: 100%; aspect-ratio: 4/3; background: #000; border-radius: var(--radius);
  border: 1px solid var(--line); object-fit: cover;
}
.pair-done { margin-top: 12px; display: flex; }
.pair-done .btn { flex: 1; }

/* ---------- chat ---------- */
.peer-name { flex: 1; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-btns { display: flex; gap: 2px; }
.msg-list {
  flex: 1; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.msg { max-width: 82%; display: flex; flex-direction: column; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; }
.msg-text, .msg-file {
  padding: 10px 13px; border-radius: 16px; font-size: 15.5px; line-height: 1.45;
  word-break: break-word;
}
.msg.in .msg-text, .msg.in .msg-file { background: var(--them); border-bottom-left-radius: 4px; }
.msg.out .msg-text, .msg.out .msg-file { background: var(--me); color: #fff; border-bottom-right-radius: 4px; }
.msg-file { text-decoration: none; }
.msg-img, .msg-video {
  max-width: 100%; border-radius: 12px; display: block; max-height: 320px;
}
.msg-name { font-size: 12px; color: var(--mut); margin-top: 4px; }
.msg-ts { font-size: 11px; color: var(--mut); margin-top: 3px; align-self: flex-end; }
.msg.in .msg-ts { align-self: flex-start; }
.composer {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg2); border-top: 1px solid var(--line);
}
.composer .text-input { flex: 1; }
.send-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--acc2); color: #fff; font-size: 18px; flex-shrink: 0;
}
.info-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(86vw, 340px);
  background: var(--bg2); border-left: 1px solid var(--line); z-index: 20;
  padding: calc(14px + env(safe-area-inset-top)) 16px 20px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.info-title { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.info-val { font-size: 15px; font-weight: 600; }
.safety-code {
  font-family: ui-monospace, Menlo, monospace; font-size: 20px; font-weight: 700;
  letter-spacing: .08em; background: var(--card); border: 1px dashed var(--line);
  border-radius: 10px; padding: 12px; text-align: center;
}
.info-panel .btn { margin-top: 6px; }

/* ---------- apeluri ---------- */
.call { position: relative; flex: 1; background: #000; overflow: hidden; }
.remote-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.local-video {
  position: absolute; right: 14px; bottom: 110px; width: 110px; height: 150px;
  object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.25);
  background: #111; z-index: 2;
}
.call-status {
  position: absolute; top: calc(20px + env(safe-area-inset-top)); left: 0; right: 0;
  text-align: center; color: #fff; font-size: 15px; text-shadow: 0 1px 6px #000; z-index: 2;
}
.call-controls {
  position: absolute; left: 0; right: 0; bottom: calc(26px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 18px; z-index: 2;
}
.ctl-btn {
  width: 60px; height: 60px; border-radius: 50%; font-size: 24px;
  background: rgba(30,36,54,.9); border: 1px solid var(--line);
}
.ctl-btn.off { background: rgba(90,30,30,.9); }
.ctl-btn.hangup { background: #c0392b; border-color: #c0392b; }
.call-incoming {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: radial-gradient(100% 70% at 50% 20%, #16213a 0%, #0b0e14 70%);
  height: 100%;
}
.call-avatar { font-size: 64px; }
.call-title { font-size: 20px; font-weight: 800; }
.call-sub { font-size: 15px; color: var(--mut); }
.call-actions { display: flex; gap: 16px; margin-top: 18px; }
.call-actions .btn { min-width: 120px; }
