/**
 * Agent Database UI Styles
 * Version: 1.0.0
 */

/* Container */
.agent-db-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.agent-db-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.agent-db-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.agent-db-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.agent-db-back-btn:hover {
  background: #e8e8e8;
}

.agent-db-back-btn svg {
  width: 18px;
  height: 18px;
  color: #666;
}

.agent-db-title {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.agent-db-subtitle {
  font-size: 14px;
  color: #6b6b6b;
  margin: 4px 0 0 0;
}

/* Buttons */
.agent-db-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.agent-db-btn-primary {
  background: #6366f1;
  color: white;
}

.agent-db-btn-primary:hover {
  background: #4f46e5;
}

.agent-db-btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #e0e0e0;
}

.agent-db-btn-secondary:hover {
  background: #e8e8e8;
}

.agent-db-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #666;
}

.agent-db-icon-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.agent-db-icon-btn.danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Stats */
.agent-db-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.agent-db-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  min-width: 140px;
}

.agent-db-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #f0f0ff;
  border-radius: 10px;
  color: #6366f1;
}

.agent-db-stat-icon.icon-success {
  background: #d1fae5;
  color: #059669;
}

.agent-db-stat-icon svg {
  width: 20px;
  height: 20px;
}

.agent-db-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
}

.agent-db-stat-label {
  font-size: 12px;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* Groups Grid */
.agent-db-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.agent-db-group-card {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.15s ease;
}

.agent-db-group-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.agent-db-group-card.is-default {
  border-color: #6366f1;
}

.agent-db-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
}

.agent-db-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  color: white;
}

.agent-db-group-icon svg {
  width: 24px;
  height: 24px;
}

.agent-db-group-actions {
  display: flex;
  gap: 4px;
}

.agent-db-group-body {
  padding: 0 16px 16px;
}

.agent-db-group-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 4px 0;
}

.agent-db-group-desc {
  font-size: 13px;
  color: #6b6b6b;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.agent-db-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 12px;
}

.badge-default {
  background: #eef2ff;
  color: #4338ca;
}

.agent-db-group-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fafafa;
  border-top: 1px solid #e8e8e8;
}

.agent-db-agent-count {
  font-size: 13px;
  color: #6b6b6b;
}

/* Empty State */
.agent-db-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background: white;
  border: 1px dashed #e0e0e0;
  border-radius: 12px;
}

.agent-db-empty svg {
  width: 48px;
  height: 48px;
  color: #d0d0d0;
  margin-bottom: 16px;
}

.agent-db-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
}

.agent-db-empty p {
  font-size: 14px;
  color: #6b6b6b;
  margin: 0 0 20px 0;
}

.agent-db-empty-small {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  color: #9ca3af;
}

.agent-db-empty-small svg {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
}


/* Modal */
.agent-db-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.agent-db-modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.agent-db-modal-large {
  max-width: 700px;
}

.agent-db-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e8e8e8;
}

.agent-db-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.agent-db-modal-subtitle {
  font-size: 13px;
  color: #6b6b6b;
  margin: 4px 0 0 0;
}

.agent-db-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #666;
}

.agent-db-modal-close:hover {
  background: #f0f0f0;
}

.agent-db-modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #fafafa;
  border-bottom: 1px solid #e8e8e8;
}

.agent-db-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  min-width: 240px;
}

.agent-db-search-box svg {
  width: 16px;
  height: 16px;
  color: #9ca3af;
}

.agent-db-search-box input {
  border: none;
  outline: none;
  font-size: 14px;
  width: 100%;
}

.agent-db-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.agent-db-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
}

/* Form */
.agent-db-form-group {
  margin-bottom: 20px;
}

.agent-db-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.agent-db-input,
.agent-db-textarea,
.agent-db-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.agent-db-input:focus,
.agent-db-textarea:focus,
.agent-db-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.agent-db-textarea {
  min-height: 80px;
  resize: vertical;
}

.agent-db-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.agent-db-checkbox-label input {
  width: 18px;
  height: 18px;
}


/* Table */
.agent-db-table {
  width: 100%;
  border-collapse: collapse;
}

.agent-db-table th {
  text-align: left;
  padding: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #6b6b6b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e8e8e8;
}

.agent-db-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.agent-db-table tbody tr:hover {
  background: #fafafa;
}

.agent-db-agent-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-db-agent-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #6366f1;
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 50%;
}

.agent-db-agent-name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
}

.agent-db-agent-email {
  font-size: 12px;
  color: #6b6b6b;
}

.agent-db-status {
  display: inline-flex;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
}

.status-active {
  background: #d1fae5;
  color: #059669;
}

.status-inactive {
  background: #f3f4f6;
  color: #6b7280;
}

.agent-db-row-actions {
  display: flex;
  gap: 4px;
}


/* ============================================
   User Search in Add Agent Modal
   ============================================ */

.agent-db-search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.agent-db-search-input-wrapper:focus-within {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.agent-db-search-input-wrapper svg {
  width: 16px;
  height: 16px;
  color: #9ca3af;
}

.agent-db-search-input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
}

.agent-db-search-results {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-top: 8px;
}

.agent-db-search-hint,
.agent-db-search-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: #9ca3af;
  font-size: 13px;
}

.agent-db-search-hint svg,
.agent-db-search-empty svg {
  width: 16px;
  height: 16px;
}

.agent-db-results-list {
  padding: 4px;
}

.agent-db-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.agent-db-result-item:hover:not(.disabled) {
  background: #f3f4f6;
}

.agent-db-result-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.agent-db-result-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #e0e7ff;
  color: #4f46e5;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
}

.agent-db-result-info {
  flex: 1;
  min-width: 0;
}

.agent-db-result-name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
}

.agent-db-result-email {
  font-size: 12px;
  color: #6b7280;
}

.agent-db-result-dept {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.agent-db-result-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 10px;
}

.agent-db-result-add {
  width: 18px;
  height: 18px;
  color: #6366f1;
}

/* Selected user card */
.agent-db-selected-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
}

.agent-db-selected-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-db-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
}

.agent-db-btn-icon:hover {
  background: #e5e7eb;
  color: #1a1a1a;
}

.agent-db-btn-icon svg {
  width: 16px;
  height: 16px;
}

