/* ========================================
   AGENT CONFIG PANEL — Styles
   ======================================== */

/* --- Grid de Cards de Agente --- */
.ac-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-md);
}

@media (min-width: 1600px) {
  .ac-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 2200px) {
  .ac-grid { grid-template-columns: repeat(4, 1fr); }
}

/* --- Card de Agente --- */
.ac-card {
  background: var(--gradient-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 250ms, box-shadow 250ms;
}
.ac-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}
.ac-card.expanded {
  grid-column: 1 / -1;
}

.ac-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  cursor: pointer;
  user-select: none;
}
.ac-card-header:hover { background: var(--bg-glass-hover); }

.ac-card-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.ac-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ac-card-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.ac-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.ac-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.ac-badge-active { background: rgba(16,185,129,0.15); color: #10b981; }
.ac-badge-inactive { background: rgba(107,114,128,0.15); color: #6b7280; }
.ac-badge-score {
  background: rgba(99,102,241,0.15);
  color: var(--accent-primary-light);
}

/* Toggle switch */
.ac-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 200ms;
  border: 1px solid var(--border-default);
  flex-shrink: 0;
}
.ac-toggle.on { background: rgba(16,185,129,0.3); border-color: #10b981; }
.ac-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 200ms, background 200ms;
}
.ac-toggle.on::after { transform: translateX(16px); background: #10b981; }

/* Card body (expandable) */
.ac-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
}
.ac-card.expanded .ac-card-body {
  max-height: 3000px;
}

/* --- Abas --- */
.ac-tabs {
  display: flex;
  gap: 2px;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0,0,0,0.2);
}
.ac-tab {
  padding: var(--space-sm) var(--space-md);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 200ms, border-color 200ms;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.ac-tab:hover { color: var(--text-secondary); }
.ac-tab.active {
  color: var(--accent-primary-light);
  border-bottom-color: var(--accent-primary);
}

.ac-tab-content {
  display: none;
  padding: var(--space-lg);
}
.ac-tab-content.active { display: block; }

/* --- Skeleton Loaders --- */
.ac-skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(255,255,255,0.06) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: ac-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.ac-skeleton-card {
  height: 80px;
  border-radius: var(--radius-lg);
}
.ac-skeleton-line {
  height: 14px;
  margin-bottom: var(--space-sm);
}
.ac-skeleton-line.short { width: 60%; }
@keyframes ac-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Toast Notifications --- */
.ac-toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.ac-toast {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  animation: ac-toast-in 250ms ease;
  max-width: 360px;
  border: 1px solid;
}
.ac-toast.success {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.3);
}
.ac-toast.error {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.3);
}
.ac-toast.warning {
  background: rgba(245,158,11,0.15);
  border-color: rgba(245,158,11,0.3);
}
.ac-toast.fade-out {
  animation: ac-toast-out 250ms ease forwards;
}
@keyframes ac-toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes ac-toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* --- Parameter Editor --- */
.ac-param-group {
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ac-param-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: rgba(0,0,0,0.2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ac-param-group-body {
  padding: var(--space-sm) var(--space-md);
}
.ac-param-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.ac-param-row:last-child { border-bottom: none; }
.ac-param-label {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.ac-param-label .ac-info-icon {
  font-size: 10px;
  cursor: help;
  opacity: 0.5;
}
.ac-param-label .ac-info-icon:hover { opacity: 1; }
.ac-param-changed .ac-param-label { color: var(--color-warning); }

.ac-param-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.ac-param-default {
  font-size: 10px;
  color: var(--text-muted);
}

/* Slider */
.ac-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  outline: none;
}
.ac-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}
.ac-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}

/* Number input */
.ac-input-number {
  width: 70px;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  text-align: right;
}
.ac-input-number:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Select */
.ac-select {
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
}
.ac-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Validation errors */
.ac-error {
  font-size: 11px;
  color: var(--color-sell);
  padding: 4px 0;
}
.ac-param-row.has-error .ac-input-number,
.ac-param-row.has-error .ac-select {
  border-color: var(--color-sell);
}

/* --- Weight Bar --- */
.ac-weight-bar {
  display: flex;
  height: 32px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
  cursor: pointer;
}
.ac-weight-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  transition: width 200ms;
  position: relative;
  min-width: 2px;
}
.ac-weight-segment-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.ac-weight-handle {
  position: absolute;
  right: -3px;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}
.ac-weight-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 16px;
  background: rgba(255,255,255,0.4);
  border-radius: 1px;
}
.ac-weight-inputs {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}
.ac-weight-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}
.ac-weight-input-group .ac-color-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --- Preset Selector --- */
.ac-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-sm);
}
.ac-preset-btn {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms;
  text-align: center;
}
.ac-preset-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: rgba(99,102,241,0.1);
}
.ac-preset-btn.selected {
  border-color: var(--accent-primary);
  background: rgba(99,102,241,0.15);
  color: var(--accent-primary-light);
}

/* Preset diff */
.ac-diff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: var(--space-sm);
}
.ac-diff-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}
.ac-diff-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.ac-diff-changed { background: rgba(245,158,11,0.08); }
.ac-diff-same { color: var(--text-muted); }

/* --- Confirmation Dialog --- */
.ac-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: ac-fade-in 200ms;
}
.ac-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: 480px;
  width: 90%;
}
.ac-dialog-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}
.ac-dialog-body {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}
.ac-dialog-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}
@keyframes ac-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Tooltip --- */
.ac-tooltip {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 280px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

/* --- Buttons --- */
.ac-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms;
  border: 1px solid;
  font-family: var(--font-sans);
}
.ac-btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}
.ac-btn-primary:hover { opacity: 0.9; }
.ac-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ac-btn-outline {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-secondary);
}
.ac-btn-outline:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}
.ac-btn-danger {
  background: transparent;
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}
.ac-btn-danger:hover {
  background: rgba(239,68,68,0.1);
}

/* --- Heatmap / Matrix --- */
.ac-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.ac-matrix th {
  padding: 8px;
  text-align: center;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}
.ac-matrix td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 200ms;
}
.ac-matrix td:hover { background: var(--bg-glass-hover); }
.ac-cell-green { background: rgba(16,185,129,0.15); color: #10b981; }
.ac-cell-yellow { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ac-cell-red { background: rgba(239,68,68,0.15); color: #ef4444; }

/* --- Feedback Panel --- */
.ac-form-group {
  margin-bottom: var(--space-md);
}
.ac-form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
  display: block;
}
.ac-form-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.ac-form-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* --- Decay Curve Canvas --- */
.ac-decay-canvas {
  width: 100%;
  height: 120px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.2);
}

/* --- A/B Test Cards --- */
.ac-ab-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}
.ac-ab-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

/* --- Audit Trail --- */
.ac-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.ac-audit-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-tertiary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
}
.ac-audit-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* --- Freeze Banner --- */
.ac-freeze-banner {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  font-size: 12px;
  color: #ef4444;
}

/* --- Section Header --- */
.ac-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.ac-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
