/* settings-bg.css: Styles for background selection and modal */

.bg-selector-container {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.bg-thumb {
  display: flex;
  align-items: center;
  cursor: pointer;
  border: 2px solid var(--settings-modal-border, #2e2640);
  border-radius: 8px;
  padding: 0.2rem 0.7rem 0.2rem 0.2rem;
  background: var(--settings-modal-bg-lighter, #231b33);
  transition: border 0.2s;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}
.bg-thumb.selected, .bg-thumb:focus {
  border: 2px solid var(--settings-modal-primary, #9147ff);
  outline: none;
}
.bg-thumb img {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  background: #232323;
}
.bg-name {
  font-size: 1rem;
  color: var(--settings-modal-text, #fff);
  font-weight: 500;
}
.bg-edit {
  margin-left: 0.5rem;
  color: var(--settings-modal-text-tertiary, #aaa);
}

/* Modal Overlay */
.bg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,11,21,0.82);
  backdrop-filter: blur(2.5px);
  z-index: 2002;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.23s cubic-bezier(.5,.1,.5,1);
}
.bg-modal-overlay.open {
  opacity: 1;
  animation: bgModalFadeIn 0.25s cubic-bezier(.5,.1,.5,1);
}
@keyframes bgModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.bg-modal {
  background: var(--settings-modal-bg, #1a1525);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  padding: 2rem 2.5rem 1.5rem 2.5rem;
  min-width: 340px;
  max-width: 98vw;
  max-height: 90vh;
  overflow-y: auto;
  color: var(--settings-modal-text, #fff);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transform: translateY(32px) scale(0.98);
  opacity: 0;
  transition: all 0.22s cubic-bezier(.5,.1,.5,1);
}
.bg-modal-overlay.open .bg-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bg-modal-list {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.3rem;
}
.bg-modal-item {
  background: var(--settings-modal-bg-lighter, #231b33);
  border-radius: 12px;
  padding: 0.7rem 0.7rem 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border 0.2s, box-shadow 0.2s, transform 0.18s;
  min-width: 100px;
  max-width: 140px;
  box-shadow: 0 2px 10px 0 rgba(0,0,0,0.10);
  position: relative;
}
.bg-modal-item:not(.locked):hover,
.bg-modal-item:not(.locked):focus {
  border: 2px solid var(--settings-modal-primary, #9147ff);
  box-shadow: 0 4px 18px 0 rgba(145,71,255,0.10);
  transform: translateY(-2px) scale(1.025);
  z-index: 2;
}
.bg-modal-item.selected {
  border: 2.5px solid var(--settings-modal-primary, #9147ff);
  box-shadow: 0 4px 18px 0 rgba(145,71,255,0.14);
}
.bg-modal-thumb-wrapper {
  position: relative;
  width: 86px;
  height: 60px;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bg-modal-thumb {
  width: 86px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  background: #232323;
  box-shadow: 0 1px 5px 0 rgba(0,0,0,0.11);
}
.bg-modal-selected-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: linear-gradient(90deg,#9147ff 60%,#a970ff 100%);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 2px 8px 0 rgba(145,71,255,0.18);
  border: 2px solid #fff3;
  animation: badgePop 0.28s cubic-bezier(.5,.1,.5,1);
}
@keyframes badgePop {
  0% { transform: scale(0.5); opacity: 0; }
  80% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.bg-modal-item.locked {
  opacity: 0.58;
  pointer-events: none;
  position: relative;
}
.bg-modal-locked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(30,20,40,0.72);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.04rem;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  z-index: 3;
  transition: background 0.2s;
}
.bg-modal-name {
  font-size: 1.05rem;
  color: var(--settings-modal-text, #fff);
  margin-bottom: 0.1rem;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.bg-modal-close {
  background: var(--settings-modal-primary, #9147ff);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  font-size: 1.08rem;
  font-weight: 500;
  cursor: pointer;
  margin: 0 auto;
  margin-top: 0.6rem;
  transition: background 0.2s;
  box-shadow: 0 2px 8px 0 rgba(145,71,255,0.10);
}
.bg-modal-close:hover {
  background: var(--settings-modal-primary-light, #a970ff);
}
@media (max-width: 600px) {
  .bg-modal {
    padding: 1.2rem 0.4rem 1rem 0.4rem;
    min-width: 0;
  }
  .bg-modal-thumb, .bg-modal-thumb-wrapper {
    width: 60px;
    height: 40px;
  }
  .bg-modal-item {
    min-width: 70px;
    max-width: 90px;
    padding: 0.4rem 0.4rem 0.3rem 0.4rem;
  }
  .bg-modal-selected-badge {
    width: 20px;
    height: 20px;
    font-size: 1rem;
    right: 2px;
    bottom: 2px;
  }
}

.bg-modal {
  background: var(--settings-modal-bg, #1a1525);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  padding: 2rem 2.5rem 1.5rem 2.5rem;
  min-width: 340px;
  max-width: 98vw;
  max-height: 90vh;
  overflow-y: auto;
  color: var(--settings-modal-text, #fff);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.bg-modal h3 {
  margin-top: 0;
  margin-bottom: 1.2rem;
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
}
.bg-modal-list {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.3rem;
}
.bg-modal-item {
  background: var(--settings-modal-bg-lighter, #231b33);
  border-radius: 8px;
  padding: 0.5rem 0.7rem 0.4rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border 0.2s;
  min-width: 90px;
  max-width: 120px;
}
.bg-modal-item.selected {
  border: 2px solid var(--settings-modal-primary, #9147ff);
}
.bg-modal-item.locked {
  opacity: 0.5;
  pointer-events: none;
  position: relative;
}
.bg-modal-item img {
  width: 80px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: #232323;
}
.bg-modal-name {
  font-size: 1rem;
  color: var(--settings-modal-text, #fff);
  margin-bottom: 0.1rem;
}
.bg-locked {
  color: #e57373;
  font-size: 0.95rem;
  margin-top: 0.2rem;
  display: block;
}
.bg-modal-close {
  background: var(--settings-modal-primary, #9147ff);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  margin: 0 auto;
  transition: background 0.2s;
}
.bg-modal-close:hover {
  background: var(--settings-modal-primary-light, #a970ff);
}
