@layer pages {
/* Problems page */

.problem-link {
  cursor: pointer;
  text-decoration: none;
  color: var(--neutral-900) !important;
}

.problem-box-text {
  padding-top: 8px;
}

.problem-box-text a {
  color: white;
  text-decoration: underline;
}

[data-problem-status='problem'] {
  background-color: var(--status-problem);
  color: var(--neutral-900);
}

[data-problem-status='workaround_found'] {
  background-color: var(--status-workaround_found);
  color: var(--neutral-900);
}

[data-problem-status='solution_found'] {
  background-color: var(--status-solution_found);
  color: var(--neutral-900);
}

.with-images + .select2-container .select2-selection--single {
  min-height: 34px;
  max-height: 34px;
  overflow-y: auto;
}

.problems-filter {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 1200px;
  margin: 0 0 1rem;
}

.problems-filter__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  width: 100%;
}

.problems-filter__header .problems__header {
  margin-bottom: 0;
  padding-bottom: 0;
}

.problems-filter__body {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) minmax(14rem, 28rem);
  gap: 0.5rem;
  align-items: center;
}

.problems-filter__status,
.problems-filter__client {
  min-width: 0;
}

.problems-filter__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--neutral-50);
  font-size: var(--font-size-sm);
  font-family: var(--font-family-sans-serif);
  font-weight: 500;
  background-color: var(--neutral-50);
  color: var(--neutral-700);
  padding: 0;
  border-radius: 50%;
  box-shadow: var(--button-shadow);
  cursor: pointer;
}

.problems-filter__toggle[aria-expanded="true"] {
  border-color: var(--color-border-dark);
  background-color: var(--control-surface-color);
}

.problems-filter__toggle:hover {
  background-color: var(--surface-color-muted);
  border-color: var(--color-border-darker);
  color: var(--neutral-800);
}

.problems-filter__toggle--active,
.problems-filter__toggle--active:hover {
  background-color: var(--color-selected);
  border-color: var(--color-selected-dark);
  color: var(--primary-700);
}

.problems-filter__toggle .svg-icon {
  margin-right: 0;
}

.problems-filter__toggle .svg-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

#problems_opened td:first-child,
table.problems td:first-child {
  width: 100px;
  text-align: right;
}

span.problem,
span.problem-status {
  padding: 0 8px;
  color: var(--neutral-900);
  font-size: 96%;
}

.high > td:first-child { background-color: var(--priority-high); }
.medium > td:first-child { background-color: var(--priority-medium); }
.low > td:first-child { background-color: var(--priority-low); }
.urgent > td:first-child { background-color: var(--priority-urgent); }

.high > td:first-child,
.medium > td:first-child,
.low > td:first-child,
.urgent > td:first-child {
  color: var(--neutral-900);
}

.high > td:first-child a,
.medium > td:first-child a,
.low > td:first-child a,
.urgent > td:first-child a {
  color: var(--neutral-900);
}

.priority {
  font-weight: 800;
  color: var(--neutral-900);
}

.frame--problems {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.9375rem;
}

.problem {
  font-size: var(--font-size-sm);
  display: grid;
  column-gap: 0.625rem;
  row-gap: 0.375rem;
  padding: 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--color-border-dark);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  grid-template-columns: 1.875rem 8.5rem minmax(7rem, 9rem) minmax(9rem, 12rem) minmax(20rem, 1fr) 4.5rem auto;
  grid-template-rows: 1fr 1.25rem;
  grid-template-areas:
    "assigned-to id client service description sla priority"
    "assigned-to status client service description sla priority";
}

.problem:hover {
  transform: translateY(-1px);
  border-color: var(--color-border-darker);
  box-shadow: var(--shadow-card);
}

.problem__assigned-to {
  grid-area: assigned-to;
}

.problem__id {
  grid-area: id;
  min-width: 0;
}

.problem__client {
  grid-area: client;
  align-self: center;
  min-width: 0;
  color: var(--primary-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.problem__service {
  grid-area: service;
  align-self: center;
  min-width: 0;
  color: var(--neutral-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.problem__description {
  grid-area: description;
  align-self: center;
  min-width: 0;
  color: var(--neutral-800);
  line-height: 1.4;
}

.problem__description--truncated {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 100%;
}

.problem__status {
  grid-area: status;
  align-self: center;
  white-space: nowrap;
}

.problem__priority {
  grid-area: priority;
  align-self: center;
  justify-self: end;
  white-space: nowrap;
}

.problem__sla {
  grid-area: sla;
  align-self: center;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.problem--card {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--shadow-color);
  justify-content: space-between;
  box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.problem--card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1);
}

.problem--sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.problem__header {
  font-size: 100%;
  font-weight: bold;
  flex-basis: 50px;
}

.problem__meta {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-width: 5.625rem;
}

.problem-incidents {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.problem-incidents .ticket {
  border: 1px solid var(--shadow-color);
  border-radius: 8px;
  padding: 0.625rem;
  grid-template-columns: 1.875rem 5.625rem 12.5rem;
  grid-template-rows: 1fr 1.25rem;
  grid-template-areas:
    "assigned-to id employee"
    "assigned-to status description";
}

.problem-incidents .ticket__date {
  display: none;
}

.problem-incidents .ticket__sla {
  display: none;
}

.problem-incidents .ticket__service {
  display: none;
}

.problem-incidents .ticket__client {
  display: none;
}

.problems {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.problem-details {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.problem-details__header {
  font-size: 1.25rem;
  color: var(--neutral-500);
}

@media (max-width: 768px) {
  .problems-filter__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .priority {
    padding: 0.125rem 0.5rem;
    height: 1.25rem;
    font-size: 0.7rem !important;
  }

  .problem {
    grid-template-columns: 2rem minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
      "assigned-to id status"
      "assigned-to service priority"
      "description description description" !important;
    column-gap: 0.625rem;
    row-gap: 0.375rem;
    align-items: center;
    padding: 0.875rem;
  }

  .problem__client,
  .problem__sla {
    display: none;
  }

  .problem__assigned-to {
    grid-area: assigned-to;
    align-self: start;
    padding-top: 0.25rem;
  }

  .problem__id {
    grid-area: id;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .problem__status {
    grid-area: status;
    justify-self: end;
    text-align: right;
  }

  .problem__service {
    grid-area: service;
    font-size: 0.75rem;
    color: var(--neutral-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 100%;
  }

  .problem__priority {
    grid-area: priority;
    justify-self: end;
    text-align: right;
  }

  .problem__description {
    grid-area: description;
    min-width: 0;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--neutral-800);
    margin-top: 0.25rem;
  }
  
  .problem__description--truncated {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
    overflow: hidden;
  }
}
}
