/* ============================================================
   Nexus Prospector Pro — Componentes reutilizables
   ============================================================ */

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--gold);
  color: #0C0C0F;
}
.btn-primary:hover {
  background: var(--gold2);
  box-shadow: 0 0 16px rgba(212, 168, 67, 0.35);
  color: #0C0C0F;
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--border);
  border-color: var(--muted);
}

.btn-danger {
  background: rgba(224, 92, 92, 0.12);
  color: var(--red);
  border: 1px solid rgba(224, 92, 92, 0.3);
}
.btn-danger:hover {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.btn-success {
  background: rgba(61, 186, 122, 0.12);
  color: var(--green);
  border: 1px solid rgba(61, 186, 122, 0.3);
}
.btn-success:hover {
  background: var(--green);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: rgba(212, 168, 67, 0.2);
}

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

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ── Stat cards del dashboard ── */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: rgba(212, 168, 67, 0.25);
  box-shadow: var(--shadow-gold);
}

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

.stat-icon.gold   { background: rgba(212, 168, 67, 0.12); color: var(--gold); }
.stat-icon.green  { background: rgba(61, 186, 122, 0.12); color: var(--green); }
.stat-icon.blue   { background: rgba(91, 141, 239, 0.12); color: var(--blue); }
.stat-icon.purple { background: rgba(155, 110, 255, 0.12); color: var(--purple); }

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

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Badges de etapa ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-nuevo       { background: rgba(91, 141, 239, 0.12); color: var(--blue); border: 1px solid rgba(91, 141, 239, 0.25); }
.badge-contactado  { background: rgba(212, 168, 67, 0.12); color: var(--gold); border: 1px solid rgba(212, 168, 67, 0.25); }
.badge-interesado  { background: rgba(155, 110, 255, 0.12); color: var(--purple); border: 1px solid rgba(155, 110, 255, 0.25); }
.badge-negociando  { background: rgba(240, 122, 58, 0.12); color: var(--orange); border: 1px solid rgba(240, 122, 58, 0.25); }
.badge-cerrado     { background: rgba(61, 186, 122, 0.12); color: var(--green); border: 1px solid rgba(61, 186, 122, 0.25); }
.badge-perdido     { background: rgba(224, 92, 92, 0.12); color: var(--red); border: 1px solid rgba(224, 92, 92, 0.25); }

.badge-web-si   { background: rgba(61, 186, 122, 0.1); color: var(--green); border: 1px solid rgba(61, 186, 122, 0.2); }
.badge-web-no   { background: rgba(224, 92, 92, 0.1); color: var(--red); border: 1px solid rgba(224, 92, 92, 0.2); }

.badge-whatsapp  { background: rgba(37, 211, 102, 0.1); color: #25D366; border: 1px solid rgba(37, 211, 102, 0.2); }
.badge-instagram { background: rgba(225, 48, 108, 0.1); color: #E1306C; border: 1px solid rgba(225, 48, 108, 0.2); }
.badge-email     { background: rgba(91, 141, 239, 0.1); color: var(--blue); border: 1px solid rgba(91, 141, 239, 0.2); }
.badge-llamada   { background: rgba(240, 122, 58, 0.1); color: var(--orange); border: 1px solid rgba(240, 122, 58, 0.2); }

/* ── Tabla ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

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

.table th {
  background: var(--bg3);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.table th:hover { color: var(--text); }
.table th.sort-asc::after  { content: ' ↑'; color: var(--gold); }
.table th.sort-desc::after { content: ' ↓'; color: var(--gold); }

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

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

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

.table tbody tr:hover td { background: var(--bg3); }

.table-checkbox {
  width: 36px;
  text-align: center;
}

/* ── Rating stars ── */
.rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--gold);
}

.rating::before {
  content: '★';
}

/* ── Formularios ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input,
.select,
.textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.1);
}

.input::placeholder,
.textarea::placeholder { color: var(--muted); }

.select {
  cursor: pointer;
  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 fill='%236A6A88' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.select option {
  background: var(--bg2);
  color: var(--text);
}

.textarea {
  resize: vertical;
  min-height: 90px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

.checkbox-group label {
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
}

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

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}

.modal-lg { max-width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
}

.modal-close:hover {
  background: var(--bg3);
  color: var(--text);
}

.modal-body    { padding: 24px; }
.modal-footer  {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease forwards;
  font-size: 0.875rem;
}

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-msg  { color: var(--text); line-height: 1.4; }

.toast-success { border-left: 3px solid var(--green); }
.toast-success .toast-icon { color: var(--green); }

.toast-error   { border-left: 3px solid var(--red); }
.toast-error .toast-icon   { color: var(--red); }

.toast-info    { border-left: 3px solid var(--blue); }
.toast-info .toast-icon    { color: var(--blue); }

.toast-warning { border-left: 3px solid var(--gold); }
.toast-warning .toast-icon { color: var(--gold); }

/* ── Paginación ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 16px 0;
}

.pagination-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: 'DM Mono', monospace;
  transition: all var(--transition);
}

.pagination-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.pagination-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #0C0C0F;
  font-weight: 700;
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

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

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── Search bar ── */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-wrap .input {
  padding-left: 38px;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

/* ── Progress bar ── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ── Loading overlay ── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 15, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 5;
}

/* ── Highlight text ── */
.highlight {
  background: rgba(212, 168, 67, 0.15);
  color: var(--gold);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── Dropdown context menu ── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow);
  z-index: 100;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.dropdown-menu.hidden { display: none; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

.dropdown-item:hover { background: var(--bg3); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: rgba(224, 92, 92, 0.1); }

/* ── Tooltip ── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 50;
}

[data-tooltip]:hover::after { opacity: 1; }
