/* ==========================================================================
   Agente SEO — estilos del módulo (todas las clases llevan el prefijo ag-)
   Usa las variables de :root de styles.css, con valores de reserva por si
   alguna no existiera. No modifica ninguna regla del panel.
   ========================================================================== */

.ag-root {
  margin: 0 0 18px;
  overflow: hidden;
  border: 1px solid var(--line, rgba(244, 242, 238, 0.11));
  border-radius: 14px;
  background: rgba(34, 34, 32, 0.55);
}

/* Cabecera desplegable */
.ag-toggle {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--cream, #f4f2ee);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.ag-toggle:hover {
  background: rgba(244, 242, 238, 0.03);
}

.ag-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #77a68c;
  box-shadow: 0 0 0 4px rgba(119, 166, 140, 0.12);
}

.ag-sub {
  color: var(--muted, #aaa9a4);
  font-size: 11px;
  font-weight: 400;
}

.ag-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ag-chev {
  color: #7fab92;
  font-size: 19px;
  line-height: 1;
  transition: transform 180ms ease;
}

.ag-root.open .ag-chev {
  transform: rotate(180deg);
}

.ag-root.open .ag-toggle {
  border-bottom: 1px solid var(--line, rgba(244, 242, 238, 0.11));
}

/* Etiquetas de estado */
.ag-chip {
  min-height: 24px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.ag-chip.ok {
  border-color: #416c54;
  background: rgba(34, 73, 54, 0.48);
  color: #bcd1c4;
}

.ag-chip.warn {
  border-color: #765436;
  background: rgba(170, 103, 43, 0.12);
  color: #d89a60;
}

.ag-chip.off {
  border-color: rgba(244, 242, 238, 0.11);
  background: transparent;
  color: #777670;
}

/* Cuerpo */
.ag-body {
  padding: 20px 16px 18px;
  display: grid;
  gap: 20px;
}

.ag-muted {
  margin: 0;
  color: var(--muted, #aaa9a4);
  font-size: 12px;
  line-height: 1.55;
}

.ag-error {
  margin: 0;
  color: #e28484;
  font-size: 12px;
  line-height: 1.55;
}

.ag-checklist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ag-checklist > .ag-muted {
  margin-right: 4px;
  font-size: 11px;
}

.ag-form {
  display: grid;
  gap: 16px;
}

.ag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ag-field {
  min-width: 0;
  display: grid;
  gap: 8px;
  color: #aaa9a4;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ag-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ag-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line, rgba(244, 242, 238, 0.11));
  border-radius: 9px;
  background: var(--surface, #222220);
  color: var(--cream, #f4f2ee);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
}

select.ag-input {
  color-scheme: dark;
}

.ag-input:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ag-help.is-error {
  color: #d89a60;
}

.ag-area {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.55;
}

.ag-input::placeholder {
  color: #6f6e69;
}

.ag-input:focus {
  border-color: #416c54;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(127, 171, 146, 0.1);
}

.ag-help {
  color: #777670;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
}

/* Botón de subir documento */
.ag-file {
  min-height: 32px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(127, 171, 146, 0.32);
  border-radius: 8px;
  background: rgba(34, 73, 54, 0.28);
  color: #a9ccb9;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ag-file:hover {
  border-color: rgba(127, 171, 146, 0.68);
  background: rgba(34, 73, 54, 0.52);
  color: var(--cream, #f4f2ee);
}

.ag-file {
  font-family: inherit;
}

.ag-file:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ag-file input {
  display: none;
}

/* Campos estructurados plegables */
.ag-details {
  border: 1px solid var(--line, rgba(244, 242, 238, 0.11));
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.1);
}

.ag-details > summary {
  padding: 13px 15px;
  color: var(--cream, #f4f2ee);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ag-details[open] > summary {
  border-bottom: 1px solid var(--line, rgba(244, 242, 238, 0.11));
}

.ag-details-body {
  padding: 16px 15px 18px;
  display: grid;
  gap: 14px;
}

/* Botones de acción */
.ag-actions {
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line, rgba(244, 242, 238, 0.11));
}

.ag-danger {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(215, 101, 101, 0.27);
  border-radius: 8px;
  background: rgba(215, 101, 101, 0.06);
  color: #c96d6d;
  font-size: 11px;
}

.ag-danger:hover {
  border-color: rgba(215, 101, 101, 0.54);
  background: rgba(215, 101, 101, 0.11);
}

.ag-root .primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

/* Aviso flotante */
.ag-toast {
  position: fixed;
  z-index: 120;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100% - 32px));
  padding: 14px 18px;
  border: 1px solid rgba(65, 179, 128, 0.45);
  border-radius: 12px;
  background: #173327;
  color: #dff8eb;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.ag-toast.err {
  border-color: rgba(215, 101, 101, 0.5);
  background: #3a2121;
  color: #f0c4c4;
}

.ag-toast.out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 240ms ease, transform 240ms ease;
}

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

  .ag-toggle {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .ag-sub {
    display: none;
  }

  .ag-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .ag-toast {
    right: 16px;
    left: 16px;
    bottom: 16px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-chev,
  .ag-toast.out {
    transition-duration: 0.01ms !important;
  }
}
