/* ── HD SAISON Calculator ── */
:root {
  --hdsc-red:       #E31837;
  --hdsc-red-dark:  #b81228;
  --hdsc-red-light: #fdecea;
  --hdsc-gold:      #f5a623;
  --hdsc-text:      #1a1a2e;
  --hdsc-muted:     #3b3b3b;
  --hdsc-border:    #e5e7eb;
  --hdsc-white:     #ffffff;
  --hdsc-radius:    12px;
  --hdsc-shadow:    0 4px 24px rgba(227,24,55,0.10);
  --hdsc-col-hover: rgba(227,24,55,0.06);
}

/* Reset text-transform toàn bộ plugin */
.hdsc-wrap,
.hdsc-wrap * {
  text-transform: none !important;
  box-sizing: border-box;
}

.hdsc-wrap {
  font-family: 'Segoe UI', Arial, sans-serif;
  max-width: 740px;
  margin: 24px auto;
  background: var(--hdsc-white);
  border-radius: var(--hdsc-radius);
  box-shadow: var(--hdsc-shadow);
  overflow: hidden;
  color: var(--hdsc-text);
}

/* ── Header ── */
.hdsc-header {
  background: linear-gradient(135deg, var(--hdsc-red) 0%, var(--hdsc-red-dark) 100%);
  color: var(--hdsc-white);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hdsc-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.hdsc-logo-hd     { color: var(--hdsc-white); }
.hdsc-logo-saison { color: #ffd0d8; }
.hdsc-logo-o      { color: var(--hdsc-gold); }

.hdsc-header-text h2 {
  margin: 0 0 2px;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.hdsc-header-text p {
  margin: 0;
  font-size: 12px;
  opacity: .8;
}

/* ── Form ── */
.hdsc-form {
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hdsc-field {
  background: #f0f0f0;
  border: 1.5px solid var(--hdsc-border);
  border-radius: 10px;
  padding: 14px 16px;
}

.hdsc-field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--hdsc-muted);
  letter-spacing: .5px;
  margin-bottom: 10px;
}

.hdsc-optional {
  font-weight: 400;
  color: #aaa;
}

/* Input wrap */
.hdsc-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--hdsc-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .2s;
  margin: 0;
  padding: 0;
}

.hdsc-input-wrap:focus-within {
  border-color: var(--hdsc-red);
}

.hdsc-input-wrap input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 10px 12px;
  margin: 0;
  font-size: 15px;
  color: var(--hdsc-text);
  background: transparent;
  -moz-appearance: textfield;
  line-height: 1.4;
  min-height: 0;
  width: 100%;
}

.hdsc-input-wrap input::-webkit-inner-spin-button,
.hdsc-input-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; }


.hdsc-input-error { border-color: var(--hdsc-red) !important; }

/* Slider */
.hdsc-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.hdsc-range-label {
  font-size: 12px;
  color: var(--hdsc-muted);
  white-space: nowrap;
}

#hdsc-slider,
#hdsc-product-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--hdsc-border);
  outline: none;
  cursor: pointer;
}

#hdsc-slider::-webkit-slider-thumb,
#hdsc-product-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--hdsc-red);
  box-shadow: 0 2px 6px rgba(227,24,55,.4);
  cursor: pointer;
}

#hdsc-slider::-moz-range-thumb,
#hdsc-product-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--hdsc-red);
  border: none;
  cursor: pointer;
}

#hdsc-slider::-moz-range-progress,
#hdsc-product-slider::-moz-range-progress {
  background: var(--hdsc-red);
  height: 6px;
  border-radius: 3px;
}

.hdsc-amount-display {
  margin-top: 6px;
  font-size: 13px;
  color: var(--hdsc-red);
  font-weight: 600;
  text-align: right;
}

.hdsc-mb8 { margin-bottom: 8px; }

/* Disabled field */
.hdsc-field-disabled {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

/* % buttons */
.hdsc-pct-btns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

@media (max-width: 580px) {
  .hdsc-pct-btns {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hdsc-pct-btn {
  width: 100%;
  padding: 8px 4px;
  margin: 0;
  border: 1.5px solid var(--hdsc-border);
  border-radius: 8px;
  background: var(--hdsc-white);
  color: var(--hdsc-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  line-height: 1.4;
  min-height: 36px;
}

.hdsc-pct-btn:hover {
  border-color: var(--hdsc-red);
  color: var(--hdsc-red);
}

.hdsc-pct-btn.active {
  background: var(--hdsc-red);
  border-color: var(--hdsc-red);
  color: var(--hdsc-white);
}

/* Term buttons */
.hdsc-terms {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

@media (max-width: 580px) {
  .hdsc-terms {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hdsc-term-btn {
  width: 100%;
  padding: 9px 4px;
  margin: 0;
  border: 1.5px solid var(--hdsc-border);
  border-radius: 8px;
  background: var(--hdsc-white);
  color: var(--hdsc-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  line-height: 1.4;
  min-height: 38px;
}

.hdsc-term-btn:hover {
  border-color: var(--hdsc-red);
  color: var(--hdsc-red);
}

.hdsc-term-btn.active {
  background: var(--hdsc-red);
  border-color: var(--hdsc-red);
  color: var(--hdsc-white);
}


/* ── Result ── */
.hdsc-result {
  margin: 0 16px 20px;
  border: 1.5px solid var(--hdsc-red-light);
  border-radius: var(--hdsc-radius);
  overflow: hidden;
  animation: hdsc-fadein .3s ease;
  background: #ececec;
}

@keyframes hdsc-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hdsc-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--hdsc-red-light);
}

.hdsc-result-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--hdsc-red);
}

.hdsc-btn-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  margin: 0;
  background: var(--hdsc-white);
  border: 1.5px solid var(--hdsc-red);
  border-radius: 6px;
  color: var(--hdsc-red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  line-height: 1.3;
  white-space: nowrap;
}

.hdsc-btn-copy:hover,
.hdsc-btn-copy.hdsc-copied {
  background: var(--hdsc-red);
  color: var(--hdsc-white);
}

/* Result rows */
.hdsc-result-rows {
  display: flex;
  flex-direction: column;
}

.hdsc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hdsc-border);
  font-size: 14px;
}

.hdsc-result-row:last-child { border-bottom: none; }

.hdsc-row-label { color: var(--hdsc-muted); }
.hdsc-row-value { font-weight: 700; color: var(--hdsc-text); font-size: 18px; }

.hdsc-result-highlight { background: #ececec; }
.hdsc-result-highlight .hdsc-row-label { color: var(--hdsc-red); font-weight: 600; }
.hdsc-result-highlight .hdsc-row-value { color: var(--hdsc-red); }

.hdsc-result-diff .hdsc-row-value { color: var(--hdsc-gold); }

.hdsc-note {
  margin: 0;
  padding: 10px 16px;
  font-size: 11px;
  color: var(--hdsc-muted);
  background: #ececec;
  border-top: 1px solid var(--hdsc-border);
}

/* ── Reference table ── */
.hdsc-table-section {
  padding: 0 24px 24px;
}

.hdsc-btn-table {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1.5px solid var(--hdsc-border);
  border-radius: 8px;
  color: var(--hdsc-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all .18s;
}

.hdsc-btn-table:hover {
  border-color: var(--hdsc-red);
  color: var(--hdsc-red);
}

.hdsc-table-wrap {
  margin-top: 12px;
  border: 1px solid var(--hdsc-border);
  border-radius: 8px;
  overflow: hidden;
}

.hdsc-table-scroll { overflow-x: auto; }

.hdsc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.hdsc-table th {
  background: var(--hdsc-red);
  color: var(--hdsc-white);
  padding: 10px 16px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s;
}

.hdsc-table th:first-child {
  text-align: left;
  white-space: normal;
  min-width: 100px;
  padding: 10px 16px;
}

.hdsc-table th:last-child,
.hdsc-table td:last-child {
  padding-right: 16px;
}

.hdsc-table td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--hdsc-border);
  color: var(--hdsc-text);
  transition: background .12s, color .12s;
}

.hdsc-table td:first-child {
  text-align: left;
  font-weight: 600;
  padding-left: 10px;
}

.hdsc-table tr:nth-child(even) td { background: #fafafa; }

/* Hover hàng */
.hdsc-table tbody tr:hover td {
  background: var(--hdsc-red-light) !important;
  color: var(--hdsc-red);
}

/* Hover cột (class thêm bằng JS) */
.hdsc-table td.hdsc-col-hover {
  background: var(--hdsc-col-hover) !important;
}

.hdsc-table tbody tr:hover td.hdsc-col-hover {
  background: var(--hdsc-red-light) !important;
}

/* Highlight cột header khi hover */
.hdsc-table th.hdsc-col-hover {
  background: var(--hdsc-red-dark);
}

/* Hàng đang được chọn (kết quả tính) */
.hdsc-table tr.hdsc-row-active td {
  background: var(--hdsc-red-light) !important;
  color: var(--hdsc-red);
  font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .hdsc-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hdsc-result-highlight .hdsc-row-value { font-size: 15px; }
  .hdsc-term-btn { font-size: 13px; padding: 8px 2px; }
}
