:root {
  --primary-color: #7a72b6;
  --primary-hover: #675ca8;
  --secondary-color: #eb6b6f;
  --bg-color: #f8f9fc;
  --card-bg: #ffffff;
  --text-main: #2d3748;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Authentication Layout */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);
}

.auth-card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.5rem;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background-color: var(--primary-color);
  width: 100%;
}

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

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.alert-danger {
  color: #991b1b;
  background-color: #fef2f2;
  border-color: #f87171;
}

/* App Layout */
.app-header {
  background: var(--card-bg);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-color);
}

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

.logout-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.logout-link:hover {
  color: var(--danger);
}

.main-content {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Cards & Tables for Dashboard */
.dashboard-card {
  background: var(--card-bg);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 0.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s;
}

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

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

/* Filters Bar & Panel */
.filters-bar, .filters-panel {
  display: none;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  align-items: flex-end;
}

.filters-bar.open, .filters-bar.show, .filters-panel.open {
  display: flex;
}

.filters-bar .form-control, .filters-panel .form-control {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Tab Switcher Responsive Layout */
.tab-select-mobile {
  display: none;
}

.tab-bar-desktop {
  display: flex;
}

.table-responsive {
  overflow-x: auto;
  max-width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th, .data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f9fafb;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}
.status-new { background: #e0f2fe; color: #0369a1; }
.status-contacted { background: #fef3c7; color: #b45309; }
.status-interested { background: #dcfce7; color: #15803d; }
.status-converted { background: #dbeafe; color: #1d4ed8; }
.status-dead { background: #f3f4f6; color: #374151; }
.status-follow_up { background: #f5d0fe; color: #701a75; }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 50;
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }

.modal-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-top: 4px solid var(--primary-color);
}

/* Mobile & Utility Classes */
.mobile-only { display: none !important; }
.mobile-flex { display: none !important; }
.mobile-inline { display: none !important; }
.desktop-only { display: flex; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-outline:hover {
  background: #f3f4f6;
  border-color: var(--primary-color);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-size: 1.25rem; /* increase click area on mobile */
}

.btn-icon:hover {
  background: #f3f4f6;
}

@media (max-width: 768px) {
  .mobile-only { display: block !important; }
  .mobile-inline { display: inline-block !important; }
  .mobile-flex { display: flex !important; }
  .desktop-only { display: none !important; }

  .app-header {
    flex-wrap: wrap;
    padding: 1rem;
  }
  
  .app-brand {
    flex: none;
  }

  .app-user-actions {
    display: flex;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .main-content {
    padding: 1rem;
  }

  .tabs-container {
    margin-bottom: 1.5rem;
  }

  .tab-select-mobile {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--card-bg);
    color: var(--text-main);
    font-weight: 500;
  }

  .tab-bar-desktop {
    display: none;
  }

  .filters-bar, .filters-panel {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .filters-bar.open, .filters-bar.show, .filters-panel.open {
    display: flex;
  }

  .section-header {
    display: flex;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
    gap: 0.5rem;
  }

  .mobile-only-header-controls {
    display: flex !important;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
    align-items: stretch !important;
  }
  .modal-actions .btn {
    width: 100% !important;
    margin: 0 !important;
  }
  .modal-actions #vlDeleteBtn {
    margin-right: 0;
  }

  .card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    width: 100%;
  }
  .card-actions .btn {
    flex: 1 1 50%;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .card-delete-container {
    width: 100%;
  }

  .card-delete-container .btn {
    width: 100% !important;
    text-align: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    display: block;
  }
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.modal-actions .btn {
  width: auto;
}
.modal-actions #vlDeleteBtn {
  margin-right: auto;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.card-actions .btn {
  width: auto;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

.card-delete-container {
  margin-top: 0.5rem;
}

.card-delete-container .btn {
  width: auto;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.mobile-only-header-controls {
  display: none !important;
}

