/* src/style.css - Temp Mail UI */
:root {
  --bg: #0f1117;
  --bg-elev: #161922;
  --bg-hover: #1d2130;
  --border: #252a3a;
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --text-mute: #6b7280;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-dim: #475569;
  --text-mute: #94a3b8;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --shadow: 0 4px 24px rgba(15,23,42,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
a { color: var(--accent); }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: grid; place-items: center;
  color: white;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-mute); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item span:not(.badge) { flex: 1; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  min-width: 20px;
  text-align: center;
}
.badge:empty, .badge[data-count="0"] { display: none; }

.sidebar-section { margin-top: 20px; padding: 0 4px; }
.sidebar-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  margin-bottom: 8px;
  padding: 0 8px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 8px 0;
  font-size: 11px;
  color: var(--text-mute);
  border-top: 1px solid var(--border);
}
.sidebar-footer a { color: var(--text-mute); text-decoration: none; }
.sidebar-footer a:hover { color: var(--accent); }

.main { display: flex; flex-direction: column; overflow: hidden; }

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.menu-btn { display: none; }
.search-wrap {
  flex: 1;
  max-width: 520px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-mute);
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.search:focus { border-color: var(--accent); }
.header-actions { display: flex; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--text-dim);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.toggle-auto.active { color: var(--accent); background: var(--accent-soft); }

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.content-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.subtitle { color: var(--text-mute); font-size: 13px; margin-top: 2px; }
.content-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-danger-ghost { color: var(--danger); border: 1px solid var(--border); }
.btn-danger-ghost:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); }
.btn-ghost { color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-lg { padding: 12px 20px; font-size: 14px; }

.select, .input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.select:focus, .input:focus { border-color: var(--accent); }
.select-sm { padding: 6px 10px; font-size: 12px; width: auto; }

.filters-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.chk-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.chk-wrap input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.mail-list { display: flex; flex-direction: column; gap: 8px; }
.mail-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.mail-item:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.mail-item.unread { border-left: 3px solid var(--accent); }
.mail-item.unread .mail-subject { font-weight: 600; }
.mail-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.mail-main { min-width: 0; }
.mail-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.mail-sender {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.domain-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: lowercase;
}
.mail-subject {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.mail-preview {
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-meta {
  text-align: right;
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.mail-recipient {
  font-size: 11px;
  color: var(--text-dim);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-del {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--text-mute);
  transition: all 0.15s;
}
.mail-del:hover { background: rgba(239,68,68,0.15); color: var(--danger); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
}
.empty svg { margin-bottom: 16px; opacity: 0.4; }
.empty h3 { font-size: 16px; color: var(--text-dim); margin-bottom: 6px; }
.empty p { font-size: 13px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-hover) 50%, var(--bg-elev) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  height: 72px;
  margin-bottom: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pagination button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 12px;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.addr-list { display: grid; gap: 10px; }
.addr-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.addr-item:hover { border-color: var(--accent); }
.addr-info { flex: 1; min-width: 0; }
.addr-full {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-all;
}
.addr-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.addr-actions { display: flex; gap: 6px; flex-shrink: 0; }

.create-card {
  max-width: 560px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-row { display: flex; flex-direction: column; gap: 8px; }
.form-row > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .input { flex: 1; }
.preview-box {
  padding: 14px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.preview-box label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.preview-address {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 6px;
  word-break: break-all;
}

.result-card {
  max-width: 560px;
  margin-top: 20px;
  padding: 28px;
  background: var(--bg-elev);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  text-align: center;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-card.hidden { display: none; }
.result-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(16,185,129,0.15);
  color: var(--success);
  display: grid; place-items: center;
  margin: 0 auto 14px;
}
.result-card h3 { font-size: 16px; margin-bottom: 14px; }
.result-address {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.result-address code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  word-break: break-all;
}

.action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: slideUp 0.2s ease;
}
.action-bar.hidden { display: none; }
.action-bar span { font-size: 13px; font-weight: 500; }
.action-bar-btns { display: flex; gap: 8px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal-panel {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}
.modal-mail { width: 100%; max-width: 820px; }
.modal-confirm { width: 100%; max-width: 400px; padding: 28px; text-align: center; }
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title-wrap { flex: 1; min-width: 0; }
.modal-title-wrap h2 {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-meta {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.meta-label {
  font-weight: 600;
  color: var(--text-mute);
  min-width: 70px;
  font-size: 12px;
}
.copy-mini {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.copy-mini:hover { background: var(--accent); color: white; }
.modal-body {
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
}
.modal-body iframe {
  width: 100%;
  height: 500px;
  border: none;
  background: white;
  display: block;
}
.modal-body pre {
  padding: 20px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.confirm-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  display: grid; place-items: center;
  margin: 0 auto 16px;
}
.modal-confirm h3 { font-size: 16px; margin-bottom: 8px; }
.modal-confirm p { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; line-height: 1.6; }
.confirm-btns { display: flex; gap: 8px; justify-content: center; }

.toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  min-width: 220px;
  animation: slideIn 0.2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: grid; }
  .header { padding: 12px 16px; }
  .tab-content { padding: 16px; }
  .content-header { flex-direction: column; align-items: stretch; }
  .content-actions { justify-content: flex-end; }
  .mail-item { grid-template-columns: 24px 1fr; }
  .mail-meta { grid-column: 2; text-align: left; align-items: flex-start; flex-direction: row; gap: 10px; }
  .mail-del { position: absolute; top: 10px; right: 10px; }
  .addr-item { flex-direction: column; align-items: stretch; }
  .addr-actions { justify-content: flex-end; }
  .search-wrap { max-width: none; }
  .action-bar { left: 16px; right: 16px; transform: none; bottom: 16px; }
  .modal-body iframe { height: 400px; }
  .toast-wrap { left: 16px; right: 16px; top: 16px; }
  .toast { min-width: 0; }
}