/* ═══════════════════════════════════════
   Dashboard v3 — Clean, Claude-style
═══════════════════════════════════════ */

/* ── App Shell ── */
.app {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  position: relative;
}

/* ── Header — Minimal ── */
.header {
  padding: 14px 24px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px;
  letter-spacing: -0.025em; color: var(--text);
}
.header-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-cta, var(--accent));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(3,39,250,0.20);
  flex-shrink: 0;
}
.header-spacer { flex: 1; }
.header-theme {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; transition: color 0.2s, background 0.2s;
}
.header-theme:hover { color: var(--accent); background: var(--accent-light, rgba(3,39,250,0.06)); }
.header-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-light, rgba(3,39,250,0.06));
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  border: 1.5px solid var(--border);
}
.header-avatar:hover { border-color: var(--accent); background: rgba(3,39,250,0.12); }

/* ── Dropdown ── */
.dropdown {
  position: absolute; top: 56px; right: 24px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(26,39,68,0.10), 0 4px 12px rgba(0,0,0,0.04);
  width: 240px; overflow: hidden; z-index: 100;
  display: none;
}
.dropdown.open { display: block; animation: fadeUp 0.25s ease both; }
.dd-header { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dd-avatar-row { display: flex; align-items: center; gap: 12px; }
.dd-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-light, rgba(3,39,250,0.06)); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; cursor: pointer;
  position: relative; overflow: hidden;
  border: 2px solid var(--border); transition: border-color 0.2s;
}
.dd-avatar:hover { border-color: var(--accent); }
.dd-avatar-edit {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.5); color: white;
  display: flex; align-items: center; justify-content: center;
  height: 18px; opacity: 0; transition: opacity 0.2s;
}
.dd-avatar:hover .dd-avatar-edit { opacity: 1; }
.dd-name { font-size: 14px; font-weight: 600; color: var(--text); }
.dd-email { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.dd-plan {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 100px;
  background: var(--accent-light); color: var(--accent);
  margin-top: 8px; letter-spacing: 0.04em;
}
.dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary, var(--text-muted)); cursor: pointer;
  transition: background 0.15s; border: none; background: none;
  width: 100%; font-family: inherit; text-align: left;
}
.dd-item:hover { background: var(--bg-warm, var(--bg)); }
.dd-danger { color: #D85A30 !important; }
.dd-sep { height: 1px; background: var(--border); }

/* ── Content ── */
.content {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  align-items: center;
}

.center {
  width: 100%; max-width: 640px;
  padding: 0 24px 40px;
}

/* ── Hero / Greeting ── */
.hero {
  text-align: center;
  padding: 40px 0 32px;
}
.hero h1 {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.2;
  color: var(--text);
}
.hero p {
  font-size: 15px; color: var(--text-muted); margin-top: 8px;
}

/* ── Search Card ── */
.search-card {
  width: 100%; position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(26,39,68,0.06), 0 2px 8px rgba(0,0,0,0.03);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.search-card:focus-within {
  border-color: rgba(3,39,250,0.25);
  box-shadow: 0 0 0 4px rgba(3,39,250,0.06), 0 12px 40px rgba(26,39,68,0.08);
}
.search-inner {
  display: flex; align-items: center;
  padding: 6px 6px 6px 20px;
}
.search-icon { color: var(--text-dim); flex-shrink: 0; display: flex; }
.search-input {
  flex: 1; border: none; outline: none; background: none;
  padding: 14px 14px; font-size: 15px; color: var(--text);
  font-family: inherit; min-width: 0;
}
.search-input::placeholder { color: var(--text-dim); }
.search-btn {
  background: var(--accent-cta, var(--accent)); color: white;
  padding: 12px 22px; border-radius: 14px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(3,39,250,0.20);
  transition: all 0.25s; white-space: nowrap;
  font-family: inherit; min-height: 46px;
}
.search-btn:hover {
  background: var(--accent-hover, #0220D4);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(3,39,250,0.30);
}
.search-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Autocomplete ── */
.ac-dropdown {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(26,39,68,0.08), 0 4px 12px rgba(0,0,0,0.04);
  z-index: 100; max-height: 260px; overflow: hidden;
  margin-top: 6px;
}
.ac-dropdown.open { display: block; }
.ac-item {
  padding: 12px 18px; font-size: 14px; color: var(--text-secondary, var(--text-muted));
  cursor: pointer; transition: background 0.15s, color 0.15s;
  min-height: 44px; display: flex; align-items: center;
}
.ac-item:hover, .ac-item.active { background: var(--bg-warm, var(--bg)); color: var(--accent); }

/* ── Progress Card ── */
.progress-card {
  width: 100%; margin-top: 16px;
  background: var(--bg-card);
  border: 1.5px solid rgba(3,39,250,0.15);
  border-radius: 18px; padding: 0;
  box-shadow: 0 0 0 4px rgba(3,39,250,0.04), 0 4px 20px rgba(26,39,68,0.06);
  display: none; overflow: hidden;
}
.progress-card.active { display: block; animation: fadeUp 0.4s ease both; }
.mc-canvas {
  width: 100%; aspect-ratio: 2.8; image-rendering: pixelated;
  border-bottom: 1px solid var(--border); border-radius: 17px 17px 0 0;
}
.progress-body { padding: 16px 22px; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.progress-title { font-size: 13px; font-weight: 700; color: var(--text); }
.progress-timer { font-size: 12px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.progress-addr { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.progress-track { height: 5px; background: var(--bg-warm, #F5F0EB); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--lime, #5FBDFF));
  border-radius: 3px; transition: width 0.5s ease;
}
.progress-step { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ── History ── */
.history {
  width: 100%; margin-top: 32px;
}
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 0 2px;
}
.history-title {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.history-list {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(26,39,68,0.04);
}
.history-loading {
  padding: 24px; text-align: center;
  color: var(--text-dim); font-size: 13px;
}

.history-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.history-row:last-child { border-bottom: none; }
.history-row:hover { background: var(--bg-warm, var(--bg)); }
.history-row:active { background: #EDE8E2; }

.history-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(3,39,250,0.10);
}
.history-dot.muted { background: var(--text-dim); opacity: 0.3; box-shadow: none; }

.history-addr {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-meta {
  font-size: 11px; color: var(--text-dim); margin-top: 2px;
  display: flex; gap: 8px; align-items: center;
}
.history-meta-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong, #D4CFC7); }

.history-badge {
  font-size: 10px; font-weight: 600; padding: 4px 10px;
  border-radius: 100px; flex-shrink: 0;
}
.history-badge-ok { background: var(--green-bg); color: var(--green); }
.history-badge-err { background: var(--red-bg, #FEF2F2); color: var(--red, #DC2626); }

.history-arrow {
  color: var(--text-dim); flex-shrink: 0; transition: all 0.2s;
}
.history-row:hover .history-arrow { transform: translateX(2px); color: var(--accent); }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 40px 20px;
}
.empty-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--bg-warm, #F5F0EB); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-state p { font-size: 13px; color: var(--text-muted); line-height: 1.6; max-width: 280px; margin: 0 auto; }

/* ── Animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.center { animation: fadeUp 0.4s ease both; }

/* ── Toast ── */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,39,68,0.4); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--bg-card); border-radius: 18px;
  padding: 28px; max-width: 420px; width: 90vw;
  box-shadow: 0 24px 64px rgba(26,39,68,0.15);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* ── Mobile ── */
@media (max-width: 767px) {
  .header { padding: 12px 16px; }
  .center { padding: 0 16px 32px; }
  .hero { padding: 24px 0 24px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
  .search-input { font-size: 16px !important; } /* prevent iOS zoom */
  .search-btn-text { display: none; }
  .search-btn { padding: 12px 16px; }
  .search-card { border-radius: 18px; }
  .progress-card { border-radius: 16px; padding: 18px; }
  .history-list { border-radius: 16px; }
  .ac-dropdown { max-height: 40vh; border-radius: 14px; }
  .ac-item { padding: 14px 18px; min-height: 48px; }
  .dropdown { right: 16px; top: 52px; width: 220px; }
  .progress-fill {
    background-size: 200% 100%;
    animation: shimmer 2s ease infinite;
  }
  @keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
}
