:root {
  --background: #020817;
  --surface: #0F172A;
  --surface-2: #131f38;
  --surface-border: #1E293B;
  --foreground: #F8FAFC;
  --muted: #94A3B8;
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --accent-cyan: #22d3ee;
  --success: #22C55E;
  --warning: #FBBF24;
  --danger: #EF4444;
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;   /* poora page kabhi side-scroll nahi karega */
  max-width: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 50% 0%, rgba(37,99,235,0.08), transparent 60%), var(--background);
  color: var(--foreground);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
img, svg { max-width: 100%; height: auto; }

.text-muted { color: var(--muted); }
.text-primary-light { color: var(--primary-light); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

/* ================= Buttons ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.2s, transform 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, #2563EB, #3B82F6);
  color: #fff;
}
.btn-primary:hover {
  box-shadow: 0 0 16px rgba(37,99,235,0.5);
  transform: translateY(-1px);
}
.btn-outline { background: transparent; border: 1px solid var(--surface-border); color: var(--foreground); }
.btn-outline:hover { border-color: var(--primary-light); }

/* ================= Forms ================= */
.input {
  width: 100%;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--foreground);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.input:focus { border-color: var(--primary-light); }

label.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

/* ================= Layout: sidebar + topbar ================= */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  width: 228px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--surface-border);
  padding: 24px 16px;
  background: var(--background);
  overflow-y: auto;
}
.sidebar-logo { font-size: 20px; font-weight: 700; padding: 0 8px; margin-bottom: 32px; }
.sidebar-logo img { height: 24px; width: auto; }

.nav-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface); color: var(--foreground); }
.nav-item.active { background: rgba(37,99,235,0.15); color: var(--primary-light); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.75; fill: none; }

.upgrade-card { padding: 16px; }
.upgrade-card p { margin: 0 0 4px; }
.upgrade-card .btn { width: 100%; margin-top: 12px; font-size: 12px; padding: 8px; }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;      /* KEY flexbox overflow fix */
  width: 100%;
}

/* ---- Topbar: title group left, actions group right, never wraps on desktop ---- */
.topbar {
  border-bottom: 1px solid var(--surface-border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  overflow: visible;   /* dropdown never gets clipped */
}
.topbar h1 { font-size: clamp(20px, 4vw, 32px); margin: 0; font-weight: 700; line-height: 1.2; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 12px; }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.icon-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--surface); color: var(--foreground); }
.icon-btn svg { stroke-width: 1.75; fill: none; }
.badge-dot {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.profile-btn { display: flex; align-items: center; gap: 8px; background: transparent; border: none; cursor: pointer; color: var(--foreground); }
.avatar-circle {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Dropdown: forced width so it never collapses/scatters ---- */
.dropdown-wrap { position: relative !important; }
.dropdown {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  left: auto !important;
  width: max-content !important;
  min-width: 200px !important;
  max-width: calc(100vw - 24px) !important;
  white-space: normal !important;
  z-index: 999 !important;
  overflow: hidden;
  padding: 4px 0;
  display: none;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; font-size: 13px; color: var(--muted);
  background: none; border: none; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); color: var(--foreground); }

.page-body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* ================= Cards ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  min-width: 0;
  max-width: 100%;
}
.card:has(table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* ================= Stat cards / grids ================= */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 640px) { .stat-grid { gap: 24px; } }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card { padding: 16px; }
.stat-card .label { font-size: 12px; color: var(--muted); margin: 0; }
.stat-card .value { font-size: clamp(22px, 4vw, 32px); font-weight: 700; margin: 6px 0; }
.stat-card .delta { font-size: 12px; color: var(--success); margin: 0; }
.stat-card svg { stroke-width: 1.75; fill: none; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.team-overview-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .team-overview-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .team-overview-grid { grid-template-columns: 1fr 1fr 1fr; } }

.section-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

/* ================= Tables ================= */
table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
thead { border-bottom: 1px solid var(--surface-border); }
th { text-align: left; padding: 12px 16px; font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid rgba(28,39,64,0.6); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

.map-avatar {
  width: 40px; height: 40px; border-radius: 8px;
  border: 1px solid var(--surface-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--foreground);
  flex-shrink: 0;
}

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-btn { padding: 8px 16px; border-radius: 8px; font-size: 14px; border: 1px solid var(--surface-border); background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Chart: explicit height (fixes chart disappearing) + bg glow ---- */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  background: radial-gradient(circle at 50% 30%, rgba(37,99,235,0.15), transparent 70%);
  border-radius: 12px;
}
.chart-wrap canvas { filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.35)); }

/* ================= Mobile: sidebar becomes a slide-in drawer ================= */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(260px, 80vw);
    z-index: 50;
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
  }
  .mobile-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40; }
  .mobile-backdrop.open { display: block; }
  .topbar-desktop { display: none; }
  .topbar-mobile { display: flex; }

  .page-body { padding: 16px; gap: 16px; }
}
@media (min-width: 900px) {
  .topbar-mobile { display: none; }
}
.topbar-mobile {
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
}
.topbar-mobile img { height: 20px; }

/* ================= Small phones ================= */
@media (max-width: 480px) {
  .page-body { padding: 12px; gap: 12px; }
  .topbar-actions { gap: 10px; }
  .card { border-radius: 10px; }
  .stat-card { padding: 12px; }
  .tabs { gap: 6px; }
  .tab-btn { padding: 6px 12px; font-size: 13px; }
  th, td { padding: 10px 12px; }
  .chart-wrap { height: 240px; }
}

/* ================= Modal (Add Player, etc.) ================= */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 24px;
}
.modal-box h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.modal-box .modal-desc { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--foreground); }
@property --border-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  padding: 0;
}

.auth-wrap {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 100vh;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0;
  overflow: hidden;
}

/* Animated glow that travels continuously around the container border */
.auth-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--border-angle), transparent 0%, transparent 70%, var(--accent-cyan) 82%, var(--primary-light) 92%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: auth-border-spin 5s linear infinite;
  pointer-events: none;
  z-index: 5;
}

@keyframes auth-border-spin {
  to { --border-angle: 360deg; }
}

.auth-side {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    radial-gradient(circle at 25% 15%, rgba(37,99,235,0.22), transparent 55%),
    radial-gradient(circle at 80% 85%, rgba(59,130,246,0.12), transparent 50%),
    var(--background);
  border-right: 1px solid var(--surface-border);
}
.auth-side-inner {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.auth-side-inner .sidebar-logo { margin-bottom: 28px; }

.auth-tagline { font-size: 24px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.02em; }
.auth-subtext { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 28px; max-width: 300px; }

.auth-illustration {
  position: relative;
  flex: 1;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}
.auth-illustration svg { max-width: 260px; width: 100%; height: auto; }

.auth-features { display: flex; flex-direction: column; gap: 16px; margin-top: auto; }
.auth-feature { display: flex; align-items: center; gap: 12px; }
.auth-feature .icon-wrap {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(37,99,235,0.15);
  border: 1px solid rgba(59,130,246,0.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary-light);
}
.auth-feature .icon-wrap svg { width: 17px; height: 17px; stroke-width: 1.75; fill: none; }
.auth-feature strong { display: block; font-size: 13px; font-weight: 600; }
.auth-feature span { display: block; font-size: 11.5px; color: var(--muted); }

.auth-form-side {
  flex: 1;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.auth-form-inner {
  width: 100%;
  max-width: 400px;
}
.auth-form-side h2 { font-size: 26px; font-weight: 700; margin: 0 0 4px; text-align: center; }
.auth-desc { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 28px; }

.auth-field { margin-bottom: 16px; }
.auth-field-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.auth-field label { font-size: 13px; color: var(--muted); }
.auth-field-row a { font-size: 12px; color: var(--primary-light); font-weight: 500; }

.input-wrap { position: relative; }
.input-wrap .leading-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); stroke-width: 1.75; fill: none;
  pointer-events: none;
}
.input-wrap .input { padding-left: 38px; }
.input-wrap .toggle-visibility {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px;
  display: flex;
}
.input-wrap .toggle-visibility svg { width: 16px; height: 16px; stroke-width: 1.75; fill: none; }

.auth-checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--muted); margin: 4px 0 20px; }
.auth-checkbox-row input { margin-top: 2px; accent-color: var(--primary); cursor: pointer; }
.auth-checkbox-row a { color: var(--primary-light); font-weight: 500; }
.auth-checkbox-row.spread { justify-content: space-between; align-items: center; }

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

.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: transparent; border: 1px solid var(--surface-border); color: var(--foreground);
  padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.btn-google:hover { border-color: var(--primary-light); background: var(--surface-2); }
.btn-google svg { width: 18px; height: 18px; }

.auth-footer-text { text-align: center; font-size: 13px; color: var(--muted); margin-top: 22px; }
.auth-footer-text a { color: var(--primary-light); font-weight: 600; }

.auth-copyright { text-align: center; font-size: 11px; color: var(--muted); margin-top: 20px; opacity: 0.7; }

.form-error {
  display: none;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  font-size: 12.5px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.form-error.show { display: block; }

@media (max-width: 860px) {
  .auth-wrap { flex-direction: column; }
  .auth-side { border-right: none; border-bottom: 1px solid var(--surface-border); padding: 28px; }
  .auth-illustration { min-height: 150px; margin-bottom: 16px; }
  .auth-illustration svg { max-width: 190px; }
  .auth-features { flex-direction: row; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
  .auth-feature { flex: 1 1 45%; }
  .auth-form-side { padding: 32px 28px; }
}
@media (max-width: 480px) {
  .auth-side { display: none; }
  .auth-form-side { padding: 40px 22px; justify-content: flex-start; }
  .auth-form-side .sidebar-logo { display: block; text-align: center; margin-bottom: 28px; }
}

/* ================= Page transition (loading bar + fade-in) ================= */
#pageLoadBar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #2563EB, #3B82F6, #22d3ee);
  box-shadow: 0 0 8px rgba(37,99,235,0.6);
  z-index: 9999;
  transition: width 0.3s ease-out, opacity 0.2s ease-out;
  opacity: 0;
  pointer-events: none;
}
#pageLoadBar.active { width: 70%; opacity: 1; }

.app-shell { animation: pageFadeIn 0.35s ease-out; }
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= Skeleton loading (shimmer placeholders) ================= */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  pointer-events: none;
  display: inline-block;
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}








 
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}



.section-title {
  margin: 0 0 14px;
}

.field-group-label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}