/* ============================================================
   깨알도구
   단가 비교기 전용 CSS

   공통:
   ../../css/tool-common.css
   ============================================================ */

/* ============================================================
   PAGE
   ============================================================ */

.tool-page {
  --tool-page-max-width: 960px;
}

/* ============================================================
   CALCULATOR
   ============================================================ */

.unit-price-calculator {
  grid-template-columns:
    minmax(0, 1.04fr)
    minmax(0, 0.96fr);

  align-items: start;
}

/* ============================================================
   SECTION HEAD
   ============================================================ */

.product-section-head {
  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;

  margin-bottom: 12px;
}

.product-section-head p {
  margin: 3px 0 0;

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.45;
}

.add-product-button {
  flex: 0 0 auto;

  min-height: 32px;

  padding: 0 10px;

  border: 1px solid var(--line);

  border-radius: 9px;

  background: #ffffff;

  color: var(--text);

  font-size: 12px;

  font-weight: 800;

  cursor: pointer;

  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.add-product-button:hover {
  background: var(--surface-soft);

  transform: translateY(-1px);
}

.add-product-button:disabled {
  opacity: 0.45;

  cursor: default;

  transform: none;
}

/* ============================================================
   PRODUCT LIST
   ============================================================ */

.product-list {
  display: flex;

  flex-direction: column;

  gap: 9px;
}

/* ============================================================
   PRODUCT CARD
   ============================================================ */

.product-card {
  padding: 11px;

  border: 1px solid var(--line);

  border-radius: 12px;

  background: #ffffff;
}

.product-card-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-bottom: 9px;
}

.product-label {
  display: flex;

  align-items: center;

  gap: 7px;

  min-width: 0;
}

.product-letter {
  display: flex;

  align-items: center;
  justify-content: center;

  width: 24px;
  height: 24px;

  flex: 0 0 24px;

  border-radius: 7px;

  background: var(--surface-soft);

  color: var(--text);

  font-size: 12px;

  font-weight: 900;
}

.product-label strong {
  color: var(--text);

  font-size: 12px;

  font-weight: 800;
}

.remove-product-button {
  border: 0;

  background: transparent;

  color: var(--text-soft);

  font-size: 15px;

  line-height: 1;

  cursor: pointer;
}

.remove-product-button:hover {
  color: var(--text);
}

/* ============================================================
   PRODUCT NAME
   ============================================================ */

.product-name-input {
  width: 100%;
  height: 38px;

  margin-bottom: 7px;

  padding: 0 10px;

  border: 1px solid var(--line);

  border-radius: 9px;

  background: #ffffff;

  color: var(--text);

  outline: none;

  font: inherit;

  font-size: 12px;

  font-weight: 700;
}

.product-name-input:focus {
  border-color: var(--accent);

  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.1);
}

/* ============================================================
   PRODUCT INPUTS
   ============================================================ */

.product-input-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 1.15fr)
    minmax(0, 0.85fr)
    78px;

  gap: 6px;
}

.product-field span {
  display: block;

  margin-bottom: 4px;

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 700;
}

.product-field input,
.product-unit-select {
  width: 100%;
  height: 38px;

  border: 1px solid var(--line);

  border-radius: 9px;

  background: #ffffff;

  color: var(--text);

  outline: none;

  font: inherit;

  font-size: 12px;

  font-weight: 700;
}

.product-field input {
  padding: 0 9px;
}

.product-unit-select {
  padding: 0 7px;

  cursor: pointer;
}

.product-field input:focus,
.product-unit-select:focus {
  border-color: var(--accent);

  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.1);
}

/* ============================================================
   GUIDE
   ============================================================ */

.input-guide {
  display: flex;

  align-items: flex-start;

  gap: 6px;

  margin-top: 11px;

  padding: 9px 10px;

  border-radius: 9px;

  background: var(--surface-soft);

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.55;
}

/* ============================================================
   BEST RESULT
   ============================================================ */

.best-product-box {
  display: flex;

  align-items: center;

  gap: 10px;

  padding: 12px;

  border-radius: 12px;

  background: #fff7dc;
}

.best-product-icon {
  display: flex;

  align-items: center;
  justify-content: center;

  width: 40px;
  height: 40px;

  flex: 0 0 40px;

  border-radius: 10px;

  background: #ffffff;

  font-size: 20px;
}

.best-product-copy {
  min-width: 0;
}

.best-product-copy span {
  display: block;

  color: var(--text-soft);

  font-size: 12px;

  font-weight: 700;
}

.best-product-copy strong {
  display: block;

  margin-top: 2px;

  color: var(--text);

  font-size: 13px;

  font-weight: 900;
}

.best-product-copy small {
  display: block;

  margin-top: 2px;

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.45;
}

/* ============================================================
   SUMMARY
   ============================================================ */

.unit-summary-grid {
  margin-top: 12px;
}

/* ============================================================
   RESULT LIST
   ============================================================ */

.comparison-title {
  margin-top: 18px;
  margin-bottom: 6px;

  color: var(--text);

  font-size: 12px;

  font-weight: 800;
}

.price-result-list {
  border-top: 1px solid var(--line);
}

.price-result-row {
  padding: 9px 1px;

  border-bottom: 1px solid #efeee9;
}

.price-result-row.best {
  background: #fffaf0;
}

.price-result-main {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;
}

.price-result-name {
  min-width: 0;
}

.price-result-name strong {
  display: block;

  color: var(--text);

  font-size: 12px;

  font-weight: 800;
}

.price-result-name small {
  display: block;

  margin-top: 2px;

  color: var(--text-soft);

  font-size: 12px;
}

.price-result-price {
  flex: 0 0 auto;

  color: var(--text);

  font-size: 12px;

  font-weight: 900;

  text-align: right;
}

.price-result-row.best .price-result-price {
  color: var(--brand);
}

/* ============================================================
   DIFFERENCE
   ============================================================ */

.price-result-detail {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-top: 5px;

  color: var(--text-soft);

  font-size: 12px;
}

.price-result-detail strong {
  color: var(--text);

  font-size: 12px;

  font-weight: 800;
}

.price-result-detail .best-text {
  color: var(--brand);
}

/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 760px) {
  .unit-price-calculator {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 520px) {
  .product-input-grid {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 0.82fr)
      68px;
  }

  .product-field input,
  .product-unit-select {
    font-size: 12px;
  }
}
