/* ═══════════════════════════════════════════════════════════════════════════
   LeadGen Pro — Premium Dark UI
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(18, 18, 30, 0.7);
  --bg-card-hover: rgba(25, 25, 42, 0.8);
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(99, 102, 241, 0.3);

  --text-primary: #f1f1f4;
  --text-secondary: #8b8b9e;
  --text-muted: #5a5a6e;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Background Effects ──────────────────────────────────────────────────── */

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
  top: -200px;
  right: -100px;
  animation: floatGlow 15s ease-in-out infinite alternate;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1), transparent 70%);
  bottom: -150px;
  left: -100px;
  animation: floatGlow 18s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(40px, -30px) scale(1.15);
  }
}

/* ─── App Container ───────────────────────────────────────────────────────── */

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-nav {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 40px;
  backdrop-filter: blur(12px);
}

.nav-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 16px;
  border-radius: 30px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.nav-btn:hover {
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.logo-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: -2px;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 40px;
  backdrop-filter: blur(12px);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ─── Search Card ─────────────────────────────────────────────────────────── */

.search-section {
  margin-bottom: 32px;
}

.search-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: border-color var(--transition);
}

.search-card:hover {
  border-color: var(--border-accent);
}

.search-card-glow {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 0 0 4px 4px;
  filter: blur(1px);
}

.search-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.search-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-light);
}

.search-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 20px;
  margin-bottom: 28px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.input-wrapper input:focus {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrapper input:focus+.input-icon,
.input-wrapper:has(input:focus) .input-icon {
  color: var(--accent-light);
}

/* ─── Search Button ───────────────────────────────────────────────────────── */

.search-btn {
  width: 100%;
  padding: 16px 32px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.search-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.search-btn:hover::before {
  opacity: 1;
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.35);
}

.search-btn:active {
  transform: translateY(0);
}

.search-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-content,
.btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-content svg {
  width: 20px;
  height: 20px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── Loading Section ─────────────────────────────────────────────────────── */

.loading-section {
  margin: 48px 0;
}

.loading-card {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
}

.loading-animation {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 28px;
}

.loading-ring {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.ring-2 {
  inset: 8px;
  border-top-color: var(--accent-light);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.ring-3 {
  inset: 16px;
  border-top-color: rgba(99, 102, 241, 0.4);
  animation-duration: 2.4s;
}

.loading-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  color: var(--accent-light);
  animation: bounce 1.5s ease-in-out infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }

  50% {
    transform: translate(-50%, -55%) scale(1.1);
  }
}

.loading-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.loading-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ─── Error Section ───────────────────────────────────────────────────────── */

.error-section {
  margin: 48px 0;
}

.error-card {
  text-align: center;
  padding: 48px 40px;
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
}

.error-icon {
  width: 48px;
  height: 48px;
  color: var(--danger);
  margin-bottom: 16px;
}

.error-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-msg {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.retry-btn {
  padding: 12px 28px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.retry-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ─── Results Section ─────────────────────────────────────────────────────── */

.results-section {
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.results-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
}

.results-title svg {
  width: 24px;
  height: 24px;
  color: var(--accent-light);
}

.results-query {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

.results-actions {
  display: flex;
  gap: 10px;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.3);
}

.export-btn svg {
  width: 18px;
  height: 18px;
}

.export-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.export-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  border-color: var(--border-accent);
}

/* ─── Table ───────────────────────────────────────────────────────────────── */

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.leads-table thead {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.leads-table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
}

.leads-table th[data-sort] {
  cursor: pointer;
  transition: color var(--transition);
}

.leads-table th[data-sort]:hover {
  color: var(--accent-light);
}

.sort-arrow {
  font-size: 0.7rem;
  opacity: 0.4;
}

.th-num {
  width: 50px;
}

.th-actions {
  width: 80px;
}

.leads-table td {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}

.leads-table tbody tr {
  transition: background var(--transition);
}

.leads-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.lead-name {
  font-weight: 600;
  color: var(--text-primary);
}

.lead-phone {
  color: var(--success);
  font-weight: 500;
  white-space: nowrap;
}

.lead-phone.no-data,
.lead-website.no-data {
  color: var(--text-muted);
  font-weight: 400;
}

.lead-website a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
  word-break: break-all;
}

.lead-website a:hover {
  color: white;
  text-decoration: underline;
}

.lead-address {
  color: var(--text-secondary);
  font-size: 0.83rem;
  max-width: 250px;
}

.lead-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.rating-star {
  color: var(--warning);
  font-size: 0.85rem;
}

.lead-reviews {
  color: var(--text-secondary);
  font-size: 0.83rem;
}

.maps-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-light);
  text-decoration: none;
  transition: all var(--transition);
}

.maps-link:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent);
  transform: scale(1.05);
}

.maps-link svg {
  width: 16px;
  height: 16px;
}

/* ─── Saved Searches ──────────────────────────────────────────────────────── */

.saved-section {
  margin-bottom: 32px;
  animation: fadeInUp 0.4s ease-out;
}

.saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.saved-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
}

.saved-title svg {
  width: 22px;
  height: 22px;
  color: var(--accent-light);
}

.saved-stats {
  color: var(--text-secondary);
  font-size: 0.83rem;
  margin-top: 2px;
}

.saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.saved-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  backdrop-filter: blur(12px);
  transition: all var(--transition);
  cursor: default;
}

.saved-item:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.saved-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.saved-item-query {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.saved-item-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-glow);
  color: var(--accent-light);
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.saved-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-item-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.saved-item-actions {
  display: flex;
  gap: 6px;
}

.saved-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid;
}

.saved-action-btn.view-btn {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--accent-light);
}

.saved-action-btn.view-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent);
}

.saved-action-btn.delete-btn {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.saved-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
}

.saved-action-btn svg {
  width: 13px;
  height: 13px;
}

.saved-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  grid-column: 1 / -1;
}

/* ─── Usage Warning Banner ────────────────────────────────────────────────── */

.usage-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  animation: slideDown 0.3s ease-out;
}

.usage-warning svg {
  width: 20px;
  height: 20px;
  color: #ef4444;
  flex-shrink: 0;
}

/* ─── Modal ─────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: slideUpFade 0.3s ease-out;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.modal-title svg {
  width: 24px;
  height: 24px;
  color: #f59e0b;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
}

.modal-btn-primary {
  background: var(--accent);
  color: var(--text-primary);
}

.modal-btn-primary:hover {
  background: var(--accent-hover);
}

.modal-btn-secondary {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-btn-secondary:hover {
  background: rgba(239, 68, 68, 0.2);
}

.modal-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.modal-btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

#addLeadForm .form-group label,
#editLeadForm .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#addLeadForm input,
#addLeadForm select,
#editLeadForm input,
#editLeadForm select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s;
  width: 100%;
}

#addLeadForm input:focus,
#addLeadForm select:focus,
#editLeadForm input:focus,
#editLeadForm select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  padding: 40px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .results-header {
    flex-direction: column;
  }

  .table-container {
    overflow-x: auto;
  }

  .search-card {
    padding: 28px 20px;
  }

  .app-container {
    padding: 16px 16px 40px;
  }
}

@media (max-width: 600px) {
  .logo-title {
    font-size: 1.2rem;
  }

  .results-actions {
    width: 100%;
  }

  .export-btn {
    flex: 1;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Monitor Section
   ═══════════════════════════════════════════════════════════════════════════ */

.monitor-section {
  margin-top: 2rem;
}

.monitor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.monitor-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.monitor-title svg {
  width: 22px;
  height: 22px;
  color: var(--accent-light);
}

.monitor-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.monitor-badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* Add Monitor Form */
.add-monitor-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
}

.monitor-form-row {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.monitor-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.3s;
  appearance: none;
  cursor: pointer;
}

.monitor-select:focus {
  border-color: var(--accent);
}

.monitor-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.monitor-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  align-items: center;
}

/* Monitor Cards */
.monitor-list {
  display: grid;
  gap: 0.75rem;
}

.monitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color 0.3s, background 0.3s;
}

.monitor-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.monitor-card.disabled {
  opacity: 0.5;
}

.monitor-card-info {
  flex: 1;
  min-width: 0;
}

.monitor-card-keyword {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.monitor-card-location {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.monitor-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.monitor-card-badge {
  background: var(--success);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s;
}

.monitor-card-badge:hover {
  transform: scale(1.1);
}

.monitor-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.monitor-action-btn {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.monitor-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}

.monitor-action-btn svg {
  width: 14px;
  height: 14px;
}

.monitor-action-btn.check-btn:hover {
  border-color: var(--success);
  color: var(--success);
}

.monitor-action-btn.delete-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.3s;
  border: none;
  flex-shrink: 0;
}

.toggle-switch.active {
  background: var(--success);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch.active::after {
  transform: translateX(16px);
}

/* Alert Panel */
.alert-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
}

.alert-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.alert-panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-panel-actions {
  display: flex;
  gap: 0.5rem;
}

.alert-list {
  display: grid;
  gap: 0.5rem;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.alert-item.unread {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.alert-new-tag {
  background: var(--success);
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.alert-item-info {
  flex: 1;
  min-width: 0;
}

.alert-item-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.alert-item-detail {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.alert-item-date {
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .monitor-form-row {
    flex-direction: column;
  }

  .monitor-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitor-card-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Pipeline & Kanban Board
   ═══════════════════════════════════════════════════════════════════════════ */

.pipeline-section {
  margin-top: 2rem;
  display: none;
  animation: fadeInUp 0.5s ease-out;
}

.kanban-board {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: 400px;
}

.kanban-column {
  background: rgba(18, 18, 30, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 280px;
  width: 280px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kanban-column-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.kanban-column-count {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.kanban-cards {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  min-height: 100px;
  transition: background 0.2s;
}

.kanban-cards.drag-over {
  background: rgba(99, 102, 241, 0.05);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: grab;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.kanban-card:active,
.kanban-card.dragging {
  cursor: grabbing;
  transform: scale(1.02) rotate(2deg);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  opacity: 0.9;
  z-index: 10;
}

.kanban-card:hover {
  border-color: var(--border-accent);
}

.card-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s;
}

.kanban-card:hover .card-remove-btn {
  opacity: 1;
}

.card-remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.card-remove-btn svg {
  width: 14px;
  height: 14px;
}

.card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-right: 20px;
}

.card-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-detail svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
}

.card-rating {
  color: var(--warning);
  font-weight: 600;
}

.card-maps-link {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
}

.card-maps-link:hover {
  text-decoration: underline;
}

/* Pipeline UI inside Table */
.pipeline-select {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.pipeline-select:hover,
.pipeline-select:focus {
  border-color: var(--accent);
}

.pipeline-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.add-pipeline-btn {
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  color: var(--accent-light);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.add-pipeline-btn:hover {
  background: rgba(99, 102, 241, 0.1);
}

.add-pipeline-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Sales Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

.dashboard-section {
  margin-top: 2rem;
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.dashboard-title svg {
  width: 26px;
  height: 26px;
  color: var(--accent-light);
}

.dashboard-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ─── KPI Cards ──────────────────────────────────────────────────────────── */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  backdrop-filter: blur(20px);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.07;
  border-radius: inherit;
  transition: opacity var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card:hover::before {
  opacity: 0.12;
}

.kpi-pipeline::before {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.kpi-today::before {
  background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

.kpi-week::before {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.kpi-winrate::before {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-pipeline .kpi-icon {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.kpi-today .kpi-icon {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}

.kpi-week .kpi-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.kpi-winrate .kpi-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.kpi-icon svg {
  width: 22px;
  height: 22px;
}

.kpi-data {
  display: flex;
  flex-direction: column;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* ─── Dashboard Grid (funnel + comparison) ─────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  margin-bottom: 1.5rem;
}

.dashboard-grid .dash-card {
  margin-bottom: 0;
}

.dash-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Funnel Chart ───────────────────────────────────────────────────────── */

.funnel-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.funnel-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.funnel-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 100px;
  flex-shrink: 0;
}

.funnel-stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.funnel-stage-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.funnel-bar-track {
  flex: 1;
  height: 24px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  min-width: 2px;
  animation: barGrow 0.8s ease-out both;
}

@keyframes barGrow {
  from {
    width: 0 !important;
  }
}

.funnel-count {
  text-align: right;
  min-width: 55px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.funnel-count-num {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.funnel-count-pct {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── Comparison Grid ────────────────────────────────────────────────────── */

.comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comp-header-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.comp-header-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.comp-header-col {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
}

.comp-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

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

.comp-metric-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.comp-icon {
  font-size: 0.9rem;
}

.comp-metric-value {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.comp-today {
  color: #22d3ee;
}

.comp-week {
  color: #fbbf24;
}

/* ─── Activity Feed ──────────────────────────────────────────────────────── */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--transition);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.activity-lead-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.activity-stage {
  font-weight: 600;
}

.activity-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ─── Dashboard Responsive ───────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-value {
    font-size: 1.4rem;
  }
}