:root {
  --yt-bg-color: #0f0f0f;
  --yt-secondary-bg-color: #222222;
  --yt-container-bg-color: #181818;
  --yt-text-color: #f1f1f1;
  --yt-secondary-text-color: #aaaaaa;
  --yt-primary-color: #3ea6ff;
  --yt-border-color: #3f3f3f;
  --yt-input-bg-color: #121212;
  --yt-button-bg-color: rgba(255, 255, 255, 0.1);
  --yt-button-hover-bg-color: rgba(255, 255, 255, 0.2);
  --yt-success-color: #2ba640;
  --danger-color: #f04747;
  --buy-me-a-coffee-color: #ffdd00;
}

body {
  font-family: "YouTube Noto", "Roboto", "Arial", sans-serif;
  background-color: var(--yt-bg-color);
  color: var(--yt-text-color);
  line-height: 1.6;
  margin: 0;
  padding: 20px;
  font-size: 16px;
}

.calculator {
  max-width: 900px;
  margin: auto;
  background: var(--yt-container-bg-color);
  padding: 24px;
  border-radius: 12px;
}

.calculator__title {
  display: flex;
  align-items: center;
  color: var(--yt-text-color);
  border-bottom: 1px solid var(--yt-border-color);
  padding-bottom: 16px;
  font-size: 2.0em;
  font-weight: 500;
}

.calculator__title-icon {
  width: 45px;
  height: 45px;
  margin-right: 12px;
  border-radius: 25%;
  padding: 2px;
  border: 1px solid var(--yt-text-color);
}

.guide-btn-in-title {
  margin-left: auto;
  font-size: 0.6em; 
  padding: 4px 8px;
  min-height: 44px; 
  white-space: nowrap;
  background-color: var(--yt-button-bg-color);
  color: var(--yt-secondary-text-color);
  flex-shrink: 0;
}
.guide-btn-in-title:hover {
  background-color: var(--yt-button-hover-bg-color);
  color: var(--yt-text-color);
}

.calculator__section {
  padding: 0;
  margin-bottom: 32px;
}

.calculator__section-title {
  color: var(--yt-text-color);
  margin-top: 0;
  margin-bottom: 12px;
  font-weight: 500;
  border: none;
  padding: 0;
}

.character-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.character-form__label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--yt-secondary-text-color);
  font-size: 0.9em;
}

.character-form__input,
.item-editor__price-input,
.item-editor__reward-price {
  width: 100%;
  padding: 4px 8px;
  background-color: var(--yt-input-bg-color);
  border: 1px solid var(--yt-border-color);
  color: var(--yt-text-color);
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.2s;
  font-size: 1em;
}

.character-form__input:focus,
.item-editor__price-input:focus,
.item-editor__reward-price:focus {
  outline: none;
  border-color: var(--yt-primary-color);
  box-shadow: none;
}

.button {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
  color: var(--yt-text-color);
  background-color: var(--yt-button-bg-color);
  padding: 8px 16px;
}
.button:hover {
  background-color: var(--yt-button-hover-bg-color);
}
.button--primary {
  background-color: var(--yt-primary-color);
  color: #0f0f0f;
  margin-top: 15px;
}
.button--primary:hover {
  background-color: #3ea6ff;
}
/* Added secondary button style */
.button--secondary {
  background-color: var(--yt-button-bg-color);
  color: var(--yt-text-color);
}
.button--secondary:hover {
  background-color: var(--yt-button-hover-bg-color);
}
.button--secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Updated load price button to be taller with two lines of text */
.button--load-price {
  background-color: rgba(220, 60, 60, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(220, 60, 60, 0.3);
  padding: 4px 8px;
  font-size: 0.9em;
  white-space: pre-line;
  line-height: 1.3;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.button--load-price:hover {
  background-color: rgba(220, 60, 60, 0.25);
  border-color: rgba(220, 60, 60, 0.5);
}

.button--load-price:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.item-editor__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.item-editor__tab-button {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9em;
  border: 1px solid transparent;
}
.item-editor__tab-button--status-active {
  background-color: var(--yt-button-bg-color);
  color: var(--yt-text-color);
}
.item-editor__tab-button--status-active:hover {
  background-color: var(--yt-button-hover-bg-color);
}
.item-editor__tab-button--status-inactive {
  background-color: var(--yt-button-bg-color);
  color: var(--yt-secondary-text-color);
  opacity: 0.7;
}
.item-editor__tab-button--state-selected.item-editor__tab-button--status-active {
  background-color: var(--yt-text-color);
  color: var(--yt-bg-color);
  font-weight: 500;
  opacity: 1;
}
.item-editor__tab-button--state-selected.item-editor__tab-button--status-inactive {
  background-color: var(--yt-button-bg-color);
  color: var(--yt-text-color);
  border-color: var(--yt-text-color);
  opacity: 1;
}

.item-editor__content {
  display: none;
  background: transparent;
  padding: 16px;
  border: 1px solid var(--yt-border-color);
  border-radius: 12px;
}
.item-editor__content--visible {
  display: block;
}

/* Updated inactive content styles without title bar reference */
.item-editor__content--inactive {
  background-color: rgba(0, 0, 0, 0.3);
  opacity: 0.7;
}

.item-editor__content--inactive,
.item-editor__content--inactive h4,
.item-editor__content--inactive .item-editor__label,
.item-editor__content--inactive .item-editor__item-name,
.item-editor__content--inactive .item-editor__reward-header span,
.item-editor__content--inactive .item-editor__reward-row span {
  color: var(--yt-secondary-text-color);
}

.item-editor__content--inactive .item-editor__link {
  opacity: 0.3;
}

.item-editor__content--inactive .item-editor__price-input,
.item-editor__content--inactive .item-editor__reward-price {
  color: var(--yt-secondary-text-color);
  background-color: rgba(18, 18, 18, 0.5);
}

.item-editor__header {
  display: flex;
  align-items: center;
  /* 요소를 왼쪽에 가깝게 배치하고, gap을 사용하여 요소 간의 간격을 확보합니다. */
  justify-content: flex-start; 
  margin-bottom: 16px;
  /* 요소들 사이의 간격 (필요에 따라 조정) */
  gap: 16px; 
  flex-wrap: wrap; 
}

.item-editor__title-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px;
  background-color: var(--yt-secondary-bg-color);
  border-radius: 8px;
}

.item-editor__checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 24px 8px 12px;
  border-radius: 8px;
  background-color: var(--yt-button-bg-color);
  transition: background-color 0.2s;
}

.item-editor__checkbox-label:hover {
  background-color: var(--yt-button-hover-bg-color);
}

.item-editor__checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  background-color: var(--yt-input-bg-color);
  border: 2px solid var(--yt-border-color);
  border-radius: 4px;
  transition: all 0.2s;
}

.item-editor__checkbox:hover {
  /* border-color: var(--yt-primary-color); */
}

.item-editor__checkbox:checked {
  background-color: var(--yt-primary-color);
  border-color: var(--yt-primary-color);
}

.item-editor__checkbox:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--yt-bg-color);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.item-editor__item-name {
  color: var(--yt-text-color);
  font-size: 1.3em;
  font-weight: 500;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.item-editor__price-section {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0; /* 불필요한 마진 제거 */
  margin-left: 0; /* 기존에 혹시 설정된 'auto'나 큰 마진 제거 */
  order: 0; /* order 속성을 제거하거나 0으로 설정하여 HTML 순서대로 배치 (아이템 이름 바로 다음) */
}

.item-editor__price-input {
  width: 80px;
  flex-shrink: 0;
}

.item-editor__price-label {
  color: var(--yt-secondary-text-color);
  font-size: 0.9em;
  white-space: nowrap;
}

.item-editor__link {
  width: 24px;
  height: 24px;
  margin-right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.item-editor__link:hover {
  opacity: 1;
}

.item-editor__reward-table {
  /* margin-top: 15px; */
}
.item-editor__reward-header,
.item-editor__reward-row {
  display: grid;
  grid-template-columns: 2.5fr 1.5fr 1fr;
  gap: 16px;
  padding: 12px 8px;
  align-items: center;
  border-bottom: 1px solid var(--yt-border-color);
}
.item-editor__reward-row > span:first-child {
  display: flex;
  align-items: center;
  font-weight: 400;
  color: var(--yt-text-color);
}
.item-editor__reward-row:last-child {
  border-bottom: none;
}
.item-editor__reward-header {
  font-weight: 500;
  color: var(--yt-secondary-text-color);
  font-size: 0.9em;
}
.item-editor__reward-chance {
  color: var(--yt-secondary-text-color);
  font-weight: 400;
  text-align: right;
}

.results-display {
  font-size: 1.05em;
}
.results-display__summary-text {
  font-size: 1.1em;
}
.results-display__accordion-header {
  display: grid;
  grid-template-columns: 2.0fr 1fr 1.2fr 1.2fr 1.2fr;
  gap: 10px;
  padding: 8px 0;
  font-weight: 500;
  border-bottom: 1px solid var(--yt-border-color);
  margin-bottom: 4px;
  color: var(--yt-secondary-text-color);
  text-align: right;
}
.results-display__accordion-header span {
  padding: 0 10px;
}
.results-display__accordion-header span:first-child {
  text-align: left;
}

.accordion-item {
  margin-top: 8px;
}
.accordion-item__summary {
  padding: 4px 0;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.2s;
}
.accordion-item__summary:hover {
  background-color: var(--yt-button-bg-color);
}
.accordion-item__summary::-webkit-details-marker {
  display: none;
}
.accordion-item__summary-display {
  display: grid;
  grid-template-columns: 2.0fr 1fr 1fr 1.2fr 1.2fr;
  gap: 10px;
  text-align: right;
}
.accordion-item__summary-display span {
  padding: 0 10px;
}
.accordion-item__summary-display span:first-child {
  text-align: left;
  font-weight: 400;
  display: flex;
  align-items: center;
}
.accordion-item__content {
  padding: 16px;
  border-top: 1px solid var(--yt-border-color);
  margin-top: 4px;
}
details[open] > .accordion-item__summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.accordion-item__details-table {
  margin-top: 10px;
  font-size: 0.9em;
}
.accordion-item__details-header,
.accordion-item__details-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
  padding: 5px 0;
  text-align: right;
  border-bottom: 1px solid var(--yt-border-color);
}
.accordion-item__details-row:last-child {
  border-bottom: none;
}
.accordion-item__details-header {
  color: var(--yt-secondary-text-color);
  font-weight: 500;
}
.accordion-item__details-header span,
.accordion-item__details-row span {
  padding: 0 10px;
}
.accordion-item__details-header span:first-child,
.accordion-item__details-row span:first-child {
  text-align: left;
}

.results-display__placeholder {
  color: var(--yt-secondary-text-color);
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--yt-border-color);
  border-radius: 12px;
}

/* Added footer and modal styles for donation section */
.footer {
  max-width: 900px;
  margin: 40px auto 20px;
  padding: 20px 24px;
  background: var(--yt-container-bg-color);
  border-radius: 12px;
  border-top: 1px solid var(--yt-border-color);
}

.footer__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer__credit {
  color: var(--yt-secondary-text-color);
  font-size: 0.9em;
  margin: 0;
}

.footer__link {
  color: var(--yt-primary-color);
  text-decoration: none;
  transition: opacity 0.2s;
}

.footer__link:hover {
  opacity: 0.7;
}

/* Removed .footer class and simplified footer button styles */
.footer__donation-btn {
  padding: 10px 20px;
  background-color: var(--yt-button-bg-color);
  color: var(--yt-text-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 500;
  transition: background-color 0.2s;
}

.footer__donation-btn:hover {
  background-color: var(--yt-button-hover-bg-color);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal--active {
  display: block;
}

.modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--yt-container-bg-color);
  padding: 32px;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--yt-text-color);
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.modal__close:hover {
  opacity: 0.7;
}

.modal__spacer{
  height: 32px;
}

.modal__description {
  color: var(--yt-secondary-text-color);
  margin: 0 0 24px 0;
}

.modal__options {
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: center;
  justify-content: center;
}

.modal__option {
  padding: 20px;
  background-color: transparent;
  border-radius: 8px;
  text-align: center;
  flex: 1;
}

.modal__option-title {
  color: var(--yt-text-color);
  margin: 0 0 16px 0;
  font-size: 1.1em;
  font-weight: 500;
}

.modal__qr {
  max-width: 250px;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.modal__divider {
  width: 1px;
  height: 200px;
  background-color: var(--yt-border-color);
  margin: 0 20px;
}

.modal__link-button {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--buy-me-a-coffee-color);
  color: rgb(0, 0, 0);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 800;
  transition: background-color 0.2s;
}

.modal__link-button:hover {
  opacity: 0.7;
}

@media (max-width: 768px) {
  .footer__content {
    flex-direction: column;
    text-align: center;
  }

  .modal__content {
    padding: 24px;
  }

  .modal__options {
    flex-direction: column;
    gap: 24px;
  }

  .modal__divider {
    width: 100%;
    height: 1px;
    margin: 0;
  }
}

/* Added toast notification styles */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 16px 24px;
  border-radius: 8px;
  color: var(--yt-text-color);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast--success {
  background-color: var(--yt-success-color);
}

.toast--error {
  background-color: var(--danger-color);
}

.toast--info {
  background-color: var(--yt-primary-color);
  color: var(--yt-bg-color);
}
