/* ==========================================================================
   LBC Contacts Explorer - Core Design System & Vanilla CSS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Primary Palette - LeBonCoin Inspired Accent */
  --primary-color: #E1007A;
  --primary-hover: #C00068;
  --primary-light: rgba(225, 0, 122, 0.12);
  --primary-glow: rgba(225, 0, 122, 0.25);

  /* Functional Colors */
  --success-color: #10B981;
  --success-light: rgba(16, 185, 129, 0.12);
  --whatsapp-color: #25D366;
  --info-color: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.12);
  --warning-color: #F59E0B;
  --danger-color: #EF4444;

  /* Neutral Surface Palette - Light Mode Default */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-hover: #E2E8F0;
  --bg-card: #FFFFFF;
  
  /* Borders & Dividers */
  --border-color: #E2E8F0;
  --border-focus: #E1007A;

  /* Typography Colors */
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --text-on-primary: #FFFFFF;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(225, 0, 122, 0.25);

  /* Layout & Sizing */
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Palette */
[data-theme="dark"] {
  --bg-app: #090E17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1F2937;
  --bg-subtle: #1E293B;
  --bg-hover: #334155;
  --bg-card: #151F32;

  --border-color: #2D3748;
  --border-focus: #FF3399;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="dark"] .app-header {
  background-color: rgba(17, 24, 39, 0.85);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #FF4DA6 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition-fast);
}

.brand-logo:hover {
  transform: scale(1.05) rotate(3deg);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-title span {
  color: var(--primary-color);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: -2px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, #FF4DA6 100%);
  color: var(--text-on-primary);
  box-shadow: 0 4px 12px rgba(225, 0, 122, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #D85C06 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(225, 0, 122, 0.4);
}

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

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-subtle);
}

.btn-icon {
  padding: 0.65rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* ==========================================================================
   Main Container & KPI Metrics Section
   ========================================================================== */

.app-main {
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 2rem 3rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(225, 0, 122, 0.4);
}

.kpi-card:hover::after {
  opacity: 1;
}

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

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

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

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

.kpi-card:nth-child(2) .kpi-icon {
  background: var(--info-light);
  color: var(--info-color);
}
.kpi-card:nth-child(3) .kpi-icon {
  background: var(--success-light);
  color: var(--success-color);
}
.kpi-card:nth-child(4) .kpi-icon {
  background: rgba(168, 85, 247, 0.12);
  color: #A855F7;
}

/* ==========================================================================
   Filter & Search Control Bar
   ========================================================================== */

.filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.filter-row-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-input::placeholder {
  color: var(--text-subtle);
}

.clear-search-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: none;
}

.clear-search-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-select {
  appearance: none;
  padding: 0.7rem 2.25rem 0.7rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.select-arrow {
  position: absolute;
  right: 0.75rem;
  pointer-events: none;
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* Quick Tags / Reference Chips */
.reference-chips-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--border-color);
}

.chips-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.25rem;
  text-transform: uppercase;
}

.chip {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip:hover {
  background: var(--bg-hover);
  border-color: var(--text-subtle);
}

.chip.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

.chip-count {
  background: var(--bg-surface);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chip.active .chip-count {
  background: var(--primary-color);
  color: white;
}

.chip-more-btn {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px dashed var(--primary-color);
  color: var(--primary-color);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip-more-btn:hover {
  background: var(--primary-light);
}

/* View Mode Switcher & Results info */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.results-count strong {
  color: var(--text-main);
  font-weight: 700;
}

.view-options {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.view-btn {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.view-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.view-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* ==========================================================================
   Table View (Ultra-clean & robust against multi-line Excel clutter)
   ========================================================================== */

.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  position: relative;
}

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

.contacts-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.contacts-table th:hover {
  color: var(--primary-color);
}

.contacts-table th .sort-icon {
  display: inline-block;
  margin-left: 0.35rem;
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}

.contacts-table th.sorted {
  color: var(--primary-color);
}

.contacts-table th.sorted .sort-icon {
  opacity: 1;
}

.contacts-table td {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-main);
  transition: background-color var(--transition-fast);
}

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

.contacts-table tbody tr {
  cursor: pointer;
  transition: background-color var(--transition-fast), transform 0.1s;
}

.contacts-table tbody tr:hover {
  background-color: var(--bg-hover);
}

/* Badges and cell details */
.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.annonce-cell {
  max-width: 210px;
}

.annonce-title {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-badge {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
}

.contact-cell {
  max-width: 220px;
}

.contact-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.contact-phone, .contact-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-cell {
  max-width: 380px;
}

.message-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
  background: var(--bg-app);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.contacts-table tbody tr:hover .message-preview {
  background: var(--bg-surface);
  border-color: rgba(225, 0, 122, 0.3);
}

.actions-cell {
  white-space: nowrap;
  text-align: right;
}

.actions-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action-sm {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-action-sm:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-action-sm.call:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-action-sm.whatsapp:hover {
  background: var(--whatsapp-color);
  color: white;
  border-color: var(--whatsapp-color);
}

.btn-action-sm.email:hover {
  background: var(--info-color);
  color: white;
  border-color: var(--info-color);
}

/* ==========================================================================
   Cards View (Grid Layout)
   ========================================================================== */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.lead-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.lead-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(225, 0, 122, 0.4);
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

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

.card-annonce-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-contact-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-color) 0%, #FF4DA6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.card-contact-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-contact-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-contact-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-message-box {
  background: var(--bg-app);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
}

.memo-tag {
  font-size: 0.75rem;
  color: var(--primary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   Drawer Modal (Detailed Contact View & Message Highlighter)
   ========================================================================== */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 580px;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xl);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.drawer-overlay.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.drawer-header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.drawer-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

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

.contact-main-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.contact-main-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-color) 0%, #FF4DA6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(225, 0, 122, 0.25);
}

.contact-main-names h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.contact-main-names span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.contact-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.btn-contact-action {
  flex: 1;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-call-drawer {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-call-drawer:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-whatsapp-drawer {
  background: rgba(37, 211, 102, 0.15);
  color: var(--whatsapp-color);
  border: 1px solid rgba(37, 211, 102, 0.3);
}
.btn-whatsapp-drawer:hover {
  background: var(--whatsapp-color);
  color: white;
}

/* Full Message Box with smart Highlights */
.message-full-container {
  background: var(--bg-app);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* Smart Highlight tags inside message */
.keyword-highlight {
  background: rgba(225, 0, 122, 0.15);
  color: var(--primary-color);
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(225, 0, 122, 0.3);
}

.salary-highlight {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-color);
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.memo-textarea {
  width: 100%;
  min-height: 90px;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.memo-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.drawer-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ==========================================================================
   File Import Drag & Drop Modal / Overlay
   ========================================================================== */

.import-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.import-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.import-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-normal);
}

.import-modal-overlay.active .import-modal {
  transform: translateY(0) scale(1);
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--bg-app);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.drop-zone-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.drop-zone h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.drop-zone p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform var(--transition-normal);
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  border-left-color: var(--success-color);
}

/* ==========================================================================
   Empty State & Loading States
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.empty-state-icon {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 440px;
}

/* ==========================================================================
   Pagination Control Bar
   ========================================================================== */

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
}

.pagination-info {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-subtle);
}

.page-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Responsive adjustments
   ========================================================================== */

@media (max-width: 768px) {
  .app-header {
    padding: 0 1rem;
  }
  .app-main {
    padding: 1rem;
  }
  .filter-row-primary {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .select-wrapper, .filter-select {
    width: 100%;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .drawer-panel {
    max-width: 100%;
  }
}
