/* ============================================================
   Ludo Battle — Admin Panel Styles
   Dark gradient theme matching the Android app.
   ============================================================ */

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

:root {
  --bg-1: #0e1230;
  --bg-2: #1a1f4a;
  --bg-3: #2a1f5a;
  --card: rgba(255, 255, 255, 0.06);
  --card-hover: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.65);
  --text-dim: rgba(255, 255, 255, 0.40);
  --pink: #ff6b9d;
  --purple: #6a4dff;
  --teal: #26c6da;
  --blue: #1e88e5;
  --gold: #ffd54f;
  --red: #e53935;
  --green: #43a047;
  --gradient-primary: linear-gradient(135deg, #ff6b9d 0%, #6a4dff 100%);
  --gradient-blue: linear-gradient(135deg, #26c6da 0%, #1e88e5 100%);
  --gradient-gold: linear-gradient(135deg, #ffd54f 0%, #ffa726 100%);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login screen ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.login-logo {
  font-size: 48px;
  margin-bottom: 12px;
  text-align: center;
}
.login-title {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--purple);
  background: rgba(255, 255, 255, 0.12);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  letter-spacing: 0.3px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(106, 77, 255, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.btn-google {
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: white;
  color: #202124;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  transition: transform 0.1s;
}
.btn-google:hover { transform: translateY(-1px); }
.btn-google .g-badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4 0%, #ea4335 100%);
  color: white;
  display: grid; place-items: center;
  font-weight: bold; font-size: 13px;
}

.btn-danger {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--red);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.9; }

.divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span { padding: 0 12px; }

.error-banner {
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.4);
  color: #ff8a80;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: rgba(0, 0, 0, 0.25);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-icon { font-size: 28px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-name em { display: block; font-style: normal; color: var(--text-dim); font-size: 12px; font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--card); color: var(--text); }
.nav-link.active {
  background: var(--gradient-primary);
  color: white;
}
.nav-icon { font-size: 18px; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.user-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 0 4px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-primary);
  display: grid; place-items: center;
  font-weight: bold;
  color: white;
}
.user-info { line-height: 1.2; min-width: 0; flex: 1; }
.user-name { font-weight: 600; font-size: 14px; }
.user-email { color: var(--text-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Main content ---------- */
.main {
  padding: 32px 40px;
  overflow-x: hidden;
}
.page-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}
.page-subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.kpi {
  padding: 20px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}
.kpi.gradient-1 { background: var(--gradient-primary); border: none; }
.kpi.gradient-2 { background: var(--gradient-blue); border: none; }
.kpi.gradient-3 { background: var(--gradient-gold); border: none; }
.kpi.gradient-4 { background: linear-gradient(135deg, #43a047 0%, #1e88e5 100%); border: none; }
.kpi-label { color: rgba(255, 255, 255, 0.8); font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-size: 32px; font-weight: 800; line-height: 1.1; }
.kpi-delta { font-size: 12px; margin-top: 6px; color: rgba(255, 255, 255, 0.8); }

/* ---------- Cards & sections ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-actions { display: flex; gap: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
thead { background: rgba(0, 0, 0, 0.2); }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tbody tr:hover { background: var(--card-hover); }
tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-red    { background: rgba(229, 57, 53, 0.2); color: #ff8a80; }
.badge-green  { background: rgba(67, 160, 71, 0.2); color: #69f0ae; }
.badge-blue   { background: rgba(30, 136, 229, 0.2); color: #82b1ff; }
.badge-yellow { background: rgba(253, 216, 53, 0.2); color: #ffe57f; }
.badge-gray   { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }

.color-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Form elements (for ads page) ---------- */
.form-grid {
  display: grid;
  gap: 16px;
}
.form-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: center;
}
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.form-row label {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.form-row input[type="text"], .form-row input[type="url"], .form-row textarea {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--purple);
}

/* ---------- Switch toggle ---------- */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  transition: 0.2s;
}
.slider:before {
  position: absolute; content: "";
  height: 22px; width: 22px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
input:checked + .slider { background: var(--purple); }
input:checked + .slider:before { transform: translateX(22px); }

/* ---------- Ad banner preview ---------- */
.ad-preview {
  background: var(--gradient-primary);
  padding: 14px 18px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  margin-top: 8px;
}
.ad-preview .ad-tag {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border);
  color: white;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  backdrop-filter: blur(10px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-text { font-size: 16px; }

/* ---------- Loading ---------- */
.loading {
  display: grid;
  place-items: center;
  padding: 40px;
  color: var(--text-muted);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Charts ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 80px; font-size: 13px; color: var(--text-muted); }
.bar-track { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-val { width: 50px; font-size: 13px; font-weight: 600; text-align: right; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 25, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.22s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) } to { opacity: 1; transform: translateY(0) } }
