/**
 * MMI Platform - Agents Module Styles
 */

/* =============================================================================
   Agents Stats
   ============================================================================= */

.agents-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.agents-stats .stat-card {
  position: relative;
  overflow: hidden;
}

.agents-stats .stat-active {
  border-left: 3px solid var(--color-success);
}

.agents-stats .stat-pending {
  border-left: 3px solid var(--color-warning);
}

@media (max-width: 768px) {
  .agents-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================================================
   Agents Tabs
   ============================================================================= */

.agents-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.agents-tab {
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

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

.agents-tab .badge {
  background: var(--color-warning);
  color: #000;
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

/* =============================================================================
   Agents Sections
   ============================================================================= */

.agents-section {
  display: none;
}

.agents-section.active {
  display: block;
}

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

.section-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.agents-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.agents-filters .select {
  min-width: 150px;
}

/* =============================================================================
   Agents Grid
   ============================================================================= */

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

.agent-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  transition: box-shadow 0.2s ease;
}

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

.agent-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.agent-icon {
  width: 40px;
  height: 40px;
  background: var(--color-background);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

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

.agent-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-type {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.agent-status {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.agent-description {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.agent-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.agent-actions {
  display: flex;
  gap: 0.5rem;
}

/* =============================================================================
   Directives List
   ============================================================================= */

.directives-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.directive-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  transition: box-shadow 0.2s ease;
}

.directive-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.directive-priority {
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.directive-status {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.directive-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.directive-description {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.directive-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

.directive-actions {
  display: flex;
  gap: 0.5rem;
}

/* =============================================================================
   Approvals List
   ============================================================================= */

.approvals-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.approval-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-warning);
  border-radius: 8px;
  padding: 1rem;
}

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

.approval-type {
  background: var(--color-background);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.approval-time {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.approval-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.approval-description {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.approval-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.approval-actions {
  display: flex;
  gap: 0.5rem;
}

/* =============================================================================
   Activity List
   ============================================================================= */

.agents-activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activity-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.activity-icon {
  width: 32px;
  height: 32px;
  background: var(--color-background);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-message {
  font-size: 0.875rem;
  color: var(--color-text);
}

.activity-timestamp {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

/* =============================================================================
   Status Colors
   ============================================================================= */

.status-active,
.status-completed,
.status-approved {
  background: var(--color-success-bg, rgba(34, 197, 94, 0.15));
  color: var(--color-success);
}

.status-idle,
.status-pending,
.status-assigned {
  background: var(--color-warning-bg, rgba(234, 179, 8, 0.15));
  color: var(--color-warning);
}

.status-inactive,
.status-failed,
.status-rejected,
.status-error {
  background: var(--color-danger-bg, rgba(239, 68, 68, 0.15));
  color: var(--color-danger);
}

.status-in_progress,
.status-awaiting_approval {
  background: var(--color-info-bg, rgba(59, 130, 246, 0.15));
  color: var(--color-info, #3b82f6);
}

.status-cancelled {
  background: var(--color-border);
  color: var(--color-text-secondary);
}

/* =============================================================================
   Priority Colors
   ============================================================================= */

.priority-critical {
  background: var(--color-danger-bg, rgba(239, 68, 68, 0.15));
  color: var(--color-danger);
}

.priority-high {
  background: var(--color-warning-bg, rgba(234, 179, 8, 0.15));
  color: var(--color-warning);
}

.priority-normal {
  background: var(--color-info-bg, rgba(59, 130, 246, 0.15));
  color: var(--color-info, #3b82f6);
}

.priority-low {
  background: var(--color-border);
  color: var(--color-text-secondary);
}

/* =============================================================================
   Detail Views
   ============================================================================= */

.agent-detail,
.directive-detail,
.approval-detail {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-row {
  display: flex;
  gap: 1rem;
}

.detail-row.full-width {
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  min-width: 100px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 0.875rem;
  color: var(--color-text);
  word-break: break-word;
}

.detail-value.code {
  background: var(--color-background);
  padding: 0.75rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* =============================================================================
   Modal Form Styles
   ============================================================================= */

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.modal-form label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

/* =============================================================================
   Pagination
   ============================================================================= */

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
}

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

/* =============================================================================
   Button Variants
   ============================================================================= */

.btn-success {
  background: var(--color-success);
  color: #fff;
}

.btn-success:hover {
  background: var(--color-success);
  filter: brightness(1.1);
}

/* =============================================================================
   Responsive Adjustments
   ============================================================================= */

@media (max-width: 640px) {
  .agents-grid {
    grid-template-columns: 1fr;
  }

  .agent-actions,
  .directive-actions,
  .approval-actions {
    flex-wrap: wrap;
  }

  .directive-meta,
  .approval-meta {
    flex-direction: column;
    gap: 0.25rem;
  }

  .agents-filters {
    flex-direction: column;
  }

  .agents-filters .select {
    width: 100%;
  }
}
