/* Patch 115 — final alignment pass for ABSpass and contest assets. */

/* ----------------------------------------------------------
   Contest assets: the add form and the table must use the
   exact same three-column geometry. The action column is
   content-sized so the Russian "Добавить" label cannot be
   clipped by a hard 54px width.
   ---------------------------------------------------------- */
.contest-assets-page,
.contest-assets-add,
.contest-assets-table,
.contest-assets-row {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.contest-assets-add,
.contest-assets-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) max-content !important;
}

.contest-assets-add > *,
.contest-assets-row > * {
  min-width: 0;
}

.contest-assets-add button {
  width: auto !important;
  min-width: 92px !important;
  max-width: 100%;
  height: 42px !important;
  padding: 0 14px !important;
  white-space: nowrap;
  box-sizing: border-box;
}

.contest-assets-row .contest-assets-delete {
  width: 38px;
  min-width: 38px;
  max-width: 38px;
  justify-self: center;
}

/* ----------------------------------------------------------
   ABSpass toolbar: do not make the nested forms compete for
   the same grid width. The search form gets the flexible area,
   the add form gets a bounded area, and action buttons keep
   their natural width.
   ---------------------------------------------------------- */
.aurum-abspass-toolbar {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  overflow: hidden;
}

.aurum-abspass-toolbar form:first-child {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  align-items: center !important;
  gap: 7px !important;
}

.aurum-abspass-toolbar form:first-child input {
  width: 100% !important;
  min-width: 0 !important;
}

.aurum-abspass-toolbar form:nth-of-type(2) {
  flex: 0 1 280px !important;
  width: 280px !important;
  min-width: 150px !important;
  max-width: 280px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 7px !important;
}

.aurum-abspass-toolbar form:nth-of-type(2) input {
  width: 100% !important;
  min-width: 0 !important;
}

.aurum-abspass-toolbar form:first-child button,
.aurum-abspass-toolbar form:first-child a,
.aurum-abspass-toolbar form:nth-of-type(2) button,
.aurum-abspass-toolbar > button {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: max-content !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

@media (max-width: 1100px) {
  .aurum-abspass-toolbar form:nth-of-type(2) {
    flex-basis: 220px !important;
    width: 220px !important;
    max-width: 220px !important;
  }
}

@media (max-width: 900px) {
  .aurum-abspass-toolbar {
    flex-wrap: wrap !important;
    overflow: visible;
  }

  .aurum-abspass-toolbar form:first-child {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .aurum-abspass-toolbar form:nth-of-type(2) {
    flex: 1 1 260px !important;
    width: auto !important;
    max-width: none !important;
  }
}

@media (max-width: 620px) {
  .contest-assets-add,
  .contest-assets-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .contest-assets-add button {
    width: 100% !important;
    min-width: 0 !important;
  }

  .aurum-abspass-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .aurum-abspass-toolbar form:first-child,
  .aurum-abspass-toolbar form:nth-of-type(2) {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .aurum-abspass-toolbar > button {
    width: 100% !important;
  }
}
