/* Dashboard layout — owns all dash-specific styles, extends theme.css tokens */

.dashboard-body {
  background: var(--bg);
  min-height: 100vh;
}

/* ── Nav ── */
.dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 32px;
  height: 64px;
}

.dash-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-brand {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.dash-nav-title {
  font-size: 14px;
  color: var(--fg-muted);
  flex: 1;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Main ── */
.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ── Stats ── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.dash-stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 24px 28px;
}

.dash-stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 10px;
}

.dash-stat-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

/* ── Leads Section ── */
.leads-section {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  overflow: hidden;
}

.leads-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.leads-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.leads-count {
  font-size: 13px;
  color: var(--fg-muted);
}

.loading-state {
  padding: 60px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 15px;
}

.empty-state {
  padding: 80px 40px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.empty-state p {
  color: var(--fg-muted);
  font-size: 16px;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Lead Row ── */
.lead-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s;
}

.lead-row:last-child { border-bottom: none; }

.lead-row:hover {
  background: rgba(255,255,255,0.03);
}

.lead-row-main {
  flex: 1;
  min-width: 0;
}

.lead-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--fg);
  margin-bottom: 4px;
}

.lead-contact {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--fg-muted);
}

.lead-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lead-price {
  font-size: 13px;
  color: var(--fg-muted);
  font-family: 'JetBrains Mono', monospace;
}

.lead-date {
  font-size: 12px;
  color: var(--fg-muted);
}

/* ── Badges ── */
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-hot { background: rgba(255, 80, 60, 0.15); color: #ff6b5b; }
.badge-warm { background: rgba(255, 180, 60, 0.12); color: #f5a623; }
.badge-cold { background: rgba(100, 180, 255, 0.12); color: #74b9ff; }
.badge-unknown { background: rgba(255,255,255,0.06); color: var(--fg-muted); }
.badge-scripts { background: rgba(92, 184, 122, 0.12); color: var(--green); }
.badge-pending { background: rgba(255,255,255,0.05); color: var(--fg-muted); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.modal-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--fg); }

/* ── Form ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.required { color: var(--accent); }

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8690' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group select option { background: #1a1a25; }

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  gap: 16px;
}

.form-hint {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ── Drawer ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 400;
  backdrop-filter: blur(2px);
}

.lead-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 100vw;
  background: var(--bg-elevated);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 450;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.drawer-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drawer-close:hover { background: rgba(255,255,255,0.1); color: var(--fg); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ── Detail Grid ── */
.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.detail-row {
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.detail-label {
  font-weight: 600;
  color: var(--fg-muted);
  min-width: 110px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.8px;
  padding-top: 2px;
}

/* ── Scripts ── */
.scripts-section { margin-top: 8px; }

.scripts-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-regen {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-regen:hover { background: rgba(255,255,255,0.1); color: var(--fg); }

.script-block {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
}

.script-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.script-text {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
}

.btn-copy {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-copy:hover { background: rgba(255,255,255,0.1); color: var(--fg); }

.scripts-pending {
  background: var(--bg);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
}

.scripts-pending p {
  color: var(--fg-muted);
  margin-bottom: 16px;
  font-size: 14px;
}

/* ── Toast Notifications ── */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 360px;
  pointer-events: none;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: rgba(92, 184, 122, 0.2); color: var(--green); border: 1px solid rgba(92,184,122,0.3); }
.toast-error { background: rgba(196, 79, 79, 0.2); color: #ff8080; border: 1px solid rgba(196,79,79,0.3); }
.toast-info { background: rgba(255,255,255,0.08); color: var(--fg); border: 1px solid rgba(255,255,255,0.1); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .dash-nav { padding: 0 16px; }
  .dash-main { padding: 24px 16px 60px; }

  .dash-stats { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
  .dash-stat-value { font-size: 28px; }

  .form-row { grid-template-columns: 1fr; }
  .form-footer { flex-direction: column; align-items: stretch; }

  .lead-drawer { width: 100vw; }

  .lead-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .lead-row-meta { flex-direction: row; flex-wrap: wrap; }

  .modal-card { padding: 24px 20px; }
}
