/* Accesibilidad */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Cabecera: acciones usuario logueado */
.header-actions-logged {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-right: 6px;
}

.header-action-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--color-header-btn-dos-text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.1;
  transition: color 0.15s ease;
}

.header-action-link i {
  font-size: 1.35rem;
  color: inherit;
}

.header-action-link span {
  white-space: nowrap;
}

.header-action-link:hover {
  color: var(--color-header-btn-dos-hover);
}

.header-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-accent);
  font-family: 'Poppins', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
}

.header-user-avatar:hover {
  filter: brightness(1.05);
}

.header-user-avatar--photo {
  padding: 0;
  overflow: hidden;
  background: var(--color-border-light);
}

.header-user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-greeting--hidden {
  display: none !important;
}

/* Barra de búsqueda tipo pill */
.header-search-wrap {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  margin: 0 12px;
}

.header-search-pill {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border-radius: 999px;
  border: 1px solid var(--color-border-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: visible;
  min-height: 38px;
}

.header-search-categoria {
  /* Ancho fijo respecto al pill: si no, al cargar opciones largas por AJAX el <select> cambia de tamaño */
  flex: 0 0 42%;
  width: 42%;
  min-width: 120px;
  max-width: 42%;
  box-sizing: border-box;
  padding: 5px 10px 5px 14px;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--color-text-dark);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7060' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  outline: none;
}

.header-search-categoria:focus,
.header-search-categoria:focus-visible,
.header-search-categoria:active {
  outline: none;
  box-shadow: none;
  border: none;
}

.header-search-divider {
  width: 1px;
  align-self: stretch;
  min-height: 22px;
  background: var(--color-input-border);
  flex-shrink: 0;
}

.header-search-input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  max-width: none;
  display: flex;
  align-items: center;
  align-self: stretch;
}

.header-search-input-wrap input#header-search {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 0;
  font-size: 0.95rem;
  line-height: 34px;
  outline: none;
  background: transparent;
  box-shadow: none;
  vertical-align: middle;
}

.header-search-input-wrap input#header-search:focus {
  box-shadow: none;
}

.header-search-submit {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  margin: 2px;
  align-self: center;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s ease;
}

.header-search-submit:hover {
  filter: brightness(1.08);
}

.header-search-submit i {
  font-size: 1rem;
}

/* Resultados bajo el input (+10px solo hacia la derecha) */
.header-search-input-wrap .search-results {
  left: 0;
  right: auto;
  width: calc(100% + 10px);
  box-sizing: border-box;
  margin-top: 1px;
}

/* Carrito pill con total */
.btn-cart-header-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  overflow: visible;
  padding: 3px 8px 3px 12px;
  min-width: 9rem;
  min-height: 38px;
  box-sizing: border-box;
  background: var(--color-accent);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  text-decoration: none;
  color: var(--color-header-icono);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn-cart-header-pill:hover {
  filter: brightness(1.06);
}

.cart-header-total {
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  min-width: 4.2rem;
  display: inline-block;
  text-align: right;
  flex: 0 0 auto;
}

.cart-header-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}

.btn-cart-header-pill .cart-header-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
  color: inherit;
}

.cart-header-icon-wrap .cart-badge {
  position: absolute;
  top: -16px;
  left: auto;
  right: -13px;
  transform: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  max-width: 20px;
  padding: 0;
  border-radius: 50%;
  background-color: var(--color-cart-badge);
  color: var(--color-surface);
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--color-accent);
  box-sizing: border-box;
  line-height: 1;
  z-index: 1;
}

.cart-badge--hidden {
  display: none !important;
}

/* Barra inferior de carrito (solo móvil; ver responsive.css) */
.cart-mobile-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 10px 12px;
  background: #14532d;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  box-sizing: border-box;
}

.cart-mobile-bar.is-hidden {
  display: none !important;
}

.cart-mobile-bar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cart-mobile-bar__count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  color: #14532d;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  box-sizing: border-box;
}

.cart-mobile-bar__total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cart-mobile-bar__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.cart-mobile-bar__cta i {
  font-size: 0.85rem;
}

@media (max-width: 1024px) {
  .cart-mobile-bar:not(.is-hidden) {
    display: flex;
  }
}

@media (min-width: 1025px) {
  .cart-mobile-bar {
    display: none !important;
  }
}

/* Legado: botón carrito circular (otros temas) */
.btn-cart-header {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-input-border);
  border-radius: 999px;
  cursor: pointer;
}

.drawer-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.drawer-logout-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.drawer-quick-links {
  margin-top: 10px;
}

.header-grupo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 220px;
}

.header-grupo-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-header-btn-dos-text);
  white-space: nowrap;
}

.header-grupo-select,
.drawer-grupo-select {
  width: 100%;
  max-width: 180px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-input-border);
  background: var(--color-surface);
  font-size: 0.82rem;
}

.drawer-grupo-wrap {
  padding: 12px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-grupo-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
}

.grupo-select-modal .modal-content.grupo-select-modal-content {
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
  padding: 24px 20px;
}

.grupo-select-modal-text {
  margin-bottom: 16px;
  color: #4b5563;
  font-size: 0.95rem;
  line-height: 1.45;
}

.grupo-select-modal-field {
  text-align: left;
  margin-bottom: 12px;
}

.grupo-select-modal-select {
  width: 100%;
  min-height: 42px;
  font-size: 0.95rem;
}

.grupo-select-modal-hint {
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: #6b7280;
  text-align: left;
}

.grupo-select-modal-confirm {
  width: 100%;
  min-height: 44px;
}

.grupo-select-modal-confirm:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 992px) {
  .header-grupo-wrap {
    display: none;
  }
}

@media (min-width: 993px) {
  .drawer-grupo-wrap {
    display: none;
  }
}
