/* ================================================
   IAB Tech Lab Agents Registry - Directory Styles
   Matches Tools Portal React Design Exactly
   ================================================ */

.agents-directory {
  max-width: 1200px;
  margin: 0 auto;
}

/* Hero Card */
.agents-directory .heroCard {
  border: 1px solid var(--border-dark);
  border-left: 5px solid #c82333;
  margin-bottom: 1rem;
  background: var(--bg-white);
  border-radius: 0.25rem;
}

.agents-directory .heroCard .card-body {
  padding: 1.25rem;
}

.agents-directory .heroCard .card-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.agents-directory .heroCard .card-text {
  color: var(--text-medium);
  margin-bottom: 0;
}

/* Filters */
.filters-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.filters-row .form-control {
  border-radius: 6px;
  border: 1px solid var(--border-dark);
  padding: 10px 15px;
  font-size: 14px;
  flex: 1;
  min-width: 150px;
  max-width: 200px;
}

.filters-row .form-control:focus {
  border-color: #c82333;
  box-shadow: 0 0 0 0.2rem rgba(200, 35, 51, 0.15);
  outline: none;
}

.search-input {
  flex: 2 !important;
  max-width: 300px !important;
}

.filters-row-secondary {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

.filters-row-secondary .form-control {
  background: #f9fafb;
  border-color: #e5e7eb;
}

.filters-row-secondary .form-control:focus {
  background: #fff;
}

/* IAB Member Filter */
.iab-member-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  padding: 8px 0;
  user-select: none;
}

.iab-member-filter input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #c82333;
  cursor: pointer;
}

.iab-member-filter:hover {
  color: #c82333;
}

/* Results Bar */
.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-count {
  font-size: 0.9rem;
  color: var(--text-medium);
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 0;
}

.view-toggle .btn {
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  background: var(--bg-white);
  color: var(--text-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle .btn:first-child {
  border-radius: 4px 0 0 4px;
}

.view-toggle .btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.view-toggle .btn:hover {
  background: #f8f9fa;
  border-color: #c82333;
  color: #c82333;
}

.view-toggle .btn.active {
  background: #c82333;
  border-color: #c82333;
  color: #fff;
}

/* Agent Cards Grid */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Agent Card */
.agent-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.agent-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #c82333;
}

.agent-card-header {
  padding: 20px;
  display: flex;
  gap: 16px;
  border-bottom: 1px solid #f3f4f6;
  align-items: flex-start;
}

.agent-avatar {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

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

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-name {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-legal-name {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  margin-top: 2px;
}

.agent-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 12px;
}

.agent-domain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #6b7280;
  font-size: 12px;
}

.agent-gvl {
  background: #ede9fe;
  color: #6b21a8;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.agent-protocol {
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.agent-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.agent-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Verification Section */
.verification-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.verification-details {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.verification-item {
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 11px;
  color: #9ca3af;
}

.verification-item.verified {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.verification-item.pending {
  background: #f3f4f6;
  color: #9ca3af;
}

/* Taxonomy Section */
.taxonomy-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.taxonomy-section strong {
  font-size: 12px;
  color: #6b7280;
}

.taxonomy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.taxonomy-tag {
  display: inline-block;
  padding: 3px 8px;
  background: #e0f2fe;
  color: #075985;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.taxonomy-tag.more {
  background: #f3f4f6;
  color: #6b7280;
}

.taxonomy-tag.iab-tag {
  background: #ede9fe;
  color: #5b21b6;
}

.taxonomy-tag.capability-tag {
  background: #dbeafe;
  color: #1e40af;
}

.agent-card-footer {
  padding: 16px 20px;
  background: #f9fafb;
  border-top: 1px solid #f3f4f6;
  display: flex;
  gap: 8px;
  align-items: center;
}

.agent-card-footer .btn {
  font-size: 13px;
  padding: 6px 12px;
}

/* List View */
.agents-list-view {
  margin-top: 1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

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

.agents-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.agents-table thead th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agents-table tbody tr.agent-row {
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}

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

.agents-table tbody tr.agent-row.expanded {
  background: #fef2f2;
  border-bottom-color: transparent;
}

.agents-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: #374151;
  vertical-align: middle;
}

.agent-avatar-cell {
  width: 50px;
  text-align: center;
  vertical-align: middle;
}

.agent-list-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #f9fafb;
  padding: 2px;
}

.agent-list-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin: 0 auto;
}

.expand-cell {
  width: 30px;
  text-align: center;
}

.expand-icon {
  display: inline-block;
  font-size: 10px;
  color: #9ca3af;
  transition: transform 0.2s;
}

.expand-icon.open {
  transform: rotate(90deg);
  color: #c82333;
}

.agent-name-cell .agent-name-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-name-cell .agent-name {
  font-weight: 600;
  color: #111827;
}

.agent-name-cell .agent-legal-name {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

.domain-cell .domain-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: #6b7280;
}

.protocol-cell .protocol-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
}

.gpp-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #6b21a8;
  font-weight: 600;
}

.category-cell .no-category {
  color: #9ca3af;
}

.status-cell .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.status-cell .status-badge.badge-verified {
  background: #d1fae5;
  color: #065f46;
}

.status-cell .status-badge.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-cell .status-badge.badge-failed {
  background: #fee2e2;
  color: #991b1b;
}

.actions-cell .btn-outline-danger {
  border: 1px solid #c82333;
  color: #c82333;
  font-size: 12px;
  padding: 4px 12px;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
}

.actions-cell .btn-outline-danger:hover {
  background: #c82333;
  color: #fff;
}

/* Accordion Row */
.accordion-row {
  background: #fef2f2;
  border-bottom: 1px solid #e5e7eb;
}

.accordion-row > td {
  padding: 0 !important;
}

.accordion-content {
  padding: 20px 24px 20px 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.accordion-section {
  min-width: 150px;
}

.accordion-section h6 {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 0;
}

.accordion-section.accordion-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
}

.accordion-section.accordion-actions .btn {
  font-size: 12px;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.endpoint-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #c82333;
  text-decoration: none;
  word-break: break-all;
}

.endpoint-link:hover {
  text-decoration: underline;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg-white);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.pagination-rows-per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
  color: var(--text-medium);
}

.pagination-rows-per-page select {
  padding: 4px 8px;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

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

.pagination-page-info {
  font-size: 14px;
  color: var(--text-medium);
  padding: 0 0.5rem;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination-buttons .btn {
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.pagination-buttons .btn svg {
  display: block;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-medium);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state p {
  font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 992px) {
  .agents-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filters-row .form-control {
    max-width: none;
  }
  
  .search-input {
    max-width: none !important;
  }
  
  .agents-grid {
    grid-template-columns: 1fr;
  }
  
  .results-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  
  /* Hide less important columns on mobile */
  .agents-table thead th:nth-child(4),
  .agents-table tbody td:nth-child(4),
  .agents-table thead th:nth-child(5),
  .agents-table tbody td:nth-child(5),
  .agents-table thead th:nth-child(6),
  .agents-table tbody td:nth-child(6) {
    display: none;
  }
  
  .accordion-content {
    padding-left: 24px;
    flex-direction: column;
    gap: 16px;
  }
  
  .pagination-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
  
  .pagination-rows-per-page {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}
