/* Clients Page Specific Styles */

/* Client Cell */
.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

.client-avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.client-info {
  display: flex;
  flex-direction: column;
}

.client-meta {
  font-size: 13px;
  color: var(--text-muted, #9CA3AF);
}

/* Integration Badge */
.integration-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.integration-badge.enabled {
  background: #D1FAE5;
  color: #059669;
}

.integration-badge.disabled {
  background: #F3F4F6;
  color: #6B7280;
}

/* Source Badges */
.source-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.source-jane {
  background: #DBEAFE;
  color: #1D4ED8;
}

.source-healthie {
  background: #D1FAE5;
  color: #059669;
}

.source-bookem {
  background: #FEF3C7;
  color: #D97706;
}

.source-manual {
  background: #F3F4F6;
  color: #6B7280;
}

/* Icon Action Buttons */
.action-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-card, #F5F4F0);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-muted, #6B7280);
}

.action-btn:hover {
  background: #EEF5F1;
  border-color: #2E7A64;
  color: #1E4D3F;
}

.action-btn.delete-btn:hover {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #DC2626;
}

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

/* More Menu */
.more-menu-wrapper {
  position: relative;
}

.more-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted, #9CA3AF);
  cursor: pointer;
  padding: 4px 8px;
}

.more-btn:hover {
  color: var(--text-light, #1F2937);
}

.more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 180px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid #E5E7EB;
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.15s ease;
  z-index: 100;
}

.more-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.more-menu.dropdown-up {
  top: auto;
  bottom: calc(100% + 4px);
  transform: translateY(8px);
}

.more-menu.dropdown-up.active {
  transform: translateY(0);
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.more-menu-item:hover {
  background: #F3F4F6;
  color: #1F2937;
}

.more-menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.more-menu-item.danger {
  color: #DC2626;
}

.more-menu-item.danger:hover {
  background: #FEF2F2;
  color: #B91C1C;
}

.more-menu-divider {
  height: 1px;
  background: #E5E7EB;
  margin: 6px 0;
}



.clients-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.search-filters {
  display: flex;
  gap: 12px;
  flex: 1;
  max-width: 600px;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  opacity: 1;
  color: #2E7A64;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  background: #ffffff;
  border: 2px solid #d1d5db;
  border-radius: 12px;
  color: #1f2937;
  font-size: 15px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-input:hover {
  border-color: #2E7A64;
}

.search-input:focus {
  outline: none;
  border-color: #2E7A64;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(46, 122, 100, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-select {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  min-width: 150px;
  transition: all 0.2s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-light);
}

.btn-primary {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-2px);
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card-small {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-light);
}

/* Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
}

.clients-table thead {
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border);
}

.clients-table th {
  padding: 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.clients-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  cursor: pointer;
}

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

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

.clients-table td {
  padding: 16px;
  font-size: 14px;
  color: var(--text-light);
}

.client-name {
  font-weight: 600;
  color: var(--text-light);
}

.client-email {
  color: var(--text-muted);
  font-size: 13px;
}

/* Source badges */
.source-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  text-transform: capitalize;
  vertical-align: middle;
  letter-spacing: 0.3px;
}
.source-jane { background: #e8f5e9; color: #2e7d32; }
.source-healthie { background: #e3f2fd; color: #1565c0; }
.source-bookem { background: #fff3e0; color: #e65100; }
.source-functionalmind { background: #f3e5f5; color: #7b1fa2; }
.source-csv_import { background: #eceff1; color: #455a64; }

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.status-badge.inactive {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.status-badge.archived {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 12px;
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-small.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

/* Loading State */
.loading-row {
  text-align: center;
  padding: 60px 20px !important;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.page-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: var(--border);
  border-color: var(--primary-light);
}

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

.page-info {
  font-size: 14px;
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text-light);
}

.empty-state p {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border, #E5E7EB);
}

.tab-nav a {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted, #6B7280);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-nav a:hover {
  color: var(--primary, #1E4D3F);
}

.tab-nav a:focus-visible {
  color: var(--primary, #1E4D3F);
  outline: 2px solid var(--primary, #1E4D3F);
  outline-offset: 2px;
  border-radius: 2px;
}

.tab-nav a.active {
  color: var(--primary, #1E4D3F);
  border-bottom-color: var(--primary, #1E4D3F);
}

.tab-nav .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  margin-left: 8px;
}

/* Quick Notes Button */
.quick-notes-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: white;
  border: none;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light, #1F2937);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  z-index: 50;
}

.quick-notes-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.quick-notes-btn:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.1);
  outline: 2px solid var(--primary, #1E4D3F);
  outline-offset: 2px;
}

.quick-notes-btn .notes-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-notes-btn .notes-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary, #1E4D3F);
  stroke-width: 2;
  fill: none;
}

/* Responsive */
@media (max-width: 768px) {
  .clients-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-filters {
    flex-direction: column;
    max-width: 100%;
  }

  .clients-table {
    font-size: 12px;
  }

  .clients-table th,
  .clients-table td {
    padding: 12px 8px;
  }

  .action-buttons {
    flex-direction: column;
  }
}
