/* modal overlay */
.list-modal {
  --modal-bg: #171717;
  --modal-surface: #1f1f1f;
  --modal-border: #2f2f2f;
  --modal-text: #f6f6f6;
  --modal-subtle: #a6a6a6;
  --modal-shadow: 0 24px 55px rgba(0, 0, 0, 0.55);
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

/* modal box */
.list-modal-content {
  background: linear-gradient(160deg, #202020 0%, var(--modal-bg) 90%);
  width: min(92vw, 390px);
  max-height: min(90vh, 760px);
  border-radius: 18px;
  border: 1px solid var(--modal-border);
  display: flex;
  flex-direction: column;
  color: var(--modal-text);
  box-shadow: var(--modal-shadow);
  animation: scaleIn 0.25s ease;
  overflow: hidden;
}

/* header */
.list-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--modal-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.list-modal-header h3 {
  margin: 0;
  color: var(--yellow);
  font-size: 1.05rem;
  letter-spacing: 0.2px;
}

.close-modal {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: #d4d4d4;
  border-radius: 999px;
  border: 1px solid #3a3a3a;
  background: rgba(255, 255, 255, 0.02);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease;
}

.close-modal:hover {
  color: #ffffff;
  border-color: #515151;
  background: rgba(255, 255, 255, 0.09);
  transform: rotate(90deg);
}

/* body */
.list-modal-body {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
}

.list-modal-body::-webkit-scrollbar {
  width: 8px;
}

.list-modal-body::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 8px;
}

.empty-lists {
  text-align: center;
  color: var(--modal-subtle);
  margin-top: 38px;
  font-size: 0.95rem;
}

/* list item */
.user-list {
  padding: 12px 14px;
  background: var(--modal-surface);
  color: #f7f7f7;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.user-list:hover {
  border-color: var(--yellow);
  background: #282828;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
}

.user-list:active {
  transform: translateY(0);
}

/* footer */
.list-modal-footer {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--modal-border);
}

.create-list-btn,
.create-list-form button[type="submit"] {
  width: 100%;
  padding: 11px 12px;
  border-radius: 999px;
  border: none;
  background: var(--yellow);
  color: #111;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.create-list-btn:hover,
.create-list-form button[type="submit"]:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.create-list-btn:active,
.create-list-form button[type="submit"]:active {
  transform: translateY(0);
}

.create-list-form {
  margin-top: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #343434;
  background: linear-gradient(180deg, #1d1d1d 0%, #181818 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.create-list-form input,
.create-list-form select {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #3a3a3a;
  background: #151515;
  color: #fff;
  font-size: 0.94rem;
}

.create-list-form input::placeholder {
  color: #8f8f8f;
}

.create-list-form input:invalid:not(:placeholder-shown) {
  border-color: #8f3535;
}

.create-list-form input:focus,
.create-list-form select:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 201, 54, 0.2);
}

.hidden {
  display: none;
}

#createListView {
  padding-top: 2px;
}

.create-list-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.create-list-label-row label {
  color: #d7d7d7;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.create-list-hint {
  margin: -4px 2px 2px;
  color: #979797;
  font-size: 0.78rem;
  line-height: 1.35;
}

.close-form-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #1f1f1f;
  border: 1px solid #3a3a3a;
  color: #d4d4d4;
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease;
}

.close-form-btn:hover {
  color: #fff;
  border-color: #555;
  background: #2b2b2b;
  transform: rotate(90deg);
}

.close-modal:active,
.close-form-btn:active {
  transform: scale(0.95);
}

.close-modal:focus-visible,
.close-form-btn:focus-visible,
.create-list-btn:focus-visible,
.create-list-form button[type="submit"]:focus-visible,
.user-list:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}


.user-list.disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}


/* animation */
@keyframes scaleIn {
  from {
    transform: translateY(8px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* responsive */
@media (max-width: 768px) {
  .list-modal {
    padding: 12px;
  }

  .list-modal-content {
    width: 100%;
    max-height: 84vh;
    border-radius: 16px;
  }

  .list-modal-header,
  .list-modal-body,
  .list-modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .list-modal-content,
  .user-list,
  .create-list-btn,
  .create-list-form button[type="submit"],
  .close-modal,
  .close-form-btn {
    animation: none;
    transition: none;
  }
}

