/* ═══════════════════════════════════════════════════════════
   XinoShell Admin Panel — Professional Dark Theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-base:       #0a0a0f;
  --bg-surface:    #111118;
  --bg-card:       #16161f;
  --bg-input:      #1c1c28;
  --bg-hover:      #1e1e2e;
  --border:        #2a2a3d;
  --border-light:  #333350;
  --accent:        #7c3aed;
  --accent-light:  #9d6fff;
  --accent-glow:   rgba(124,58,237,0.25);
  --accent-green:  #10b981;
  --accent-red:    #ef4444;
  --accent-yellow: #f59e0b;
  --accent-blue:   #3b82f6;
  --text-primary:  #f1f0ff;
  --text-secondary:#a09ec0;
  --text-muted:    #5c5a7a;
  --shadow:        0 4px 24px rgba(0,0,0,0.5);
  --radius:        12px;
  --radius-sm:     8px;
  --transition:    0.2s ease;
  --sidebar-width: 240px;
}

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

html { font-size: 15px; }

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

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--text-primary); }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(59,130,246,0.05) 0%, transparent 60%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(124,58,237,0.1);
}

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

.login-logo .logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.login-logo h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.login-logo p  { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN
   ═══════════════════════════════════════════════════════════ */
#app {
  display: none;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-box {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 2px 0;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid rgba(124,58,237,0.2);
}

.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
}

.sidebar-user .avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; overflow: hidden; }
.sidebar-user .user-name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user .user-role { font-size: 0.72rem; color: var(--text-muted); }

.btn-logout-sidebar {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: color var(--transition);
}
.btn-logout-sidebar:hover { color: var(--accent-red); }

/* ── Main content ──────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  position: sticky; top: 0; z-index: 50;
}

.top-bar h2 { font-size: 1.2rem; font-weight: 700; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 32px; flex: 1; }

/* ── Pages ─────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   CARDS & STATS
   ═══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.purple { background: rgba(124,58,237,0.15); }
.stat-icon.green  { background: rgba(16,185,129,0.15); }
.stat-icon.red    { background: rgba(239,68,68,0.15); }
.stat-icon.yellow { background: rgba(245,158,11,0.15); }
.stat-icon.blue   { background: rgba(59,130,246,0.15); }

.stat-info .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-info .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   PANELS / SECTIONS
   ═══════════════════════════════════════════════════════════ */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 { font-size: 0.95rem; font-weight: 600; }
.panel-body { padding: 20px 22px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* ═══════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead tr {
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 11px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody tr:hover td { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

td .text-primary { color: var(--text-primary); font-weight: 500; }
td .text-mono    { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

.empty-table {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-table .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-table p { font-size: 0.9rem; }

/* ═══════════════════════════════════════════════════════════
   BADGES / STATUS
   ═══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.badge-red    { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.badge-purple { background: rgba(124,58,237,0.15); color: #a78bfa; border: 1px solid rgba(124,58,237,0.2); }
.badge-gray   { background: rgba(100,100,120,0.15); color: #94a3b8; border: 1px solid rgba(100,100,120,0.2); }

/* ═══════════════════════════════════════════════════════════
   FORMS & INPUTS
   ═══════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

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

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-select option { background: var(--bg-card); color: var(--text-primary); }

.form-hint {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.checkbox-item:hover { border-color: var(--accent); }
.checkbox-item input[type=checkbox] { accent-color: var(--accent); }
.checkbox-item.checked {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent-light);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-light); box-shadow: 0 4px 20px rgba(124,58,237,0.4); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-light); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); }

.btn-success {
  background: rgba(16,185,129,0.15);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.2);
}
.btn-success:hover:not(:disabled) { background: rgba(16,185,129,0.25); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; aspect-ratio: 1; }

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 22px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   ACTIVITY LOG
   ═══════════════════════════════════════════════════════════ */
.activity-list { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-info { flex: 1; }
.activity-action { font-size: 0.875rem; color: var(--text-primary); font-weight: 500; }
.activity-detail { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.activity-time   { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════
   SEARCH / FILTER BAR
   ═══════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  padding-left: 36px;
}

/* ═══════════════════════════════════════════════════════════
   COPY BUTTON INLINE
   ═══════════════════════════════════════════════════════════ */
.copy-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-copy {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color var(--transition);
}
.btn-copy:hover { color: var(--accent-light); }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: slideInToast 0.3s ease;
  max-width: 320px;
}

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

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

/* ═══════════════════════════════════════════════════════════
   LOADING 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); } }

/* ═══════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════ */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.settings-section-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  background: var(--accent-glow);
}

.settings-section-header h3 { font-size: 0.95rem; font-weight: 600; }
.settings-section-body { padding: 22px; }

/* ═══════════════════════════════════════════════════════════
   FEATURES LIST
   ═══════════════════════════════════════════════════════════ */
.feature-code-list { display: flex; flex-direction: column; gap: 10px; }

.feature-code-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.feature-code {
  font-family: monospace;
  font-size: 0.85rem;
  background: var(--accent-glow);
  color: var(--accent-light);
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

.feature-desc { font-size: 0.875rem; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════
   ACTIONS DROPDOWN
   ═══════════════════════════════════════════════════════════ */
.actions-wrap { position: relative; display: inline-block; }

.actions-menu {
  position: absolute;
  right: 0; top: 110%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 200;
  min-width: 160px;
  overflow: hidden;
  display: none;
}

.actions-menu.open { display: block; }

.action-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.action-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-menu-item.danger:hover { background: rgba(239,68,68,0.1); color: #f87171; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Divider ───────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Tag ───────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 2px;
}