/**
 * @file
 * Estilos para las pestañas de documentación de APIs.
 * Estilo idéntico al tema SURA (azul).
 */

/* Wrapper principal */
.api-docs-tabs-wrapper {
  margin: 0.0rem 0 2rem 0;
}

/* Tabs primarios estilo SURA */
.api-docs-tabs-wrapper .tabs.primary {
  border: none;
  margin: 0 0 20px 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  position: relative;
  font-family: "surasans", Arial, sans-serif;
}

/* Línea base azul claro que recorre todo el ancho */
.api-docs-tabs-wrapper .tabs.primary::before {
  content: "";
  border-bottom: 1px solid #81B1FF;
  bottom: 0;
  display: block;
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
  z-index: 10;
}

.api-docs-tabs-wrapper .tabs.primary li {
  margin: 0;
  padding: 0;
  display: block;
}

.api-docs-tabs-wrapper .tabs.primary a {
  background: transparent;
  border: none;
  color: #5C5C5C;
  text-decoration: none;
  display: block;
  padding: 0 1.85rem;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
  font-weight: 400;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color 0.2s ease;
  user-select: none;
}

.api-docs-tabs-wrapper .tabs.primary a:hover {
  color: #3c3c3c;
  text-decoration: none;
}

.api-docs-tabs-wrapper .tabs.primary li.is-active a,
.api-docs-tabs-wrapper .tabs.primary a.is-active {
  background: transparent;
  border: none;
  color: #2d6df6;
  font-weight: 400;
}

/* Indicador redondeado de 4px debajo del tab activo */
.api-docs-tabs-wrapper .tabs.primary li.is-active a::after,
.api-docs-tabs-wrapper .tabs.primary a.is-active::after {
  content: "";
  height: 4px;
  background-color: #2d6df6;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 16;
  border-radius: 30px 30px 0 0;
}

/* Contenido de las pestañas */
.api-docs-tabs-content {
  background: transparent;
  padding: 0;
  border: none;
  margin: 0;
}

.api-docs-tab-pane {
  display: none;
  padding: 1rem 0;
}

.api-docs-tab-pane.active {
  display: block;
}

/* Ajustes para el contenido de negocio */
#tab-business {
  line-height: 1.6;
}

/* ===== Estilos de tablas para documentación de negocio ===== */
/*
 * CKEditor 5 genera tablas dentro de <figure class="table"> pero HTMLPurifier
 * elimina el <figure> al guardar, dejando <table> suelto sin estilos.
 * Estos estilos replican los que CKEditor aplica en el editor para que la
 * vista guardada sea idéntica a la previsualización.
 */
#tab-business figure.table,
#tab-business .table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
}

#tab-business table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.95em;
  overflow: hidden;
}

#tab-business table th,
#tab-business table td {
  border: 1px solid #c4c4c4;
  min-width: 2em;
  padding: 0.5em 0.75em;
  vertical-align: top;
  word-break: break-word;
}

#tab-business table th {
  font-weight: 600;
  background-color: #f2f2f2;
  color: #3c3c3c;
  text-align: left;
}

#tab-business table tr:nth-child(even) td {
  background-color: #fafafa;
}

#tab-business table tr:hover td {
  background-color: #f0f4ff;
}

/* Responsive: scroll horizontal en pantallas pequeñas */
@media (max-width: 768px) {
  #tab-business table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Asegurar que el Swagger se vea bien */
#tab-technical {
  padding: 0;
}

#tab-technical .swagger-ui {
  margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .api-docs-tabs-wrapper .tabs.primary a {
    padding: 0 1rem;
    font-size: 14px;
  }
  
  .api-docs-tab-pane {
    padding: 1rem;
  }
}

/* ===== Tab Descargas (Postman) ===== */

/* Mensaje de login requerido para usuarios anónimos */
.postman-login-required {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 2.5rem 1rem;
  text-align: center;
  color: #5C5C5C;
}

.postman-login-required .icon {
  font-size: 2rem;
}

.postman-login-required p {
  margin: 0;
  font-size: 15px;
}

/* Enlace de gestión para administradores */
.postman-admin-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e8e8e8;
}

.btn-manage-postman {
  color: #5C5C5C;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-manage-postman:hover {
  color: #2d6df6;
  text-decoration: none;
}

/* ===== Swagger / OpenAPI URL visibility (fusionado desde swagger_description_custom) ===== */
/* Oculta la URL del archivo OpenAPI, el label del campo y los enlaces directos al spec. */
.swagger-ui .info .link,
.swagger-ui .info a,
.field--name-field-apidoc-spec .field__label,
.field--name-field-apidoc-spec .file,
.field--name-field-apidoc-spec .file a,
.field--name-field-apidoc-spec a[href*=".yaml"],
.field--name-field-apidoc-spec a[href*=".json"],
a[href*="/sites/default/files/apidoc_specs/"] {
  display: none !important;
  visibility: hidden !important;
}
