/* ============================================================
   BAT FITNESS — ADMIN PANEL CSS
   ============================================================ */

:root {
  --clr-brand:       #7A1F2E;
  --clr-brand-light: #9B2A3D;
  --clr-gold:        #C9933A;
  --clr-cream:       #F0E6D3;
  --clr-bg:          #0D0D0D;
  --clr-bg-2:        #111111;
  --clr-bg-3:        #1A1A1A;
  --clr-bg-card:     #161616;
  --clr-text:        #F0F0F0;
  --clr-text-dim:    #B0B0B0;
  --clr-text-muted:  #606060;
  --clr-border:      rgba(255,255,255,0.07);
  --clr-success:     #4CAF50;
  --clr-danger:      #F44336;
  --clr-warning:     #FF9800;
  --sidebar-w:       240px;
  --topbar-h:        60px;
  --font-head:       'Outfit', sans-serif;
  --font-body:       'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--clr-bg);
  color: var(--clr-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--clr-gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.875rem;
  width: 100%;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--clr-brand-light);
  box-shadow: 0 0 0 3px rgba(122,31,46,0.15);
}
input::placeholder { color: var(--clr-text-muted); }
select option { background: var(--clr-bg-3); }

/* ── LOGIN SCREEN ───────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}
.login-bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(122,31,46,0.15), transparent),
              var(--clr-bg);
}
.login-box {
  position: relative;
  z-index: 1;
  background: #161616;
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  text-align: center;
}
.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 16px;
}
.login-box h1 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--clr-cream);
  margin-bottom: 6px;
}
.login-box > p {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  margin-bottom: 28px;
}

.lg-field { text-align: left; margin-bottom: 16px; }
.lg-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.lg-error {
  color: #F44336;
  font-size: 0.82rem;
  text-align: center;
  margin-bottom: 12px;
  min-height: 18px;
}

.lg-btn {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--clr-brand), var(--clr-brand-light));
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  transition: 0.2s;
  box-shadow: 0 4px 20px rgba(122,31,46,0.4);
  margin-bottom: 12px;
}
.lg-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.lg-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.lg-back {
  display: block;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  text-decoration: none;
  margin-top: 8px;
}
.lg-back:hover { color: var(--clr-cream); }

/* ── ADMIN LAYOUT ───────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #101010;
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.3s;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--clr-border);
}
.sidebar-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}
.sidebar-logo span {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  color: var(--clr-cream);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: transparent;
  color: var(--clr-text-muted);
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
  text-align: left;
  width: 100%;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--clr-text);
}
.nav-item.active {
  background: rgba(122,31,46,0.2);
  color: var(--clr-cream);
  border: 1px solid rgba(122,31,46,0.3);
}
.nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--clr-brand);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--clr-border);
}
.sidebar-link {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}
.sidebar-link:hover { color: var(--clr-cream); }

/* ── ADMIN MAIN ─────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #101010;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-hamburger {
  display: none;
  background: transparent;
  color: var(--clr-text);
  font-size: 1.3rem;
  padding: 4px 8px;
}
.topbar-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--clr-cream);
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-btn {
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-dim);
  font-size: 0.82rem;
  transition: 0.15s;
  font-family: var(--font-body);
}
.topbar-btn:hover { border-color: var(--clr-brand); color: var(--clr-cream); }

.topbar-admin {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
}
.admin-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-brand), var(--clr-brand-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
}

/* ── TAB CONTENT ────────────────────────────────────────────── */
.tab-content {
  display: none;
  padding: 28px 28px;
  flex: 1;
}
.tab-content.active { display: block; }

.page-header {
  margin-bottom: 24px;
}
.page-header h2 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--clr-cream);
  margin-bottom: 4px;
}
.page-header p { font-size: 0.87rem; color: var(--clr-text-muted); }

/* ── STATS GRID ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #161616;
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--clr-brand); }
.stat-icon { font-size: 1.8rem; flex-shrink: 0; }
.stat-val {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--clr-cream);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-lbl { font-size: 0.78rem; color: var(--clr-text-muted); }

/* ── DASH GRID ──────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-card {
  background: #161616;
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  overflow: hidden;
}
.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--clr-border);
}
.dash-card-header h3 {
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--clr-cream);
}
.link-btn {
  background: transparent;
  color: var(--clr-gold);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0;
}

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input { max-width: 260px; }
.filter-select { max-width: 160px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.845rem;
}
.data-table th {
  background: #111;
  color: var(--clr-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--clr-border);
  text-align: left;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--clr-text-dim);
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.empty-row { text-align: center; color: var(--clr-text-muted); padding: 32px !important; }

/* STATUS BADGES */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-new     { background: rgba(201,147,58,0.15); color: var(--clr-gold); border:1px solid rgba(201,147,58,0.3); }
.badge-contacted { background: rgba(33,150,243,0.12); color: #64B5F6; border:1px solid rgba(33,150,243,0.25); }
.badge-converted { background: rgba(76,175,80,0.12); color: #81C784; border:1px solid rgba(76,175,80,0.25); }
.badge-closed  { background: rgba(96,96,96,0.2); color: #909090; border:1px solid rgba(96,96,96,0.3); }
.badge-active  { background: rgba(76,175,80,0.12); color: #81C784; border:1px solid rgba(76,175,80,0.25); }
.badge-expired { background: rgba(244,67,54,0.1); color: #EF9A9A; border:1px solid rgba(244,67,54,0.2); }
.badge-paused  { background: rgba(255,152,0,0.12); color: #FFB74D; border:1px solid rgba(255,152,0,0.25); }
.badge-success { background: rgba(76,175,80,0.12); color: #81C784; border:1px solid rgba(76,175,80,0.25); }
.badge-pending { background: rgba(255,152,0,0.12); color: #FFB74D; border:1px solid rgba(255,152,0,0.25); }
.badge-failed  { background: rgba(244,67,54,0.1); color: #EF9A9A; border:1px solid rgba(244,67,54,0.2); }

/* ACTION BUTTONS */
.action-btn {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-dim);
  transition: 0.15s;
  margin-right: 4px;
}
.action-btn:hover { background: var(--clr-brand); border-color: var(--clr-brand); color: #fff; }

/* ── SETTINGS ───────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.settings-card {
  background: #161616;
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  padding: 24px;
}
.settings-card h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-cream);
  margin-bottom: 8px;
}
.settings-card > p {
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  margin-bottom: 18px;
  line-height: 1.6;
}
.settings-card:last-child { grid-column: 1 / -1; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: 6px;
}
.save-btn {
  padding: 10px 20px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--clr-brand), var(--clr-brand-light));
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.88rem;
  transition: 0.2s;
}
.save-btn:hover { opacity: 0.9; }

.setup-steps { display: flex; flex-direction: column; gap: 14px; }
.setup-step {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--clr-bg-3);
  border-radius: 10px;
  border: 1px solid var(--clr-border);
}
.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--clr-brand);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setup-step strong { display: block; font-size: 0.88rem; color: var(--clr-cream); margin-bottom: 4px; }
.setup-step p { font-size: 0.8rem; color: var(--clr-text-muted); margin: 0; line-height: 1.5; }
.setup-step code { background: rgba(122,31,46,0.2); padding: 1px 5px; border-radius: 4px; font-size: 0.78rem; color: var(--clr-gold); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.is-open {
  display: flex;
}
.modal-box {
  background: #1A1A1A;
  border: 1px solid var(--clr-border);
  border-radius: 18px;
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7);
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--clr-bg-3);
  border: 1px solid var(--clr-border);
  color: var(--clr-text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s;
}
.modal-close:hover { background: var(--clr-brand); color: #fff; }

.modal-box h3 {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--clr-cream);
  margin-bottom: 20px;
}

.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.lead-detail-item { background: var(--clr-bg-3); border-radius: 8px; padding: 10px 12px; }
.lead-detail-item .di-label { font-size: 0.72rem; color: var(--clr-text-muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.05em; }
.lead-detail-item .di-val { font-size: 0.9rem; color: var(--clr-cream); font-weight: 600; }

.modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.wa-btn, .em-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: 0.2s;
  text-decoration: none;
}
.wa-btn { background: #25D366; color: #fff; }
.em-btn { background: var(--clr-bg-3); color: var(--clr-text-dim); border: 1px solid var(--clr-border); }
.wa-btn:hover { opacity: 0.9; text-decoration: none; }
.em-btn:hover { border-color: var(--clr-gold); color: var(--clr-cream); text-decoration: none; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: none; }
  .admin-main { margin-left: 0; }
  .topbar-hamburger { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .tab-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-controls { flex-direction: column; }
  .search-input, .filter-select { max-width: 100%; }
  .lead-detail-grid { grid-template-columns: 1fr; }
}
