/* ===== TempMail sebiji.id ===== */
:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #20242e;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #8b93a3;
  --accent: #4f8cff;
  --accent-2: #6aa3ff;
  --green: #2ecc71;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ===== Login ===== */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #1d2330 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 36px 28px;
  box-shadow: var(--shadow); text-align: center;
}
.login-logo { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.login-sub { color: var(--muted); margin-bottom: 26px; font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { font-size: 13px; color: var(--muted); }
.login-form input {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 14px 16px; border-radius: 12px;
  font-size: 18px; text-align: center; letter-spacing: 2px;
  text-transform: uppercase; outline: none; transition: border-color .15s;
}
.login-form input:focus { border-color: var(--accent); }
.login-form button {
  background: var(--accent); color: #fff; border: 0;
  padding: 14px; border-radius: 12px; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .15s; margin-top: 4px;
}
.login-form button:hover { background: var(--accent-2); }
.login-error {
  background: rgba(255,77,79,.12); color: #ff7875;
  border: 1px solid rgba(255,77,79,.25);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; text-align: center;
}
.login-foot { margin-top: 22px; color: var(--muted); font-size: 12px; }

/* ===== Topbar ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; flex-direction: column; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.3px; }
.brand-tag { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 20px; font-size: 13px; color: var(--muted);
}
.btn-ghost {
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 6px 12px; border-radius: 8px; transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ===== Layout ===== */
.wrap { max-width: 720px; margin: 0 auto; padding: 22px 16px 60px; }

/* ===== Address card ===== */
.addr-card {
  background: linear-gradient(135deg, #1c2433, #181b22);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.addr-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.addr-row { display: flex; gap: 8px; }
.addr-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 14px 16px; border-radius: 12px;
  font-size: 17px; font-weight: 600; outline: none; min-width: 0;
}
.btn-copy {
  background: var(--accent); color: #fff; border: 0; padding: 0 20px;
  border-radius: 12px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-copy:hover { background: var(--accent-2); }
.addr-actions { display: flex; gap: 10px; margin-top: 14px; align-items: center; }
.btn-action {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); padding: 10px 16px;
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.btn-action:hover { border-color: var(--accent); background: #262b36; }
.domain-sel {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); padding: 10px 14px;
  border-radius: 10px; font-size: 14px; cursor: pointer; outline: none;
}

/* ===== Inbox ===== */
.inbox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.inbox-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.inbox-head h2 { margin: 0; font-size: 16px; }
.inbox-tools { display: flex; align-items: center; gap: 12px; }
.auto-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(46,204,113,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,204,113,.5);} 70%{ box-shadow: 0 0 0 8px rgba(46,204,113,0);} 100%{ box-shadow:0 0 0 0 rgba(46,204,113,0);} }
.btn-refresh {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); padding: 8px 14px;
  border-radius: 9px; cursor: pointer; font-size: 13px; transition: border-color .15s;
}
.btn-refresh:hover { border-color: var(--accent); }
.btn-refresh:active svg { transform: rotate(180deg); transition: transform .3s; }

.inbox-list { min-height: 240px; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty p { margin: 16px 0 4px; font-size: 15px; color: var(--text); }
.empty small { font-size: 12px; }
.empty-spinner {
  width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mail-item {
  display: flex; gap: 14px; padding: 16px 18px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .12s; align-items: flex-start;
}
.mail-item:hover { background: var(--surface-2); }
.mail-item.unseen { background: rgba(79,140,255,.06); }
.mail-item.unseen .mail-from { font-weight: 700; }
.mail-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #fff;
}
.mail-main { flex: 1; min-width: 0; }
.mail-row1 { display: flex; justify-content: space-between; gap: 10px; }
.mail-from { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-time { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.mail-subject { font-size: 14px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-otp {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  background: rgba(46,204,113,.12); border: 1px solid rgba(46,204,113,.3);
  color: #4ade80; font-weight: 700; font-size: 16px; letter-spacing: 2px;
  padding: 5px 12px; border-radius: 8px; cursor: pointer;
}
.mail-otp i { font-style: normal; font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.mail-otp:hover { background: rgba(46,204,113,.2); }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; z-index: 50; overflow-y: auto;
}

/* Penting: atribut [hidden] harus menang atas display:flex,
   kalau tidak modal/otp-banner/toast nyangkut tampil terus. */
[hidden] { display: none !important; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 640px;
  margin-top: 30px; box-shadow: var(--shadow); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-back, .modal-close {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: 9px;
  cursor: pointer; font-size: 18px; flex-shrink: 0;
}
.modal-back { display: none; }
.modal-meta { flex: 1; min-width: 0; }
.modal-subject { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-from { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.otp-banner {
  margin: 16px 18px; padding: 18px;
  background: linear-gradient(135deg, rgba(46,204,113,.15), rgba(46,204,113,.05));
  border: 1px solid rgba(46,204,113,.3); border-radius: 12px; text-align: center;
}
.otp-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.otp-code {
  font-size: 38px; font-weight: 800; letter-spacing: 8px; color: #4ade80;
  margin: 8px 0 14px; font-variant-numeric: tabular-nums;
}
.otp-copy {
  background: var(--green); color: #06291a; border: 0; font-weight: 700;
  padding: 10px 24px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.otp-copy:hover { filter: brightness(1.08); }

.modal-body { padding: 18px; }
.mail-frame { width: 100%; border: 0; min-height: 200px; background: #fff; border-radius: 8px; }
.mail-text { white-space: pre-wrap; word-wrap: break-word; font-family: inherit; font-size: 14px; color: var(--text); margin: 0; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #fff; color: #111; padding: 12px 22px; border-radius: 30px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .25s, transform .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Mobile ===== */
@media (max-width: 560px) {
  .wrap { padding: 16px 12px 50px; }
  .addr-input { font-size: 15px; padding: 12px; }
  .btn-copy { padding: 0 16px; }
  .otp-code { font-size: 30px; letter-spacing: 5px; }
  .modal { padding: 0; }
  .modal-card { margin-top: 0; border-radius: 0; min-height: 100vh; max-width: 100%; }
  .modal-back { display: block; }
  .brand-tag { display: none; }
}


/* ===== Buka email lama + Riwayat alamat ===== */
.btn-open { }
.open-old { display: flex; gap: 8px; margin-top: 12px; }
.open-old[hidden] { display: none !important; }
.open-old .addr-input { flex: 1; }

.history { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-top: 18px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.history-head h2 { font-size: 16px; margin: 0; }
.history-tools { display: flex; gap: 8px; align-items: center; }
.hist-search { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s; }
.hist-item:hover { border-color: var(--accent-2); }
.hist-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hist-addr { font-family: monospace; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-meta { font-size: 12px; color: var(--muted); }
.hist-open { flex-shrink: 0; background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.hist-open:hover { opacity: .9; }
.hist-empty { color: var(--muted); font-size: 14px; padding: 16px 4px; text-align: center; }
.hist-pager { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pg-btn { background: var(--bg); border: 1px solid var(--border); color: var(--text); min-width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-dots { color: var(--muted); padding: 0 4px; align-self: center; }
