
.problem-link,
.problem-link:hover {
  text-decoration: none;
}

.problem-link {
  display: block;
  width: 100%;
}

/* --- Responsive Layout --- */

/* Layout principal: container + filtros */
.page-content {
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-x: clip;
}

.main-content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

.container {
  /* Similar al blog: el contenido principal prioriza el espacio horizontal */
  flex: 3;
  min-width: 0;
}

/* Si no hay panel lateral visible, el listado ocupa todo el ancho */
.main-content > .container:only-child {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
}

.side-container {
  flex: 1;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .page-content {
    padding: 0 8px;
  }
  .main-content {
    flex-direction: column;
  }
  .container,
  .side-container {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0;
  }
  .problem-item {
    padding: 10px;
    margin-bottom: 14px;
  }
  .problem-title {
    font-size: 1.1em;
    word-break: break-word;
  }
  .problem-info {
    font-size: 1em;
    word-break: break-word;
  }
  .filter-container input[type="text"],
  .filter-container input[type="search"],
  .filter-container select,
  .filter-container button {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
  }
  .pagination {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .problem-title {
    font-size: 1em;
  }
  .problem-info {
    font-size: 0.97em;
  }
  .problem-item {
    padding: 7px;
  }
}

.problem-item {
    background-color: var(--mybackground);
    border: 1px solid var(--myborder, #e0e0e0);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.25s ease;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.problem-item-with-edit {
  padding-bottom: 52px;
}

.problem-title {
  font-size: 1.25em;
  margin-bottom: 6px;
  font-weight: 600;
  word-break: break-word;
  padding-right: 90px;
}

.problem-score {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--myborder, #d3d3d3);
  background: var(--mybackground, #ffffff);
  font-size: 0.9em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--mytext, #333333);
}

.problem-score-wrapper {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.problem-score-wrapper .problem-score {
  position: static;
}

.problem-random-indicator {
  font-size: 1em;
  line-height: 1;
}

.problem-info {
  font-size: 1.08em;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
  overflow-x: auto;
}

.problem-info ol {
  margin: 0.45em 0 0.75em;
  padding-left: 1.25em;
  list-style-position: outside;
}

.problem-info ol li {
  margin: 0.2em 0;
  padding-left: 0.1em;
}

.problem-info ol li::marker {
  content: counter(list-item, lower-alpha) ") ";
}

.problem-info dl.enumerate-enumitem {
  margin: 0.45em 0 0.75em;
}

.problem-info dl.enumerate-enumitem dt {
  float: left;
  clear: left;
  width: 2.1em;
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}

.problem-info dl.enumerate-enumitem dd {
  margin: 0 0 0.35em 2.1em;
  padding: 0;
}

.problem-info img,
.problem-info table,
.problem-info pre,
.problem-info code,
.problem-info svg,
.problem-info iframe {
  max-width: 100%;
}

.pagination {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 18px 0;
}

.problem-item:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: var(--myred, #800000);
}

.problem-edit-button,
.problem-edit-button:hover {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--myborder, #d3d3d3);
  background: var(--mybackground, #ffffff);
  color: var(--mytext, #333333);
  text-decoration: none;
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.problem-edit-button:hover {
  border-color: var(--myred, #800000);
  color: var(--myred, #800000);
}

.visibility-icon {
  position: absolute;
  right: 54px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--myborder, #d3d3d3);
  background: var(--mybackground, #ffffff);
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  padding: 0;
}

.visibility-icon-hidden {
  position: absolute;
  overflow: visible;
}

.visibility-icon-hidden::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 10%;
  width: 80%;
  height: 2px;
  background: var(--mytext, #333333);
  transform: translateY(-50%) rotate(-45deg);
  border-radius: 1px;
  pointer-events: none;
}

.visibility-dropdown {
  position: absolute;
  right: 54px;
  bottom: 50px;
  z-index: 100;
  background: var(--mybackground, #ffffff);
  border: 1px solid var(--myborder, #d3d3d3);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  min-width: 170px;
  overflow: hidden;
}

.visibility-dropdown-item {
  background: none;
  border: none;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.95em;
  cursor: pointer;
  color: var(--mytext, #333333);
  white-space: nowrap;
}

.visibility-dropdown-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  line-height: 1;
}

.visibility-dropdown-icon-hidden::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 8%;
  width: 84%;
  height: 2px;
  background: currentColor;
  transform: translateY(-50%) rotate(-45deg);
  border-radius: 1px;
  pointer-events: none;
}

.visibility-dropdown-item:hover {
  background: var(--myborder, #f0f0f0);
}

.visibility-dropdown-item--active {
  font-weight: 700;
  color: var(--myred, #800000);
}

.collection-add-wrapper {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 120;
}

.collection-add-wrapper-superuser {
  right: 96px;
}

.collection-add-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--myborder, #d3d3d3);
  background: var(--mybackground, #ffffff);
  color: var(--mytext, #333333);
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.collection-add-button:hover {
  border-color: var(--myred, #800000);
  color: var(--myred, #800000);
}

.collection-add-button:active,
.collection-add-button:focus-visible {
  border-color: var(--myred, #800000);
  color: var(--myred, #800000);
  outline: none;
  box-shadow: 0 0 0 3px rgba(128, 0, 0, 0.14);
}

@media (hover: none) and (pointer: coarse) {
  .collection-add-button:hover {
    border-color: var(--myborder, #d3d3d3);
    color: var(--mytext, #333333);
  }

  .collection-add-button:active {
    border-color: var(--myred, #800000);
    color: var(--myred, #800000);
  }
}

.collection-popover {
  position: absolute;
  right: 0;
  bottom: 44px;
  width: 260px;
  background: var(--mybackground, #ffffff);
  border: 1px solid var(--myborder, #d3d3d3);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  padding: 10px;
}

.collection-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--myborder, #d3d3d3);
  border-radius: 8px;
  padding: 7px 9px;
  margin-bottom: 8px;
}

.collection-classroom,
.collection-date {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--myborder, #d3d3d3);
  border-radius: 8px;
  padding: 7px 9px;
  margin-bottom: 8px;
  background: var(--mybackground, #ffffff);
  color: var(--mytext, #333333);
}

.collection-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.collection-option {
  width: 100%;
  border: 1px solid var(--myborder, #d3d3d3);
  background: var(--mybackground, #ffffff);
  color: var(--mytext, #333333);
  border-radius: 8px;
  text-align: left;
  padding: 6px 8px;
  font-size: 0.88em;
  cursor: pointer;
}

.collection-option:hover {
  border-color: var(--myred, #800000);
}

.collection-option:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.collection-option:disabled:hover {
  border-color: var(--myborder, #d3d3d3);
}

.collection-option-create {
  font-weight: 700;
}

.collection-option-empty {
  font-size: 0.88em;
  color: #777777;
  padding: 4px 2px;
}

.collection-status {
  position: absolute;
  right: 0;
  bottom: -24px;
  min-width: 190px;
  max-width: 240px;
  font-size: 0.8em;
  line-height: 1.2;
  color: #0f5132;
  background: #d1e7dd;
  border: 1px solid #badbcc;
  border-radius: 8px;
  padding: 4px 7px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.collection-status.collection-status-visible {
  opacity: 1;
  transform: translateY(0);
}

.collection-status.collection-status-error {
  color: #842029;
  background: #f8d7da;
  border-color: #f5c2c7;
}

.solution {
  display: none;
}

.advanced-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-container input[type="text"],
.filter-container input[type="search"],
.filter-container input:not([type]),
.filter-container select,
.filter-container button {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 1em;
  margin-bottom: 6px;
}

.advanced-field {
  display: flex;
}

.advanced-field-text {
  flex-direction: column;
  gap: 6px;
}

.advanced-field-text input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.advanced-field-check {
  align-items: center;
  gap: 8px;
}

.advanced-apply-button {
  margin-top: 4px;
  border: none;
  cursor: pointer;
}