/* ══════════════════════════════════════════════════════
   Agentius — Shared Base Styles (Apple HIG inspired)
   ══════════════════════════════════════════════════════ */

/* ── 1. Design tokens — light/dark mode ── */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #f2f2f7;
  --border: #e5e5ea;
  --accent: #007aff;
  --accent-hover: #0062cc;
  --danger: #ff3b30;
  --success: #34c759;
  --warning: #ff9500;
  --text: #1d1d1f;
  --text-muted: #86868b;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --nav-bg: rgba(255, 255, 255, 0.75);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface2: #2c2c2e;
    --border: #38383a;
    --accent: #0a84ff;
    --accent-hover: #007aff;
    --danger: #ff453a;
    --success: #32d74b;
    --warning: #ff9f0a;
    --text: #f5f5f7;
    --text-muted: #98989d;
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --nav-bg: rgba(28, 28, 30, 0.75);
  }
}

/* ── 2. Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 3. Nav — iOS style с backdrop-filter ── */
nav {
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.nav-right { justify-content: flex-end; }

.nav-brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.4px;
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.nav-back {
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
}
.nav-back:hover { opacity: 0.7; }

.nav-user { color: var(--text-muted); font-size: 13px; }

.nav-balance {
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  background: rgba(52, 199, 89, 0.12);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.demo-badge {
  background: rgba(255, 149, 0, 0.15);
  color: var(--warning);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── 4. Layout ── */
.container { max-width: 1000px; margin: 0 auto; padding: 32px 20px; }

/* ── 5. Buttons — pill shape ── */
button { cursor: pointer; border: none; font-family: inherit; outline: none; }

.btn-primary, .btn-tiktok, .btn-ghost, .btn-danger {
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: scale(0.98); }
.btn-primary:active { transform: scale(0.95); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-tiktok { background: var(--tiktok, #000); color: #fff; box-shadow: var(--shadow-sm); }
.btn-tiktok:hover { opacity: 0.9; transform: scale(0.98); }

.btn-ghost { background: var(--surface2); color: var(--text); }
.btn-ghost:hover { background: var(--border); }

.btn-danger { background: rgba(255, 59, 48, 0.1); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 59, 48, 0.15); }

.btn-secondary { background: var(--surface2); color: var(--text); border: none; border-radius: 999px; padding: 10px 20px; font-size: 14px; font-weight: 500; }
.btn-secondary:hover { background: var(--border); }

.btn-sm { padding: 6px 16px; font-size: 13px; font-weight: 500; }

button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── 6. Screens ── */
.screen { display: none; animation: fadeIn 0.4s ease; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 7. Section header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  margin-top: 32px;
}
.section-header h2, .section-header h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ── 8. Empty state ── */
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }

/* ── 9. Toast — iOS pill top-center ── */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -20px) scale(0.9);
  background: rgba(28, 28, 30, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  white-space: nowrap;
}

@media (prefers-color-scheme: light) {
  #toast { background: rgba(255, 255, 255, 0.92); color: #1d1d1f; border: 1px solid var(--border); }
}

#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#toast.error { color: var(--danger); }
#toast.success { color: var(--success); }
#toast.info { color: var(--accent); }

/* ── 10. Spinner ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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