/* ============================================================
   BARRA DE ACCIONES RÁPIDAS CANÓNICA (.tool-quick-bar)
   Mantiene la cabecera .app-header limpia y garantiza respuesta táctil
   sin desbordamientos en móvil ni aplastamiento de iconos en escritorio.
   ============================================================ */

/* Blindaje estricto para botones icono dentro de la cabecera canónica */
.app-header .header-actions .btn-icon {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Contenedor principal de barra rápida en .tool-main-content */
.tool-quick-bar,
.tool-main-content>.related-tools-section,
.tool-main-content>.tools-ad-banner-bottom {
  grid-column: 1 / -1;
}

.tool-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-card, var(--bg-surface, #131b2e));
  border: 1px solid var(--border-color, var(--border-subtle, rgba(255, 255, 255, 0.1)));
  border-radius: var(--radius-lg, 14px);
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
}

[data-theme="light"] .tool-quick-bar {
  background: var(--bg-card, #ffffff);
  border-color: var(--border-color, var(--border-subtle, #e2e8f0));
}

.tool-quick-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.tool-quick-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

/* Badges de privacidad dentro de la barra rápida */
.tool-quick-bar .badge-privacy,
.tool-quick-bar .privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 100%;
}

.tool-quick-bar .badge-privacy svg,
.tool-quick-bar .privacy-badge svg {
  flex-shrink: 0;
}

/* Estandarización de selects dentro de la barra rápida */
.tool-quick-bar select,
.tool-quick-bar .form-select,
.tool-quick-bar .form-select-header {
  width: auto !important;
  min-width: 175px;
  max-width: 265px;
  height: 40px;
  min-height: 40px;
  padding: 0.45rem 2.25rem 0.45rem 0.8rem !important;
  font-size: 0.82rem;
  border-radius: var(--radius-md, 10px);
  background-color: var(--bg-input, #0f172a);
  color: var(--text-main, var(--text-primary, #f8fafc));
  border: 1px solid var(--border-color, var(--border-subtle, rgba(255, 255, 255, 0.14)));
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

[data-theme="light"] .tool-quick-bar select,
[data-theme="light"] .tool-quick-bar .form-select,
[data-theme="light"] .tool-quick-bar .form-select-header {
  background-color: var(--bg-input, #f1f5f9);
  color: var(--text-main, var(--text-primary, #0f172a));
  border-color: var(--border-color, var(--border-subtle, #cbd5e1));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.tool-quick-bar select option {
  background-color: var(--bg-card, #131b2e);
  color: var(--text-main, var(--text-primary, #f8fafc));
}

[data-theme="light"] .tool-quick-bar select option {
  background-color: #ffffff;
  color: #0f172a;
}

.tool-quick-bar .header-control-group,
.tool-quick-bar .format-selector-wrapper {
  min-width: 0;
  max-width: 100%;
}

.tool-quick-bar .btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.tool-quick-bar .btn-text-desktop {
  display: inline !important;
}

.tool-quick-bar .btn-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
}

.tool-quick-bar .resolution-selector-wrapper {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

/* Barra inspectora de URLs (tarjetas) dentro de .tool-quick-bar */
.tool-quick-bar .url-inspect-bar {
  flex: 1 1 320px;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tool-quick-bar .url-inspect-input {
  flex: 1 1 0%;
  width: 0;
  min-width: 0;
}

/* HUD de rendimiento (json) dentro de .tool-quick-bar */
.tool-quick-bar .perf-hud {
  max-width: 100%;
  min-width: 0;
}

/* Responsive móvil y tablet compacta */
@media (max-width: 768px) {
  .tool-quick-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    margin-bottom: 1rem;
    gap: 0.65rem;
  }

  .tool-quick-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .tool-quick-actions {
    width: 100%;
    justify-content: stretch;
    gap: 0.5rem;
  }

  .tool-quick-actions>select,
  .tool-quick-actions>.header-control-group,
  .tool-quick-actions>.format-selector-wrapper,
  .tool-quick-bar .url-inspect-bar {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .tool-quick-actions>.header-control-group select,
  .tool-quick-actions>.format-selector-wrapper select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .tool-quick-actions>.btn:not(.btn-icon),
  .tool-quick-actions>.resolution-selector-wrapper {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 110px;
    justify-content: center;
  }

  .tool-quick-bar .resolution-selector-wrapper {
    display: flex !important;
    justify-content: space-between;
    padding: 0.25rem 0.5rem;
  }
}