﻿/* ═══════════════════════════════════════
   FXMez Admin — Premium Dark UI
   ═══════════════════════════════════════ */

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

:root {
  --bg:       #070b14;
  --surface:  #0d1321;
  --surface2: #121929;
  --border:   rgba(255,255,255,0.07);
  --border-h: rgba(255,255,255,0.13);
  --blue:     #3b82f6;
  --blue-h:   #60a5fa;
  --blue-dim: rgba(59,130,246,0.15);
  --purple:   #8b5cf6;
  --purple-dim: rgba(139,92,246,0.15);
  --orange:   #f59e0b;
  --orange-dim: rgba(245,158,11,0.15);
  --green:    #10b981;
  --green-dim:rgba(16,185,129,0.15);
  --red:      #ef4444;
  --red-dim:  rgba(239,68,68,0.12);
  --text:     #e2e8f0;
  --text-sub: #64748b;
  --text-muted: #334155;
  --radius:   12px;
  --radius-sm:8px;
  --sidebar-w:240px;
  --font: 'Inter', system-ui, sans-serif;
}

html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ════════════ LOGIN ════════════ */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
}
.login-bg { position: absolute; inset: 0; z-index: 0; }
.login-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px,transparent 1px), linear-gradient(90deg,rgba(255,255,255,0.03) 1px,transparent 1px);
  background-size: 40px 40px;
}
.login-blob {
  position: absolute; border-radius: 50%; filter: blur(80px);
}
.lb1 { width: 400px; height: 400px; background: rgba(59,130,246,0.18); top: -100px; right: -100px; animation: blobFloat 8s ease-in-out infinite; }
.lb2 { width: 350px; height: 350px; background: rgba(139,92,246,0.12); bottom: -80px; left: -80px; animation: blobFloat 10s ease-in-out infinite reverse; }

@keyframes blobFloat { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-20px) scale(1.05)} }

.login-card {
  position: relative; z-index: 1;
  background: rgba(13,19,33,0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-h);
  border-radius: 20px;
  padding: 48px 40px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(59,130,246,0.08);
  animation: cardIn 0.5s cubic-bezier(0.16,1,0.3,1);
}
@keyframes cardIn { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:translateY(0)} }

.login-logo { text-align: center; margin-bottom: 20px; }
.login-title { font-size: 24px; font-weight: 700; text-align: center; color: #fff; margin-bottom: 6px; }
.login-sub { color: var(--text-sub); text-align: center; margin-bottom: 32px; font-size: 13.5px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.06em; }
.form-group input, .form-input {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-h);
  border-radius: var(--radius-sm); padding: 11px 14px; color: var(--text);
  font-size: 14px; font-family: var(--font); width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-group input:focus, .form-input:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-group input::placeholder, .form-input::placeholder { color: var(--text-muted); }

textarea.form-input { resize: vertical; min-height: 80px; }

.login-error {
  background: var(--red-dim); border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: #fca5a5; font-size: 13px;
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius-sm); padding: 11px 20px;
  font-size: 14px; font-weight: 600; font-family: var(--font); cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}
.btn-primary:hover { background: #2563eb; box-shadow: 0 6px 24px rgba(59,130,246,0.4); }
.btn-primary:active { transform: scale(0.98); }
.btn-full { width: 100%; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-h);
  color: var(--text); border-radius: var(--radius-sm); padding: 9px 16px;
  font-size: 13px; font-weight: 500; font-family: var(--font); cursor: pointer;
  transition: background 0.2s, border-color 0.2s; text-decoration: none;
}
.btn-secondary:hover { background: rgba(255,255,255,0.09); border-color: var(--border-h); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--red-dim); border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5; border-radius: var(--radius-sm); padding: 9px 14px;
  font-size: 13px; font-weight: 500; font-family: var(--font); cursor: pointer;
  transition: background 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-footer { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 24px; }

/* ════════════ APP SHELL ════════════ */
#admin-app { display: flex; height: 100vh; overflow: hidden; }

/* ════════════ SIDEBAR ════════════ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh; overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px; border-bottom: 1px solid var(--border);
}
.brand-name { font-size: 15px; font-weight: 700; color: #fff; }
.brand-tag { font-size: 10.5px; color: var(--text-sub); font-weight: 500; }

.sidebar-nav { flex: 1; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-sub); font-size: 13.5px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: var(--blue-dim); color: var(--blue-h); }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg,#3b82f6,#2563eb);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.admin-name { font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.admin-role { font-size: 11px; color: var(--text-sub); }
.logout-btn {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-sub); border-radius: var(--radius-sm); padding: 8px 14px;
  font-size: 13px; font-family: var(--font); cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.logout-btn:hover { background: rgba(239,68,68,0.1); color: #fca5a5; border-color: rgba(239,68,68,0.3); }

/* ════════════ MAIN CONTENT ════════════ */
.main-content { flex: 1; overflow-y: auto; height: 100vh; background: var(--bg); }
.page { padding: 32px; max-width: 1200px; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.page-sub { color: var(--text-sub); font-size: 13.5px; }

/* ════════════ STAT CARDS ════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-h); transform: translateY(-1px); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: var(--blue-dim); color: var(--blue-h); }
.stat-icon.purple { background: var(--purple-dim); color: #a78bfa; }
.stat-icon.orange { background: var(--orange-dim); color: #fbbf24; }
.stat-icon.green { background: var(--green-dim); color: #34d399; }
.stat-value { font-size: 26px; font-weight: 800; color: #fff; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-sub); font-weight: 500; }
.shimmer-val { display: inline-block; width: 60px; height: 26px; background: linear-gradient(90deg,var(--surface2) 25%,rgba(255,255,255,0.06) 50%,var(--surface2) 75%); background-size: 200% 100%; border-radius: 6px; animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ════════════ INFO BANNER ════════════ */
.info-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px;
  color: #fde68a; font-size: 13px; line-height: 1.6;
}
.info-banner svg { flex-shrink: 0; margin-top: 2px; }
.info-banner code { background: rgba(255,255,255,0.1); border-radius: 4px; padding: 1px 6px; font-size: 12px; }

/* ════════════ TABLE ════════════ */
.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap;
}
.table-title { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.table-sub { font-size: 12px; color: var(--text-sub); }
.table-actions { display: flex; align-items: center; gap: 8px; }
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-sub); pointer-events: none; }
.search-input {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px 8px 34px;
  color: var(--text); font-size: 13px; width: 220px; outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--blue); }
.search-input::placeholder { color: var(--text-muted); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 14px; text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-sub);
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
}
.data-table td {
  padding: 12px 14px; font-size: 13px; color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle;
}
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table tbody tr:last-child td { border-bottom: none; }
.uid-cell { font-family: monospace; font-size: 11px; color: var(--text-sub); cursor: pointer; }
.uid-cell:hover { color: var(--blue-h); }
.badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.badge-blue { background: var(--blue-dim); color: var(--blue-h); }
.badge-purple { background: var(--purple-dim); color: #a78bfa; }
.badge-green { background: var(--green-dim); color: #34d399; }
.badge-na { background: rgba(255,255,255,0.05); color: var(--text-sub); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 6px; }

.tbl-loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 40px; color: var(--text-sub);
}
.loading-dots { display: flex; gap: 5px; }
.loading-dots div { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: dotBounce 1.2s ease-in-out infinite; }
.loading-dots div:nth-child(2) { animation-delay: 0.2s; }
.loading-dots div:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce { 0%,80%,100%{transform:scale(0.6);opacity:0.4} 40%{transform:scale(1);opacity:1} }

/* ════════════ SECTION TABS ════════════ */
.section-tabs {
  display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap;
}
.stab {
  padding: 9px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-sub); font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: all 0.2s;
}
.stab:hover { border-color: var(--border-h); color: var(--text); }
.stab.active { background: var(--blue-dim); border-color: rgba(59,130,246,0.4); color: var(--blue-h); }

/* ════════════ EDITOR PANEL ════════════ */
.editor-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.editor-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.editor-section {
  padding: 24px; border-right: 1px solid var(--border);
}
.editor-section:last-child { border-right: none; }
.section-heading { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 18px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-actions {
  padding: 16px 24px; background: var(--surface2); border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

/* ════════════ IMAGE UPLOADER ════════════ */
.image-uploader { display: flex; flex-direction: column; gap: 14px; }
.upload-preview {
  width: 100%; aspect-ratio: 16/10; background: var(--surface2);
  border: 2px dashed var(--border-h); border-radius: var(--radius);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s;
}
.upload-preview:hover { border-color: rgba(59,130,246,0.4); }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-sub); text-align: center; padding: 20px; }
.upload-placeholder svg { width: 36px; height: 36px; opacity: 0.4; }
.upload-placeholder p { font-size: 13px; font-weight: 500; }
.upload-placeholder span { font-size: 11px; color: var(--text-muted); }
.upload-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; flex: 1; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); width: 0%; transition: width 0.3s; border-radius: 2px; }
.upload-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-sub); }

/* ════════════ TOASTS ════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border-h);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-size: 13.5px; color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
  min-width: 240px; max-width: 360px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes toastIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .page { padding: 20px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-section { border-right: none; border-bottom: 1px solid var(--border); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
