/* Header rojo: guest y sesion iniciada (todas las paginas) */
.App-header .Header-title,
.App-header .Header-title a,
.App-header .Header-controls .Button--link,
.App-header .Header-controls .Button--link:hover,
.App-header .Header-controls .Button--flat,
.App-header .SessionDropdown .Button--user,
.App-header .SessionDropdown .Button-label,
.App-header .SessionDropdown .username {
  color: #fff !important;
  font-weight: 700 !important;
}

.App-header .Search-input {
  color: #fff;
}

.App-header .Search-input .FormControl,
.App-header .Search-input input {
  color: #fff;
}

.App-header .Search-input input::placeholder,
.App-header .Search-input input::-webkit-input-placeholder {
  color: rgba(255, 255, 255, 0.9) !important;
  opacity: 1;
}

/* Campana: fondo blanco, icono en color primario */
.App-header .NotificationsDropdown > .Dropdown-toggle.Button {
  background: #fff !important;
  color: var(--primary-color, #e53935) !important;
  border-radius: 50%;
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
}

.App-header .NotificationsDropdown .Button-icon {
  color: var(--primary-color, #e53935) !important;
}

.App-header .NotificationsDropdown .Button-icon::before {
  color: inherit;
}

.App-header .NotificationsDropdown-unread {
  background: var(--primary-color, #e53935) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
}

.App-header .NotificationsDropdown.new > .Dropdown-toggle .Button-icon {
  color: var(--primary-color, #e53935) !important;
}

/* HEADER rojo: SIEMPRE icono + titulo + icono en BLANCO, en cualquier
   estado de navegacion (Alimentos, Tecnologia, etc.) y en el composer
   (X + titulo + enviar). Se tocan SOLO los controles del header (el hijo
   directo "> .Button"); NUNCA el menu de categoria ni el de etiquetas. */
@media (max-width: 767.98px) {
  .Navigation-drawer,
  .Navigation-drawer .Button-icon,
  .Navigation-drawer .Button-icon::before,
  .App-titleControl > .Button,
  .App-titleControl > .Button .Button-label,
  .App-titleControl > .Button .Button-icon,
  .App-titleControl > .Button .Button-icon::before,
  .App-titleControl--text,
  .App-primaryControl > .Button,
  .App-primaryControl > .Button .Button-icon,
  .App-primaryControl > .Button .Button-icon::before,
  .App-backControl > .Button,
  .App-backControl > .Button .Button-icon,
  .App-backControl > .Button .Button-icon::before {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    opacity: 1 !important;
  }

  .App-titleControl > .Button .Button-caret {
    border-top-color: #fff !important;
  }

  .Composer.minimized .ComposerBody-header h3,
  .Composer.minimized .ComposerBody-header h3 input {
    color: var(--text-color) !important;
    -webkit-text-fill-color: var(--text-color) !important;
  }
}

/* Ubicacion en el composer: debajo del titulo. */
.ComposerBody-header > li.item-ubicacionForm,
.ComposerBody-header > li.item-empresaSelector {
  display: block;
}

/* Web (escritorio): aire entre tags, titulo y los dropdowns del composer.
   En mobile (<768px) se deja como esta, que es aceptable. */
@media (min-width: 768px) {
  .ComposerBody--discussion .ComposerBody-header > li {
    margin-bottom: 14px;
  }
  .ComposerBody--discussion .ComposerBody-header > li:last-child {
    margin-bottom: 0;
  }
}

.ComposerUbicacion {
  margin-top: 8px;
  pointer-events: auto;
}

.ComposerUbicacion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 8px;
}

.ComposerUbicacion-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 calc(50% - 16px);
  min-width: 240px;
}

.ComposerUbicacion-label {
  color: var(--control-color);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.ComposerUbicacion-required {
  color: var(--primary-color);
  font-weight: 700;
}

.ComposerUbicacion-field--error .ts-control,
.ComposerUbicacion-field--error .DireccionRow-input {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 1px var(--primary-color);
}

.ComposerUbicacion-select {
  flex: 1 1 auto;
  min-width: 0;
}

.DireccionRow-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
}

.ComposerUbicacion-field .ts-wrapper,
.EmpresaRow .ts-wrapper {
  width: 100%;
  margin: 0;
}

.ComposerUbicacion-field .ts-control,
.EmpresaRow .ts-control {
  display: flex !important;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  background: var(--control-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--border-radius);
  color: var(--text-color) !important;
  box-shadow: none !important;
  min-height: 36px;
  cursor: pointer;
}

.ComposerUbicacion-field .ts-wrapper.focus .ts-control,
.EmpresaRow .ts-wrapper.focus .ts-control {
  border-color: var(--primary-color) !important;
}

/* Foco rojo en TODOS los campos del composer (titulo, direccion y editor del
   cuerpo), para igualar el de empresa/depto/municipio. Web y mobile.
   Usamos box-shadow (anillo) para no mover el layout. */
.ComposerBody--discussion .ComposerBody-header h3 input:focus,
.ComposerBody--discussion .DireccionRow-input:focus,
.ComposerBody--discussion .TextEditor-editor:focus {
  outline: none !important;
  box-shadow: 0 0 0 1px var(--primary-color) !important;
  border-radius: var(--border-radius);
}

.ComposerUbicacion-field .ts-control input,
.ComposerUbicacion-field .ts-control .item,
.EmpresaRow .ts-control input,
.EmpresaRow .ts-control .item {
  color: var(--text-color) !important;
}

/* Chip seleccionado: "Nombre ×" en una sola linea */
.ComposerUbicacion-field .ts-control .item,
.EmpresaRow .ts-control .item {
  display: inline-flex !important;
  align-items: center;
  flex: 0 1 auto;
  max-width: 100%;
  margin: 0 !important;
  padding: 0 4px !important;
  background: transparent !important;
  border: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ComposerUbicacion-field .ts-control .item .Empresa-remove,
.EmpresaRow .ts-control .item .Empresa-remove,
.ComposerUbicacion-field .ts-control .item .remove,
.ComposerUbicacion-field .ts-control .item .remove-single,
.EmpresaRow .ts-control .item .remove,
.EmpresaRow .ts-control .item .remove-single {
  flex-shrink: 0;
  margin-left: 6px;
  padding: 0 2px;
  color: #ff4d4f !important;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none !important;
  opacity: 1 !important;
  cursor: pointer;
}

.ComposerUbicacion-field .ts-control .item .Empresa-remove:hover,
.EmpresaRow .ts-control .item .Empresa-remove:hover,
.ComposerUbicacion-field .ts-control .item .remove:hover,
.ComposerUbicacion-field .ts-control .item .remove-single:hover,
.EmpresaRow .ts-control .item .remove:hover,
.EmpresaRow .ts-control .item .remove-single:hover {
  color: #ff4d4f !important;
  opacity: 1 !important;
}

/* Sin seleccion: solo placeholder, sin X */
.ComposerUbicacion-field .ts-control .items-placeholder,
.EmpresaRow .ts-control .items-placeholder {
  flex: 1 1 auto;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  padding: 0 4px !important;
  margin: 0 !important;
  pointer-events: none;
}

.ComposerUbicacion-field .ts-control .items-placeholder::placeholder,
.EmpresaRow .ts-control .items-placeholder::placeholder {
  color: var(--control-color);
  opacity: 1;
}

.ComposerUbicacion-field .ts-control:has(.item[data-value]) .items-placeholder,
.EmpresaRow .ts-control:has(.item[data-value]) .items-placeholder {
  display: none !important;
}

.ComposerUbicacion-field .ts-wrapper.single .ts-control:after,
.EmpresaRow .ts-wrapper.single .ts-control:after {
  border-color: var(--control-color) transparent transparent transparent !important;
}

.ComposerUbicacion-field .ts-dropdown,
.EmpresaRow .ts-dropdown {
  background: var(--body-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--border-radius);
  color: var(--text-color) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  margin-top: 4px;
}

.ComposerUbicacion-field .ts-dropdown-content,
.EmpresaRow .ts-dropdown-content {
  max-height: 220px;
  overflow-y: auto;
}

.ComposerUbicacion-field .ts-dropdown .option,
.EmpresaRow .ts-dropdown .option {
  color: var(--text-color);
  padding: 7px 10px;
  font-size: 14px;
}

.ComposerUbicacion-field .ts-dropdown .active,
.EmpresaRow .ts-dropdown .active {
  background: var(--body-bg-light) !important;
  color: var(--text-color) !important;
}

.ComposerUbicacion-field .ts-dropdown .no-results,
.ComposerUbicacion-field .ts-dropdown .spinner,
.EmpresaRow .ts-dropdown .no-results,
.EmpresaRow .ts-dropdown .spinner {
  color: var(--muted-more-color);
  padding: 7px 10px;
}

/* Buscador con lupa (solo visible con dropdown abierto) */
.ComposerUbicacion-field .ts-dropdown .dropdown-input-wrap,
.EmpresaRow .ts-dropdown .dropdown-input-wrap {
  position: relative;
  padding: 6px 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ComposerUbicacion-field .ts-dropdown .dropdown-input-wrap::before,
.EmpresaRow .ts-dropdown .dropdown-input-wrap::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  opacity: 0.55;
  pointer-events: none;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
}

.ComposerUbicacion-field .ts-dropdown .dropdown-input,
.EmpresaRow .ts-dropdown .dropdown-input {
  background: var(--control-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius);
  color: var(--text-color);
  padding: 7px 10px 7px 32px;
  width: 100%;
  box-sizing: border-box;
}

.ComposerUbicacion-field .ts-dropdown .dropdown-input::placeholder,
.EmpresaRow .ts-dropdown .dropdown-input::placeholder {
  color: var(--control-color);
  opacity: 1;
}

.ComposerUbicacion-field .ts-wrapper.loading .ts-control,
.EmpresaRow .ts-wrapper.loading .ts-control {
  opacity: 0.75;
}

/* NOTA: el layout del hero (logo + empresa + etiquetas + título + subline) lo
   maneja ahora media.css con un grid. Las reglas viejas (flex centrado con
   .badges centradas) se quitaron porque peleaban con el grid y creaban un hueco
   entre el nombre y las etiquetas. */
.DiscussionHero .DiscussionHero-items .TagLabel {
  vertical-align: middle;
}

/* Empresa: gradiente del diseño, tamaño parecido a los tags, misma linea */
.DiscussionHero .DiscussionHero-empresa {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 5px 14px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  border-radius: 6px;
  color: #fff;
  white-space: nowrap;
  background: linear-gradient(180deg, #00a341 0%, #008f39 100%);
  border: 1px solid #007a30;
}

.DiscussionHero--colored .DiscussionHero-empresa {
  color: #fff;
  background: linear-gradient(180deg, #00a341 0%, #008f39 100%);
  border-color: #007a30;
}

/* Listado: "Empresa - Titulo" con el mismo estilo del titulo */
.DiscussionListItem-empresaPrefix {
  font-weight: inherit;
  color: inherit;
}

/* Tags en la tarjeta: mas ancho, sin recorte ni fade (Flarum limita a 150px) */
@media (min-width: 768px) {
  .IndexPage .DiscussionListItem-info > .item-tags,
  .UserPage .DiscussionListItem-info > .item-tags {
    max-width: 260px !important;
    overflow: visible !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }

  .IndexPage .DiscussionListItem-title,
  .UserPage .DiscussionListItem-title {
    margin-right: 270px;
  }
}

/* Filtros en portada: empresa/departamento/municipio */
.IndexPage-toolbar .IndexFiltersBar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  margin-left: 14px;
}

.IndexPage-toolbar-view {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.IndexPage-toolbar-view > li.item-locationFilters {
  margin-left: 0 !important;
}

.IndexFiltersBar-item {
  min-width: 170px;
  max-width: 170px;
}

.IndexFiltersBar-item .ts-wrapper {
  width: 100%;
  position: relative;
  z-index: 8;
}

.IndexFiltersBar-item .ts-control {
  min-height: 36px;
  height: 36px;
  max-height: 36px;
  line-height: 20px;
  padding: 8px 32px 8px 13px !important;
  background: var(--button-bg) !important;
  border: 0 !important;
  border-radius: var(--border-radius) !important;
  color: var(--button-color) !important;
  box-shadow: none !important;
}

.IndexFiltersBar-item .ts-control input,
.IndexFiltersBar-item .ts-control .item,
.IndexFiltersBar-item .ts-control .items-placeholder,
.IndexFiltersBar-item .ts-control .items-placeholder::placeholder {
  color: var(--button-color) !important;
  opacity: 1 !important;
}

.IndexFiltersBar-item .ts-control > input::placeholder {
  color: var(--button-color) !important;
  opacity: 1 !important;
}

/* Flechita (caret) del dropdown, como el de "Lo ultimo". El TomSelect de
   este proyecto no la trae de base, asi que la dibujamos completa aqui.
   Aplica en web y mobile (sin media query). */
.IndexFiltersBar-item .ts-wrapper.single .ts-control:after {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-style: solid;
  border-width: 5px 5px 0 5px;
  border-color: var(--button-color) transparent transparent transparent;
  pointer-events: none;
}

/* Cuando ya hay una opcion elegida aparece la "x" para limpiar:
   ocultamos la flecha para que no se encimen. */
.IndexFiltersBar-item .ts-wrapper.single.has-items .ts-control:after {
  display: none;
}

.IndexFiltersBar-item .ts-wrapper.focus .ts-control,
.IndexFiltersBar-item .ts-control:hover {
  background: var(--button-bg-hover) !important;
}

.IndexFiltersBar-item .ts-control input {
  background: transparent !important;
  border: 0 !important;
}

.IndexFiltersBar-item .ts-control .item {
  margin: 0 !important;
  padding: 0 0 0 1px !important;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.IndexFiltersBar-item .ts-control .item .Empresa-remove {
  margin-left: 8px !important;
  padding: 0 2px;
  color: #ff4d4f !important;
  font-size: 16px;
  line-height: 1;
}

.IndexFiltersBar-item .ts-control .item .remove,
.IndexFiltersBar-item .ts-control .item .remove-single {
  margin-left: 8px !important;
  color: #ff4d4f !important;
  font-size: 16px !important;
  line-height: 1 !important;
  opacity: 1 !important;
  text-decoration: none !important;
  font-weight: 700 !important;
}

.IndexFiltersBar-item .ts-control .clear-button,
.IndexFiltersBar-item .ts-control .clear-button:hover {
  color: #ff4d4f !important;
  opacity: 1 !important;
  font-size: 16px !important;
  margin-right: 2px !important;
}

.IndexFiltersBar-item .ts-dropdown {
  background: var(--body-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: var(--text-color) !important;
  z-index: 30 !important;
  border-radius: var(--border-radius) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45) !important;
}

.IndexFiltersBar-item .ts-dropdown-content {
  max-height: 240px;
  overflow-y: auto;
  background: var(--body-bg) !important;
}

.IndexFiltersBar-item .ts-dropdown .option {
  color: var(--text-color) !important;
  background: transparent !important;
  padding: 8px 12px;
}

.IndexFiltersBar-item .ts-dropdown .active,
.IndexFiltersBar-item .ts-dropdown .option.active,
.IndexFiltersBar-item .ts-dropdown .option:hover {
  background: var(--body-bg-light) !important;
  color: var(--text-color) !important;
}

.IndexFiltersBar-item .ts-dropdown .dropdown-input-wrap {
  position: relative;
  padding: 6px 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.IndexFiltersBar-item .ts-dropdown .dropdown-input-wrap::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  opacity: 0.55;
  pointer-events: none;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
}

.IndexFiltersBar-item .ts-dropdown .dropdown-input {
  background: var(--control-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius);
  color: var(--text-color) !important;
  padding: 7px 10px 7px 32px;
  width: 100%;
  box-sizing: border-box;
}

.IndexFiltersBar-item .ts-dropdown .dropdown-input::placeholder {
  color: var(--control-color) !important;
  opacity: 1;
}

.IndexFiltersBar-item .ts-dropdown .no-results,
.IndexFiltersBar-item .ts-dropdown .spinner {
  color: var(--muted-more-color) !important;
  padding: 8px 12px;
  background: transparent !important;
}

@media (max-width: 1100px) {
  .IndexPage-toolbar .IndexFiltersBar {
    flex-wrap: wrap;
    margin-left: 0;
    margin-top: 8px;
  }

  .IndexFiltersBar-item {
    min-width: 210px;
    max-width: 210px;
  }
}

/* Movil: composer — barra roja con X, titulo y enviar en blanco */
@media (max-width: 767.98px) {
  .Composer.normal:not(.minimized) .Composer-controls li.App-backControl > .Button,
  .Composer.normal:not(.minimized) .Composer-controls li.App-backControl .Button-icon,
  .Composer.normal:not(.minimized) .Composer-controls li.App-backControl .Button-icon::before {
    color: #fff !important;
    opacity: 1 !important;
  }

  .Composer.normal:not(.minimized) .ComposerBody-header > li:first-child,
  .Composer.normal:not(.minimized) .ComposerBody-header > li:first-child h3 {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-weight: 600;
    opacity: 1 !important;
  }

  .Composer.normal:not(.minimized) .ComposerBody-editor .TextEditor-controls li.item-submit.App-primaryControl > .Button,
  .Composer.normal:not(.minimized) .ComposerBody-editor .TextEditor-controls li.item-submit.App-primaryControl .Button-icon,
  .Composer.normal:not(.minimized) .ComposerBody-editor .TextEditor-controls li.item-submit.App-primaryControl .Button-icon::before {
    color: #fff !important;
    background: transparent !important;
    box-shadow: none !important;
    opacity: 1 !important;
  }

  /* Composer: mas alto; scroll solo en campos (no en la barra de titulo) */
  .Composer:not(.minimized) {
    height: 100% !important;
    max-height: 100dvh !important;
  }

  .Composer:not(.minimized) .Composer-content,
  .Composer:not(.minimized) .ComposerBody,
  .Composer:not(.minimized) .ComposerBody-content,
  .Composer:not(.minimized) .ComposerBody-header {
    overflow: visible;
  }

  .ComposerUbicacion-row {
    flex-direction: column;
    gap: 10px;
  }

  .ComposerUbicacion-field {
    flex: 1 1 100%;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .ComposerUbicacion-label {
    white-space: normal;
  }

  .ComposerBody-header > li {
    padding: 10px 12px;
  }

  .Composer.normal:not(.minimized) .ComposerBody-header > li:first-child {
    margin: calc(0px - var(--header-height-phone)) 44px 0 !important;
    overflow: visible;
    width: auto;
    z-index: calc(var(--zindex-header) + 2);
  }

  .Composer.normal:not(.minimized) .ComposerBody-header > li:first-child h3 {
    width: 100%;
    text-align: center;
    overflow: visible;
    text-overflow: clip;
  }

  .ComposerBody-editor {
    padding: 10px 12px 16px;
  }

  /* Filtros portada: una columna, ancho completo */
  .IndexPage-toolbar {
    margin-bottom: 12px;
  }

  .IndexPage-toolbar-view {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }

  .IndexPage-toolbar-view > li {
    display: block;
    width: 100%;
    margin-right: 0 !important;
  }

  .IndexPage-toolbar .IndexFiltersBar {
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin-top: 0;
  }

  .IndexFiltersBar-item {
    min-width: 100%;
    max-width: 100%;
  }

  .IndexFiltersBar-item .ts-control {
    height: auto;
    max-height: none;
    min-height: 40px;
  }
}
