/* ═══════════════════════════════════════════════════════════════════════════
   ADNTmail — Stylesheet
   Clean, rigid, humanistic design. No AI-ish vibes.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --text: #1c1c1c;
  --text-2: #555;
  --text-3: #999;
  --border: #d4d4d4;
  --border-lt: #e8e8e8;
  --accent: #1a56db;
  --accent-h: #1443ad;
  --accent-bg: #eff4ff;
  --accent-border: #bfcfee;
  --red: #c53030;
  --red-h: #9b2c2c;
  --green: #276749;
  --green-bg: #edf7ed;
  --green-border: #c6e6c6;
  --font: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --radius: 3px;
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}

.logo-img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: contain;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-accent {
  color: var(--accent);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  padding: 3px 10px;
  border-radius: 2px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  padding-top: 40px;
  padding-bottom: 8px;
}

.hero-banner {
  margin-bottom: 20px;
  text-align: center;
}

.hero-banner-img {
  max-width: 100%;
  width: 220px;
  height: auto;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.hero-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 520px;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Generator ──────────────────────────────────────────────────────────── */

.generator-card {
  padding: 16px;
}

.gen-row {
  margin-bottom: 12px;
}

.gen-input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.gen-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}

.gen-input::placeholder {
  color: var(--text-3);
  font-family: var(--font);
  font-size: 13px;
}

.gen-at {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-3);
  padding: 0 2px;
  flex-shrink: 0;
}

.gen-select {
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 28px 10px 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-left: 1px solid var(--border-lt);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.gen-actions {
  display: flex;
  gap: 8px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius);
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  flex: 1;
}
.btn-primary:hover { background: var(--accent-h); }

.btn-outline {
  background: var(--bg-card);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: var(--text-3);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}
.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Active Section ─────────────────────────────────────────────────────── */

.active-section {
  margin-top: 16px;
}

.active-card {
  padding: 14px 16px;
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

.active-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.active-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  margin-bottom: 4px;
  display: block;
}

.active-email-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.active-email {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  user-select: all;
  word-break: break-all;
}

.active-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.retention-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  padding: 4px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* ── Saved Addresses ────────────────────────────────────────────────── */

.saved-section {
  margin-top: 20px;
}

.saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.saved-count {
  font-size: 12px;
  color: var(--text-3);
}

.saved-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-lt);
  cursor: pointer;
  transition: background 0.1s;
  gap: 8px;
}
.saved-item:last-child { border-bottom: none; }
.saved-item:hover { background: #f9f9fb; }
.saved-item.active { background: var(--accent-bg); }

.saved-addr {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-item.active .saved-addr {
  color: var(--accent);
  font-weight: 600;
}

.saved-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.saved-active-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Inbox ──────────────────────────────────────────────────────────────── */

.inbox-section {
  margin-top: 24px;
}

.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.inbox-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-count {
  font-size: 12px;
  color: var(--text-3);
}

/* ── Email List ─────────────────────────────────────────────────────────── */

.email-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.email-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--bg-card);
  cursor: pointer;
  border-bottom: 1px solid var(--border-lt);
  transition: background 0.1s;
}
.email-item:last-child { border-bottom: none; }
.email-item:hover { background: #f9f9fb; }

.email-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.email-from {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.email-time {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-3);
  flex-shrink: 0;
}

.email-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-preview {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-attach-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Empty State ────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-3);
}

.empty-icon {
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 13px;
  line-height: 1.5;
}

/* ── Viewer ──────────────────────────────────────────────────────────────── */

.viewer-section {
  margin-top: 24px;
}

.viewer-back {
  margin-bottom: 12px;
}

.viewer-card {
  overflow: hidden;
}

.viewer-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-lt);
}

.viewer-subject {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  word-break: break-word;
  line-height: 1.3;
}

.viewer-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.viewer-from {
  font-size: 13px;
  color: var(--text-2);
}

.viewer-date {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-3);
}

.viewer-attachments {
  padding: 10px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-lt);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.att-chip {
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 2px;
}

.viewer-body {
  padding: 18px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

.viewer-body iframe {
  width: 100%;
  border: none;
  min-height: 300px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  margin-top: auto;
}

.footer-inner {
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-dot {
  color: var(--border);
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
}
.footer-link:hover {
  text-decoration: underline;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Utility ────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

.btn-icon.spin svg {
  animation: spin 0.5s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 580px) {
  .container { padding: 0 14px; }

  .hero { padding-top: 28px; }
  .hero-title { font-size: 23px; }
  .hero-banner-img { width: 160px; }

  .gen-input-group {
    flex-direction: column;
  }
  .gen-at { display: none; }
  .gen-select {
    border-left: none;
    border-top: 1px solid var(--border-lt);
    width: 100%;
    padding: 10px 28px 10px 12px;
  }
  .gen-actions { flex-direction: column; }
  .btn-primary { flex: auto; }

  .active-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .active-controls {
    width: 100%;
    justify-content: space-between;
  }

  .email-row-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }
}
