:root {
  --bg-main: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --accent: #06b6d4;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --radius: 12px;
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(79, 70, 229, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

.app-layout {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.logo-icon {
  font-size: 2rem;
  background: rgba(79, 70, 229, 0.2);
  border: 1px solid rgba(79, 70, 229, 0.4);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.brand h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand h1 span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.tab-badge {
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  color: #e0e7ff;
}

/* Cards & Components */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.config-card {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.config-tip {
  font-size: 0.75rem;
  color: #818cf8;
}

/* Inputs & Form */
.input-row {
  display: flex;
  gap: 0.75rem;
}

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

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e5e7eb;
}

.input-field {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.input-field-sm {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.input-field-sm:focus {
  border-color: var(--primary);
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  margin-top: 0.25rem;
}

.toggle-switch input {
  display: none;
}

.slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: #374151;
  border-radius: 24px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .slider {
  background: var(--primary);
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Categories Selector */
.categories-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
  margin-bottom: 1.5rem;
}

.categories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.categories-header label {
  font-size: 0.85rem;
  font-weight: 600;
}

.cat-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.text-link {
  background: none;
  border: none;
  color: #818cf8;
  cursor: pointer;
  font-size: 0.8rem;
}

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

.divider {
  color: var(--text-muted);
}

.categories-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.cat-chip:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cat-chip.active {
  background: rgba(79, 70, 229, 0.25);
  border-color: var(--primary);
  color: #c7d2fe;
  font-weight: 600;
}

.custom-cat-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-width: 400px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  opacity: 0.95;
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
  width: 100%;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.icon-btn:hover {
  color: #fff;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-card.danger {
  border-left: 4px solid var(--danger);
}
.stat-card.danger .stat-num {
  color: #f87171;
}

.stat-card.warning {
  border-left: 4px solid var(--warning);
}
.stat-card.warning .stat-num {
  color: #fbbf24;
}

/* Results & CRM Tables */
.results-card, .crm-control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.results-header, .crm-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.results-tools, .crm-action-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* CRM Filters Bar */
.crm-filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.status-chips-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s;
}

.filter-chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.filter-chip.active {
  background: #374151;
  color: #fff;
  border-color: #9ca3af;
  font-weight: 700;
}

.filter-chip.chip-todo.active { background: rgba(59, 130, 246, 0.2); border-color: #3b82f6; color: #93c5fd; }
.filter-chip.chip-called.active { background: rgba(107, 114, 128, 0.2); border-color: #9ca3af; color: #e5e7eb; }
.filter-chip.chip-interested.active { background: rgba(16, 185, 129, 0.2); border-color: #10b981; color: #6ee7b7; }
.filter-chip.chip-recall.active { background: rgba(245, 158, 11, 0.2); border-color: #f59e0b; color: #fde68a; }
.filter-chip.chip-refused.active { background: rgba(239, 68, 68, 0.2); border-color: #ef4444; color: #fca5a5; }

.crm-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: #e5e7eb;
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.prospect-name {
  font-weight: 600;
  color: #fff;
}

.prospect-cat {
  color: #9ca3af;
  font-size: 0.78rem;
}

.phone-link {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}

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

/* CRM Call Status Select */
.status-select {
  background: #111827;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  width: 100%;
}

.status-select.A_APPELER { border-color: #3b82f6; color: #93c5fd; }
.status-select.APPELE { border-color: #9ca3af; color: #e5e7eb; }
.status-select.INTERESSE { border-color: #10b981; color: #6ee7b7; font-weight: bold; }
.status-select.RAPPEL { border-color: #f59e0b; color: #fde68a; }
.status-select.REFUSE { border-color: #ef4444; color: #fca5a5; }

/* CRM Notes Input */
.notes-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #fff;
  font-size: 0.8rem;
  width: 100%;
  outline: none;
}

.notes-input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.6);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-danger {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
  background: var(--warning-bg);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-success {
  background: var(--success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-info {
  background: rgba(79, 70, 229, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(79, 70, 229, 0.3);
}

.link-tag {
  color: #60a5fa;
  text-decoration: none;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.link-tag:hover {
  text-decoration: underline;
}

/* Phone Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  width: 90%;
  max-width: 550px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

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

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

.phone-textarea {
  width: 100%;
  height: 200px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #38bdf8;
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.copy-feedback {
  color: #34d399;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Map View Styles */
.map-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.map-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.map-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.legend-pin.pin-red {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.legend-pin.pin-amber {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.legend-pin.pin-green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.map-filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.map-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.map-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.map-container {
  width: 100%;
  height: 650px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #0d131f;
  z-index: 1;
}

/* Custom Neon Leaflet Marker Pins */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pin-inner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 800;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.pin-inner:hover {
  transform: scale(1.25);
  z-index: 999;
}

.pin-red-pulse .pin-inner {
  background: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.9);
}

.pin-amber-pulse .pin-inner {
  background: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.9);
}

.pin-green-pulse .pin-inner {
  background: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.9);
}

/* Leaflet Dark Popup Styles */
.leaflet-popup-content-wrapper {
  background: rgba(17, 24, 39, 0.95) !important;
  color: #f3f4f6 !important;
  border: 1px solid var(--border-active) !important;
  border-radius: 10px !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5) !important;
  padding: 0.25rem !important;
}

.leaflet-popup-tip {
  background: rgba(17, 24, 39, 0.95) !important;
}

.map-popup-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 220px;
}

.map-popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.map-popup-cat {
  font-size: 0.75rem;
  color: #9ca3af;
}

.map-popup-address {
  font-size: 0.75rem;
  color: #cbd5e1;
}

.map-popup-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

/* Utility */
.hidden {
  display: none !important;
}

.footer {
  text-align: center;
  font-size: 0.78rem;
  color: #6b7280;
  padding: 1.25rem 0;
}
