/* ═══════════════════════════════════════════════════════
   GhostDroid Admin Panel — Styles
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-sidebar: #0e0e15;
  --surface: #1e1e2a;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(99, 179, 237, 0.25);

  --accent: #4facfe;
  --accent-alt: #00f2fe;
  --accent-glow: rgba(79, 172, 254, 0.15);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --danger: #f56565;
  --success: #48bb78;
  --warning: #ecc94b;
  --purple: #a78bfa;

  --text-primary: #f0f0f5;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-width: 240px;
  --header-height: 56px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; font-family: inherit; background: none; }
input, select, textarea { font-family: inherit; }

/* ═══════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 20px;
  position: relative;
}

.login-screen::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo svg { margin: 0 auto 16px; }

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 16px;
  min-height: 20px;
}

/* ═══════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: 20px;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-row {
  display: flex;
  gap: 20px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--text-primary) !important;
  cursor: pointer;
  padding-top: 28px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #0a0a0f;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.btn-full { width: 100%; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
  color: var(--text-muted);
  background: transparent;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-icon.danger:hover { color: var(--danger); }

/* ═══════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════ */

.admin-app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--duration-normal) var(--ease-out);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-weight: 800;
  font-size: 1.1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast);
  width: 100%;
  text-align: left;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  min-height: 100vh;
}

/* Mobile header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-title {
  font-weight: 700;
  font-size: 1rem;
}

.hamburger-admin {
  width: 32px;
  height: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 4px;
}

.hamburger-admin span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--duration-fast);
}

/* ═══════════════════════════════════════════════════════
   PAGES
   ═══════════════════════════════════════════════════════ */

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s var(--ease-out); }

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════
   STATS
   ═══════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--duration-fast);
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-wide { grid-column: span 2; }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.icon-blue { background: rgba(79, 172, 254, 0.12); color: var(--accent); }
.icon-green { background: rgba(72, 187, 120, 0.12); color: var(--success); }
.icon-yellow { background: rgba(236, 201, 75, 0.12); color: var(--warning); }
.icon-red { background: rgba(245, 101, 101, 0.12); color: var(--danger); }
.icon-cyan { background: rgba(0, 242, 254, 0.12); color: var(--accent-alt); }
.icon-purple { background: rgba(167, 139, 250, 0.12); color: var(--purple); }

.stat-info { display: flex; flex-direction: column; }

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════ */

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

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.plan-bars { display: flex; flex-direction: column; gap: 14px; }

.plan-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.plan-label {
  width: 90px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.plan-bar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-secondary);
  border-radius: 5px;
  overflow: hidden;
}

.plan-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s var(--ease-out);
  min-width: 2px;
}

.bar-blue { background: var(--accent); }
.bar-cyan { background: var(--accent-alt); }
.bar-purple { background: var(--purple); }

.plan-count {
  width: 36px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-align: right;
}

/* ═══════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════ */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr { transition: background var(--duration-fast); }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.code-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent) !important;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
}

.email-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-active { background: rgba(72, 187, 120, 0.12); color: var(--success); }
.badge-used { background: rgba(236, 201, 75, 0.12); color: var(--warning); }
.badge-expired { background: rgba(245, 101, 101, 0.12); color: var(--danger); }
.badge-pro { background: rgba(79, 172, 254, 0.12); color: var(--accent); }
.badge-ultra { background: rgba(0, 242, 254, 0.12); color: var(--accent-alt); }
.badge-ultra_max { background: rgba(167, 139, 250, 0.12); color: var(--purple); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.actions-cell {
  display: flex;
  gap: 4px;
}

/* Search & Filter */
.search-input {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  min-width: 220px;
  transition: border-color var(--duration-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-input::placeholder { color: var(--text-muted); }

.filter-select {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg { margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* ═══════════════════════════════════════════════════════
   CREATE FORM
   ═══════════════════════════════════════════════════════ */

.create-form-card {
  max-width: 680px;
}

.create-result {
  margin-top: 28px;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(72, 187, 120, 0.2);
  text-align: center;
}

.create-result h4 {
  color: var(--success);
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.code-display {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 4px;
  padding: 16px;
  background: var(--bg-primary);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  cursor: pointer;
  transition: background var(--duration-fast);
  user-select: all;
}

.code-display:hover { background: var(--accent-glow); }

.result-email {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideInToast 0.3s var(--ease-out);
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes slideInToast {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  animation: modalIn 0.25s var(--ease-out);
}

.modal-wide { max-width: 700px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

.modal-close {
  font-size: 1.6rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.json-view {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-wide { grid-column: span 1; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  }

  .mobile-header { display: flex; }

  .main-content {
    margin-left: 0;
    padding: 80px 16px 32px;
  }

  .stats-grid { grid-template-columns: 1fr; }
  .stat-wide { grid-column: span 1; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .header-actions {
    width: 100%;
    flex-direction: column;
  }

  .search-input { min-width: unset; width: 100%; }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .data-table { font-size: 0.78rem; }
  .data-table th,
  .data-table td { padding: 10px 12px; }

  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.4rem; }
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR OVERLAY (mobile)
   ═══════════════════════════════════════════════════════ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* ═══════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-row td {
  text-align: center;
  padding: 40px !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
