/* ─── KavroPay Admin · Design System v3 ─────────────────────────
   Visual limpo e moderno, inspirado no site principal kavropay.online.
   Todas as classes existentes foram mantidas para não quebrar o painel.
   ─────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Superfícies */
  --bg1: #0a0c12;
  --bg2: #10131c;
  --bg3: #161b27;
  --bg4: #1e2535;
  --border: #1f2737;
  --border2: #2c3649;

  /* Textos */
  --txt1: #f5f7fb;
  --txt2: #a4adbd;
  --txt3: #6f7a8f;

  /* Marca (verde, como o site principal) */
  --brand: #22c55e;
  --brand-hover: #16a34a;
  --brand-soft: rgba(34,197,94,0.12);

  /* Cores funcionais */
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-bg: rgba(59,130,246,0.12);

  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.12);

  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.12);

  --yellow: #f59e0b;
  --yellow-bg: rgba(245,158,11,0.12);

  /* Raios e sombras */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,0.75);
  --ring: 0 0 0 3px rgba(34,197,94,0.25);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --tr: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scrollbar-color: var(--border2) transparent; }

body {
  background: var(--bg1);
  color: var(--txt1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: rgba(34,197,94,0.35); color: #fff; }

:focus-visible { outline: none; box-shadow: var(--ring); }

/* ─── Tela de Login ───────────────────────────────────────────── */
.login-bg {
  position: fixed; inset: 0; z-index: 9999; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(34,197,94,0.13), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(59,130,246,0.12), transparent 60%),
    var(--bg1);
}
.login-card {
  width: 100%; max-width: 440px; padding: 36px;
  background: rgba(16,19,28,0.85); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s ease;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.login-logo h2 { font-size: 18px; font-weight: 800; color: #fff; }
.login-logo h2 span {
  color: var(--red); font-size: 11px; vertical-align: middle;
  background: rgba(239,68,68,0.15); padding: 2px 6px; border-radius: 4px;
  border: 1px solid rgba(239,68,68,0.3); margin-left: 6px;
}
.login-sub { font-size: 13px; color: var(--txt3); margin-bottom: 26px; }

/* ─── Layout do App ───────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: 260px; flex-shrink: 0; z-index: 100;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, var(--bg2) 0%, #0c0f16 100%);
  border-right: 1px solid var(--border);
}
.sidebar-top { display: flex; flex-direction: column; min-height: 0; }
.sidebar-logo {
  padding: 20px 18px 16px; display: flex; flex-direction: column; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.logo-wrap { display: flex; align-items: center; gap: 10px; }
.logo-name { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; color: #fff; }
.logo-name span { color: var(--brand); font-weight: 600; }

.sidebar-nav {
  padding: 14px 10px; display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto;
}
.nav-section {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--txt3);
  letter-spacing: 0.8px; padding: 14px 12px 6px;
}
.nav-link {
  position: relative; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: none; border-radius: var(--r-md); background: none; cursor: pointer;
  color: var(--txt2); font-family: inherit; font-size: 13.5px; font-weight: 500; text-align: left;
  transition: var(--tr);
}
.nav-link i {
  width: 18px; text-align: center; font-size: 14px; color: var(--txt3); transition: var(--tr);
}
.nav-link:hover { background: rgba(255,255,255,0.04); color: var(--txt1); }
.nav-link:hover i { color: var(--txt2); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(34,197,94,0.14), rgba(34,197,94,0.02));
  color: var(--txt1); font-weight: 700;
}
.nav-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand); box-shadow: 0 0 10px var(--brand);
}
.nav-link.active i { color: var(--brand); }

.sidebar-footer {
  padding: 14px; border-top: 1px solid var(--border); background: rgba(0,0,0,0.18);
}
.user-row { display: flex; align-items: center; gap: 10px; }
.user-av {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}
.user-info { flex: 1; min-width: 0; }
.user-name-txt { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email-txt { font-size: 11px; color: var(--txt3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout {
  background: none; border: none; color: var(--txt3); cursor: pointer;
  padding: 7px; border-radius: var(--r-sm); transition: var(--tr);
}
.btn-logout:hover { color: var(--red); background: var(--red-bg); }

/* ─── Área principal / Topbar ─────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.topbar {
  flex-shrink: 0; gap: 12px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px;
  background: rgba(16,19,28,0.8); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.session-timer {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--r-full);
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 12px; color: var(--txt2);
}
.session-timer strong { color: var(--txt1); font-variant-numeric: tabular-nums; }

.content { flex: 1; overflow-y: auto; padding: 28px; }

.view { display: none; animation: fadeUp 0.25s ease; }
.view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  margin-bottom: 24px;
}
.view-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; color: #fff; }
.view-sub { font-size: 13px; color: var(--txt3); margin-top: 4px; max-width: 680px; }

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: #fff; }

/* ─── Métricas ────────────────────────────────────────────────── */
.metrics-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--bg3) 0%, var(--bg2) 100%);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; transition: var(--tr);
}
.metric-card:hover { transform: translateY(-2px); border-color: var(--border2); box-shadow: 0 12px 28px -14px rgba(0,0,0,0.6); }
.metric-lbl {
  font-size: 10.5px; font-weight: 700; color: var(--txt3);
  text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 10px;
}
.metric-val { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.metric-small { font-size: 12px; color: var(--txt3); margin-top: 6px; }

/* ─── Tabelas ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; border-radius: var(--r-md);
  border: 1px solid var(--border); -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--bg3); color: var(--txt3); font-weight: 700;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.6px; white-space: nowrap;
}
.data-table td {
  padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--txt1);
  vertical-align: middle;
}
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── Botões ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-md); border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.2;
  cursor: pointer; transition: var(--tr); text-decoration: none; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, #2fd46a 0%, var(--brand-hover) 100%);
  color: #04130a; box-shadow: 0 6px 16px -8px rgba(34,197,94,0.7);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 22px -10px rgba(34,197,94,0.8); }
.btn-secondary { background: var(--bg3); color: var(--txt1); border-color: var(--border2); }
.btn-secondary:hover { background: var(--bg4); border-color: #3a4862; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: var(--r-sm); }
.btn i { font-size: 0.95em; }

/* ─── Formulários ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--txt2); margin-bottom: 7px; }
.form-input, .form-select {
  width: 100%; padding: 10px 13px;
  background: var(--bg1); border: 1px solid var(--border2); color: var(--txt1);
  border-radius: var(--r-md); font-family: inherit; font-size: 13.5px;
  transition: var(--tr);
}
.form-input::placeholder { color: var(--txt3); }
.form-input:hover, .form-select:hover { border-color: #3a4862; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.form-select { appearance: none; cursor: pointer; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--txt3) 50%), linear-gradient(135deg, var(--txt3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type="checkbox"] { accent-color: var(--brand); }

/* ─── Pills / Badges ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; white-space: nowrap;
}
.pill-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(34,197,94,0.25); }
.pill-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(239,68,68,0.25); }
.pill-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245,158,11,0.25); }
.pill-blue   { background: var(--blue-bg);   color: var(--blue);   border: 1px solid rgba(59,130,246,0.25); }

/* ─── Modais ──────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(3,5,10,0.7); backdrop-filter: blur(6px);
}
.modal-bg.open { display: flex; animation: fadeIn 0.18s ease; }
.modal {
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  padding: 26px; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 700; color: #fff; }
.btn-close {
  background: var(--bg3); border: 1px solid var(--border); color: var(--txt2);
  width: 32px; height: 32px; border-radius: var(--r-sm); font-size: 18px; line-height: 1;
  cursor: pointer; transition: var(--tr); flex-shrink: 0;
}
.btn-close:hover { color: var(--txt1); background: var(--bg4); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── Utilidades ──────────────────────────────────────────────── */
.dot-green {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,0.18), 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(34,197,94,0.05), 0 0 12px var(--green); } }

.error-msg {
  display: none; margin-bottom: 14px; padding: 11px 13px;
  background: var(--red-bg); border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5; border-radius: var(--r-md); font-size: 12.5px;
}

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 11000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; min-width: 240px;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--r-md);
  color: var(--txt1); font-size: 13px; box-shadow: var(--shadow-lg);
  animation: popIn 0.22s ease;
}

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; border: 2px solid var(--bg1); }
::-webkit-scrollbar-thumb:hover { background: #3a4862; }

/* ─── Mobile ──────────────────────────────────────────────────── */
.mobile-menu-btn { display: none; }
.admin-sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 1999;
  background: rgba(3,5,10,0.7); backdrop-filter: blur(3px);
}
.admin-sidebar-backdrop.open { display: block; }

@media (max-width: 1280px) {
  .metrics-row { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: inline-flex !important; }
  .topbar-txt-title { display: none; }
  .sidebar {
    position: fixed !important; top: 0; bottom: 0; left: 0;
    width: 280px !important; height: 100vh !important;
    transform: translateX(-100%); transition: transform 0.3s ease !important;
    z-index: 2000 !important; border-right: 1px solid var(--border) !important;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0) !important; }
  .sidebar-nav { flex-direction: column !important; overflow-y: auto !important; }
  .nav-section { display: block !important; }
  .sidebar-footer { display: block !important; }
  .metrics-row { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .view-title { font-size: 19px; }
  .card { padding: 16px; }
  .modal { padding: 20px; }
}

@media (max-width: 480px) {
  .metrics-row { grid-template-columns: 1fr !important; }
  .view-title { font-size: 17px; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
