/* ============================================
   URBot Pro — Subscriber Management Portal
   Dark theme, gold accent, matches site aesthetic
   ============================================ */

:root {
  --bg: #050812;
  --bg-card: #0d1117;
  --bg-card-hover: #111827;
  --border: rgba(255, 255, 255, 0.07);
  --border-pro: rgba(251, 191, 36, 0.25);
  --accent: #fbbf24;
  --accent-glow: rgba(251, 191, 36, 0.15);
  --accent-dim: rgba(251, 191, 36, 0.6);
  --green: #00ff88;
  --green-dim: rgba(0, 255, 136, 0.15);
  --red: #ff4444;
  --red-dim: rgba(255, 68, 68, 0.1);
  --blue: #60a5fa;
  --text: #f0f0f8;
  --text-dim: #8a8ab0;
  --text-muted: #555580;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
.pm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(10, 10, 24, 0.97);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.pm-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.05em;
}
.pm-logo span { color: var(--accent); }
.pm-nav { display: flex; gap: 16px; align-items: center; }
.pm-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}
.pm-nav a:hover { color: var(--text); }
.pm-nav a.active { color: var(--accent); font-weight: 700; }

/* ── Layout ── */
.pm-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ── Loading / Auth wall ── */
.pm-loading, .pm-auth-wall {
  text-align: center;
  padding: 100px 24px;
  color: var(--text-dim);
}
.pm-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(251, 191, 36, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pm-auth-wall h2 { font-size: 1.6rem; margin-bottom: 10px; color: var(--text); }
.pm-auth-wall p { margin-bottom: 24px; }
.btn-signin {
  display: inline-block;
  padding: 11px 28px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #0a0a0a;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-signin:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3);
}

/* ── Section titles ── */
.pm-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
  margin-top: 36px;
}
.pm-section-title:first-child { margin-top: 0; }

/* ── Status Card ── */
.pm-status-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 12px;
  overflow: hidden;
}
.pm-status-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  background: linear-gradient(135deg, rgba(251,191,36,0.45), rgba(251,191,36,0.1), transparent) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}
.pm-status-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b, transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.pm-status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pm-status-left h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.pm-status-left h1 span { color: var(--accent); }
.pm-status-left p {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.pm-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(251,191,36,0.18), rgba(251,191,36,0.06));
  border: 1px solid rgba(251,191,36,0.4);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.pm-pro-badge::before { content: '★'; }
.pm-status-meta {
  display: flex;
  gap: 28px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pm-meta-item label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.pm-meta-item span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.pm-meta-item.green span { color: var(--green); }
.pm-meta-item.warn span { color: var(--accent); }

/* ── Bot Grid ── */
.pm-bots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
@media (max-width: 768px) {
  .pm-bots-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) and (min-width: 769px) {
  .pm-bots-grid { grid-template-columns: 1fr 1fr; }
}
.pm-bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s;
}
.pm-bot-card:hover {
  border-color: var(--border-pro);
  background: var(--bg-card-hover);
}
.pm-bot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.pm-bot-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}
.pm-bot-info { flex: 1; min-width: 0; }
.pm-bot-name {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-bot-tier {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.pm-bot-pro-icon {
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  title: 'Pro unlocked';
}

/* ── Credits ── */
.pm-credits-card {
  background: var(--bg-card);
  border: 1px solid var(--border-pro);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pm-credits-left h3 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.pm-credits-left p {
  font-size: 0.82rem;
  color: var(--text-dim);
}
/* Credits gauge */
.pm-credits-gauge {
  flex: 1;
  min-width: 120px;
  max-width: 180px;
}
.pm-gauge-track {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.pm-gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.pm-gauge-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}
.pm-credits-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-credit-apply {
  display: inline-block;
  padding: 8px 18px;
  background: rgba(251,191,36,0.1);
  border: 1px solid rgba(251,191,36,0.3);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-credit-apply:hover {
  background: rgba(251,191,36,0.2);
  border-color: rgba(251,191,36,0.5);
}

/* ── Credits history table ── */
.pm-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.pm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.pm-table th {
  background: rgba(255,255,255,0.03);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.pm-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text);
}
.pm-table tr:last-child td { border-bottom: none; }
.pm-table tr:hover td { background: rgba(255,255,255,0.02); }
.pm-table .amount-credit { color: var(--green); font-weight: 600; }
.pm-table .amount-debit { color: var(--accent); font-weight: 600; }
.pm-table .empty-row td { color: var(--text-muted); text-align: center; padding: 24px; }

/* ── Personality sliders ── */
.pm-personality-section { margin-bottom: 8px; }
.pm-bot-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pm-bot-pill {
  padding: 6px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.pm-bot-pill:hover { border-color: var(--border-pro); color: var(--text); }
.pm-bot-pill.active {
  background: rgba(251,191,36,0.1);
  border-color: rgba(251,191,36,0.4);
  color: var(--accent);
}
.pm-sliders-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
}
.pm-sliders-card.no-selection {
  text-align: center;
  padding: 36px;
  color: var(--text-muted);
}
.pm-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.pm-slider-row:last-child { margin-bottom: 0; }
.pm-slider-label {
  width: 90px;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  text-align: right;
}
.pm-slider-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.pm-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s;
}
.pm-slider-input::-webkit-slider-thumb:hover { transform: scale(1.2); }
.pm-slider-value {
  width: 28px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}
.pm-slider-ends {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}
.pm-save-badge {
  display: none;
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
  margin-top: 10px;
}
.pm-save-badge.visible { display: block; }

/* ── Billing section ── */
.pm-billing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pm-billing-info p { font-size: 0.9rem; color: var(--text-dim); line-height: 1.5; }
.pm-billing-info strong { color: var(--text); }
.btn-cancel {
  padding: 9px 22px;
  background: transparent;
  border: 1px solid rgba(255, 68, 68, 0.35);
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-cancel:hover {
  background: var(--red-dim);
  border-color: rgba(255, 68, 68, 0.6);
}

/* ── Download All ── */
.pm-download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pm-download-card p { font-size: 0.85rem; color: var(--text-dim); }
.btn-download-all {
  display: inline-block;
  padding: 9px 22px;
  background: rgba(96,165,250,0.1);
  border: 1px solid rgba(96,165,250,0.3);
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-download-all:hover { background: rgba(96,165,250,0.18); }

/* ── Modal (cancel confirmation) ── */
.pm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
.pm-modal-overlay.open { display: flex; }
.pm-modal {
  background: #111827;
  border: 1px solid rgba(255,68,68,0.3);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
}
.pm-modal h3 { font-size: 1.1rem; margin-bottom: 10px; }
.pm-modal p { font-size: 0.88rem; color: var(--text-dim); line-height: 1.5; margin-bottom: 24px; }
.pm-modal-actions { display: flex; gap: 12px; justify-content: center; }
.btn-modal-cancel {
  padding: 10px 24px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.btn-modal-cancel:hover { background: rgba(255,255,255,0.05); }
.btn-modal-confirm {
  padding: 10px 24px;
  background: rgba(255,68,68,0.15);
  border: 1px solid rgba(255,68,68,0.4);
  color: var(--red);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 0.15s;
}
.btn-modal-confirm:hover { background: rgba(255,68,68,0.25); }

/* ── Toast notification ── */
.pm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a2035;
  border: 1px solid var(--border-pro);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--text);
  z-index: 1000;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 320px;
}
.pm-toast.visible {
  transform: translateY(0);
  opacity: 1;
}
.pm-toast.success { border-color: rgba(0,255,136,0.3); }
.pm-toast.error { border-color: rgba(255,68,68,0.3); }

/* ── Footer ── */
.pm-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.pm-footer a { color: var(--text-dim); text-decoration: none; }
.pm-footer a:hover { color: var(--text); }
