/* ===========================
   Xpert Proxy Admin — CSS
   =========================== */

:root {
  --sidebar-w: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-border: rgba(255,255,255,.06);
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --topbar-h: 64px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  margin: 0;
  min-height: 100vh;
}

/* ---- App layout ---- */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform .25s ease;
  overflow: hidden;
}

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

.sidebar-brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.sidebar-divider { height: 1px; background: var(--sidebar-border); margin: 8px 16px; }

.sidebar-menu {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  margin-bottom: 2px;
}

.sidebar-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; }

.sidebar-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.25), rgba(139,92,246,.15));
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,.3);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; truncate: clip; }
.sidebar-user-role { font-size: 11px; color: #64748b; }

.sidebar-logout {
  color: #64748b;
  text-decoration: none;
  padding: 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239,68,68,.1); }

.sidebar-item-logout { color: #94a3b8; }
.sidebar-item-logout:hover { color: #ef4444; background: rgba(239,68,68,.08); }

/* ---- Main ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
}

.sidebar-toggle {
  background: none; border: none;
  color: #64748b; font-size: 18px;
  cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  display: none;
}
.sidebar-toggle:hover { background: #f1f5f9; color: #1e293b; }

.topbar-title { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---- Content area ---- */
.content-area { padding: 24px; flex: 1; }

/* ---- Stat Cards ---- */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #e2e8f0;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-primary .stat-icon { background: #ede9fe; color: var(--accent); }
.stat-success .stat-icon { background: #dcfce7; color: #16a34a; }
.stat-warning .stat-icon { background: #fef9c3; color: #ca8a04; }
.stat-info    .stat-icon { background: #e0f2fe; color: #0284c7; }
.stat-danger  .stat-icon { background: #fee2e2; color: #dc2626; }

.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 12px; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 28px; font-weight: 800; color: #1e293b; line-height: 1.2; }

/* ---- Cards ---- */
.card {
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}
.card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.card-body { padding: 20px; }

/* ---- Tables ---- */
.table { font-size: 14px; }
.table thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #64748b; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.table td { vertical-align: middle; border-color: #f1f5f9; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ---- Badges ---- */
.badge { font-weight: 600; letter-spacing: .3px; font-size: 11px; }

/* ---- Buttons ---- */
.btn { border-radius: 8px; font-weight: 500; font-size: 14px; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ---- Forms ---- */
.form-control, .form-select {
  border-radius: 8px;
  border-color: #e2e8f0;
  font-size: 14px;
  color: #1e293b;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-label { font-size: 13px; font-weight: 600; color: #374151; }

/* ---- Plan modal ---- */
.plan-modal .modal-dialog { max-width: 860px; }

.plan-modal .modal-content {
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 0%, rgba(99,102,241,.20), transparent 32%),
    linear-gradient(145deg, #111827 0%, #0f172a 100%);
  color: #e5e7eb;
  box-shadow: 0 28px 70px rgba(15,23,42,.52);
}

.plan-modal .modal-header,
.plan-modal .modal-footer {
  border-color: rgba(148,163,184,.20);
  background: rgba(2,6,23,.24);
  padding: 18px 22px;
}

.plan-modal .modal-body {
  padding: 20px 22px 22px;
  max-height: min(72vh, 720px);
}

.plan-modal .modal-title {
  margin: 2px 0 0;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.plan-modal .modal-eyebrow {
  color: #22d3ee;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .9px;
  text-transform: uppercase;
}

.plan-modal-section {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 14px;
  background: rgba(15,23,42,.62);
}

.plan-modal-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #c7d2fe;
  font-size: 13px;
  font-weight: 800;
}

.plan-modal-section-title i { color: #22d3ee; }

.plan-modal .form-label {
  margin-bottom: 7px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .35px;
  text-transform: uppercase;
}

.plan-modal .text-muted { color: #94a3b8 !important; text-transform: none; letter-spacing: 0; }

.plan-modal .form-control,
.plan-modal .form-select {
  min-height: 42px;
  border-color: rgba(148,163,184,.22);
  background-color: rgba(2,6,23,.62);
  color: #f8fafc;
}

.plan-modal textarea.form-control { min-height: 92px; resize: vertical; }

.plan-modal .form-control::placeholder { color: #64748b; }

.plan-modal .form-control:focus,
.plan-modal .form-select:focus {
  border-color: rgba(34,211,238,.72);
  background-color: rgba(2,6,23,.82);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(34,211,238,.12);
}

.plan-modal .form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.plan-modal .form-control-color {
  height: 42px;
  padding: 6px;
}

.plan-switch {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px 10px 48px;
  border: 1px solid rgba(148,163,184,.16);
  border-radius: 12px;
  background: rgba(2,6,23,.36);
}

.plan-switch .form-check-input {
  width: 38px;
  height: 20px;
  margin-left: -36px;
  margin-top: 0;
  cursor: pointer;
}

.plan-switch .form-check-label {
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.plan-modal .btn {
  min-height: 38px;
  padding-inline: 16px;
  font-weight: 700;
}

.plan-modal .btn-secondary {
  background: rgba(148,163,184,.16);
  border-color: rgba(148,163,184,.22);
  color: #e5e7eb;
}

.plan-modal .btn-secondary:hover {
  background: rgba(148,163,184,.24);
  color: #fff;
}

/* ---- Login ---- */
.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-wrapper { width: 100%; max-width: 420px; padding: 20px; }

.login-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 25px 60px rgba(0,0,0,.5);
}

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

.login-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}

.login-title { font-size: 24px; font-weight: 800; color: #fff; margin: 0; }
.login-subtitle { font-size: 14px; color: rgba(255,255,255,.4); margin: 4px 0 0; }

.login-card .form-label { color: rgba(255,255,255,.7); }
.login-card .form-control,
.login-card .input-group-text {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.15);
  color: #fff;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,.3); }
.login-card .form-control:focus {
  background: rgba(255,255,255,.1);
  border-color: rgba(99,102,241,.7);
  box-shadow: 0 0 0 3px rgba(99,102,241,.2);
  color: #fff;
}
.login-card .input-group-text { color: rgba(255,255,255,.4); cursor: pointer; }

.btn-login {
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  transition: transform .15s, box-shadow .15s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(99,102,241,.4); }

.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: rgba(255,255,255,.2); }

/* ---- Pagination ---- */
.pagination .page-link { border-radius: 6px; margin: 0 2px; font-size: 13px; color: var(--accent); }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); }

/* ---- Code ---- */
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: #6366f1; }

/* ---- Account ---- */
.account-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}
.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
}
.account-summary h4 { margin: 0; font-size: 18px; font-weight: 800; }
.account-summary p { margin: 3px 0 0; color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
}
