/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

.theme-button {
  background: var(--field-bg-color);
  border: 1px solid var(--field-border-color);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--field-color);
  transition: all 0.2s;
  font-weight: 500;
}

.theme-button:hover {
  background: var(--button-hover-color);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

.modal-content {
  background: var(--doorhanger-bg-color);
  padding: 16px;
  border-radius: 8px;
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--doorhanger-border-color);
  color: var(--main-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: var(--doorhanger-bg-color);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--doorhanger-border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--main-color);
}

.close-button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  color: var(--main-color);
  opacity: 0.7;
}

.close-button:hover {
  opacity: 1;
}

.default-themes {
  border-bottom: 2px solid var(--separator-color);
  margin-bottom: 16px;
  padding-bottom: 8px;
}

.default-themes .theme-group-title {
  color: var(--main-color);
  opacity: 0.9;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.default-themes .theme-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.default-themes .theme-option {
  background: var(--button-hover-color);
  position: relative;
}

.default-themes .theme-option::after {
  content: 'Default';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--main-color);
  opacity: 0.5;
}

.theme-groups-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.theme-group {
  margin-bottom: 8px;
}

.theme-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--main-color);
  opacity: 0.7;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--separator-color);
}

.theme-list {
  display: grid;
  gap: 4px;
}

.theme-option {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-size: 13px;
}

.theme-option:hover {
  background: var(--button-hover-color);
}

.theme-option.selected {
  background: color-mix(in srgb, var(--toggled-btn-bg-color) 10%, transparent);
  border-color: var(--toggled-btn-bg-color);
}

.color-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 8px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.theme-option:hover .color-circle {
  transform: scale(1.2);
}

.theme-name {
  color: var(--main-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

::-webkit-scrollbar {
  width: 8px;
  height: 18px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--separator-color) 80%, black);
}

@media (max-width: 640px) {
  .modal-content {
    padding: 12px;
  }

  .theme-groups-container {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .default-themes .theme-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .theme-groups-container {
    grid-template-columns: 1fr;
  }
}
