/* ============================================================
   NEXUS ADS — admin.css
   High-Tech Dark Theme CRM & Lead Management Portal
   ============================================================ */

:root {
  --bg-dark: #050711;
  --bg-card: rgba(13, 18, 36, 0.75);
  --bg-card-hover: rgba(20, 28, 54, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.5);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #475569;

  --blue: #3b82f6;
  --purple: #a855f7;
  --teal: #14b8a6;
  --orange: #f97316;
  --gold: #fbbf24;
  --red: #ef4444;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-alt: 'Space Grotesk', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ============================================================
   LOGIN OVERLAY
   ============================================================ */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #0c132c 0%, #03050b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 50px rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(25px);
  text-align: center;
}

.login-badge {
  display: inline-block;
  font-family: var(--font-alt);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--blue);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.login-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.pin-input-group {
  margin-bottom: 18px;
}

.pin-input-group input {
  width: 100%;
  font-size: 1.8rem;
  text-align: center;
  letter-spacing: 0.5em;
  padding: 12px;
  border-radius: 14px;
  background: rgba(4, 7, 20, 0.8);
  border: 1px solid var(--border);
  color: #fff;
  outline: none;
  font-family: var(--font-alt);
  transition: all 0.3s;
}

.pin-input-group input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.login-err {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.login-hint {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.login-hint code {
  color: var(--teal);
  background: rgba(20, 184, 166, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 36px;
  background: rgba(8, 12, 28, 0.85);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-to-site {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.back-to-site:hover {
  color: var(--text-main);
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.1);
}

.admin-brand {
  font-family: var(--font-alt);
  font-size: 1.3rem;
  font-weight: 700;
}

.logo-n { color: var(--blue); }
.logo-dot { color: var(--purple); margin: 0 2px; }

.badge-portal {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--teal);
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-family: var(--font-alt);
  font-weight: 600;
  color: var(--teal);
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
  animation: pulse-live 1.8s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Buttons */
.btn-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-export {
  color: var(--teal);
  border-color: rgba(20, 184, 166, 0.3);
  background: rgba(20, 184, 166, 0.05);
}
.btn-export:hover {
  background: rgba(20, 184, 166, 0.15);
}

.btn-danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  border: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-primary:hover {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}
.full-btn { width: 100%; }

/* ============================================================
   CONTAINER & METRICS
   ============================================================ */
.admin-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(12px);
  transition: all 0.25s;
}

.metric-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 900;
  font-family: var(--font-alt);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.metric-trend {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.text-blue { color: var(--blue); }
.text-orange { color: var(--orange); }
.text-purple { color: var(--purple); }
.text-teal { color: var(--teal); }
.text-gold { color: var(--gold); }

/* ============================================================
   CONTROLS & SEARCH
   ============================================================ */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--text-dim);
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 12px 40px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.filter-group {
  display: flex;
  gap: 8px;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip:hover, .filter-chip.active {
  color: #fff;
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.15);
}

/* ============================================================
   TABLE STYLING
   ============================================================ */
.leads-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leads-table th {
  padding: 16px 20px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.leads-table td {
  padding: 18px 20px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leads-table tr:last-child td {
  border-bottom: none;
}

.leads-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.time-stamp {
  font-family: var(--font-alt);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.client-name {
  font-weight: 700;
  color: #fff;
  display: block;
}

.client-business {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.contact-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 260px;
}

.contact-email {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}

.contact-email:hover {
  text-decoration: underline;
}

.lead-phone-row {
  margin-top: 1px;
}

.contact-phone {
  color: var(--teal);
  text-decoration: none;
  font-size: 0.8rem;
  font-family: var(--font-alt);
}

.contact-phone:hover {
  text-decoration: underline;
}

.lead-handle-row {
  margin-top: 1px;
}

.lead-handle-tag {
  font-size: 0.72rem;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(168, 85, 247, 0.25);
  display: inline-block;
}

.channels-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.channel-mini-pill {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.btn-wa:hover {
  background: rgba(34, 197, 94, 0.2) !important;
  border-color: #22c55e !important;
  color: #22c55e !important;
}

.btn-tg:hover {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: var(--blue) !important;
  color: var(--blue) !important;
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 240px;
}

.srv-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.srv-tag.highlight {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: #d8b4fe;
}

.budget-val {
  font-family: var(--font-alt);
  font-weight: 700;
  color: var(--teal);
}

/* Status select pill */
.status-select {
  appearance: none;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 26px 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: transparent;
  cursor: pointer;
  outline: none;
  position: relative;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}

.status-select option {
  background: #0d1224;
  color: #fff;
}

.status-new {
  color: var(--orange);
  background-color: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.35);
}

.status-contacted {
  color: var(--purple);
  background-color: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
}

.status-won {
  color: var(--teal);
  background-color: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.35);
}

.status-archived {
  color: var(--text-dim);
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: #fff;
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.15);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto 24px;
  font-size: 0.9rem;
}

/* ============================================================
   DETAIL MODAL
   ============================================================ */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.detail-card {
  width: 100%;
  max-width: 580px;
  background: #0d1224;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.detail-val {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.detail-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
