/* ═══════════════════════════════════════════════════
   AGY Account Switcher — Premium Dark Theme
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-active: #0d2847;
  --border: #1e1e2e;
  --border-active: #4285F4;
  --text-primary: #e8eaf0;
  --text-secondary: #8b8fa3;
  --text-muted: #555770;
  --accent-blue: #4285F4;
  --accent-green: #34A853;
  --accent-red: #EA4335;
  --accent-yellow: #FBBC04;
  --accent-purple: #9C27B0;
  --glow-blue: rgba(66, 133, 244, 0.15);
  --glow-green: rgba(52, 168, 83, 0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated BG ── */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 600px 400px at 20% 20%, rgba(66,133,244,0.06), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(156,39,176,0.04), transparent),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(52,168,83,0.03), transparent);
}

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 20px rgba(66,133,244,0.25);
}
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.logo-text span { color: var(--accent-blue); }
.header-right { display: flex; align-items: center; gap: 10px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-xs);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #6a9ff8);
  color: #fff;
  box-shadow: 0 4px 16px rgba(66,133,244,0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(66,133,244,0.4);
}
.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-danger {
  background: rgba(234,67,53,0.1);
  color: var(--accent-red);
  border: 1px solid rgba(234,67,53,0.2);
}
.btn-danger:hover { background: rgba(234,67,53,0.2); }
.btn-switch {
  background: linear-gradient(135deg, var(--accent-green), #45c764);
  color: #fff;
  box-shadow: 0 4px 16px rgba(52,168,83,0.3);
  padding: 10px 24px; font-size: 14px;
}
.btn-switch:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(52,168,83,0.45);
}
.btn-switch:disabled {
  background: var(--text-muted); box-shadow: none;
  cursor: default; transform: none;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Main ── */
.main { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 32px 24px 80px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }

/* ── Active Banner ── */
.active-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(52,168,83,0.08), rgba(66,133,244,0.06));
  border: 1px solid rgba(52,168,83,0.2);
  border-radius: var(--radius);
  margin-bottom: 28px;
  animation: bannerPulse 3s ease-in-out infinite;
}
@keyframes bannerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,168,83,0.05); }
  50% { box-shadow: 0 0 20px 2px rgba(52,168,83,0.08); }
}
.active-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}
.active-banner-text { font-size: 14px; color: var(--text-secondary); }
.active-banner-text strong { color: var(--text-primary); font-weight: 600; }

/* ── Accounts Grid ── */
.accounts-grid {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}

/* ── Account Card ── */
.account-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}
.account-card:hover {
  background: var(--bg-card-hover);
  border-color: #2a2a3e;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.account-card.is-active {
  background: var(--bg-active);
  border-color: var(--border-active);
  box-shadow: 0 0 24px var(--glow-blue), inset 0 0 40px rgba(66,133,244,0.03);
}

.card-left { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }

.avatar {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  flex-shrink: 0; position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.avatar-badge {
  position: absolute; bottom: -3px; right: -3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-green);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 6px var(--accent-green);
}
.is-active .avatar-badge { border-color: var(--bg-active); }

.card-info { min-width: 0; }
.card-name { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.card-email {
  font-size: 13px; color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.card-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; margin-top: 8px;
}
.status-active {
  background: rgba(52,168,83,0.12); color: var(--accent-green);
}
.status-inactive {
  background: rgba(139,143,163,0.08); color: var(--text-muted);
}

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

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 60px 20px;
  border: 2px dashed var(--border); border-radius: var(--radius);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 520px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px; border-radius: 6px; transition: var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.modal-body { padding: 24px; }

/* ── Form ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 7px;
}
.form-input {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: inherit; font-size: 14px;
  outline: none; transition: var(--transition);
}
.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(66,133,244,0.15);
}
textarea.form-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; resize: vertical; min-height: 90px;
}
.form-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Color Picker ── */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt input { display: none; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; transition: var(--transition);
  display: block;
}
.color-opt input:checked + .color-swatch {
  border-color: #fff; transform: scale(1.1);
  box-shadow: 0 2px 12px rgba(255,255,255,0.2);
}

.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(100px);
  padding: 14px 24px; border-radius: var(--radius-xs);
  font-size: 14px; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  z-index: 2000; opacity: 0; pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.success { border-color: rgba(52,168,83,0.4); }
.toast.error { border-color: rgba(234,67,53,0.4); }

/* ── Spinner ── */
.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 600px) {
  .header-inner { gap: 10px; }
  .main { padding: 20px 16px 60px; }
  .page-title { font-size: 22px; }
  .account-card { flex-direction: column; align-items: stretch; gap: 16px; }
  .card-actions { justify-content: flex-end; }
  .btn-switch { width: 100%; justify-content: center; }
}

/* ── Quota Panel ── */
.account-card { flex-wrap: wrap; }
.quota-panel {
  width: 100%;
  border-top: 1px solid var(--border);
  padding: 16px 0 4px;
  margin-top: 4px;
}
.quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.quota-item {
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
}
.quota-model-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quota-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  margin-bottom: 6px;
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.quota-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}
.quota-reset {
  color: var(--text-muted);
}
.quota-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 0;
}
.quota-error {
  color: var(--accent-red);
  font-size: 13px;
  padding: 8px 0;
}
.quota-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 0;
}
.btn-quota {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}
.btn-quota:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.quota-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.quota-no-claude {
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

