/* ==========================================================================
   DotFun Lab Interactive Calculators Design System
   닷펀랩 인터랙티브 실전 계산기 도구 3종 스타일시트
   ========================================================================== */

.df-calc-widget {
  background: var(--surface-subtle, #f8fafc);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 16px;
  padding: 1.75rem;
  margin: 2.2rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  font-family: inherit;
  word-break: keep-all;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .df-calc-widget {
  background: #172235;
  border-color: #2a3b53;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.df-calc-widget:hover {
  border-color: var(--orange, #ef7b32);
}

.df-calc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.df-calc-title-box {
  flex: 1;
}

.df-calc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 123, 50, 0.12);
  color: var(--orange, #ef7b32);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.df-calc-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink, #172033);
  margin: 0 0 4px 0;
  line-height: 1.35;
}

.df-calc-desc {
  font-size: 0.88rem;
  color: var(--muted, #647083);
  margin: 0;
  line-height: 1.5;
}

/* Form Controls & Layout */
.df-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* 2열 전용 비교 패널 (스마트폰 통신3사 vs 알뜰폰 2열 대칭 레이아웃) */
.df-calc-compare-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .df-calc-compare-cols {
    grid-template-columns: 1fr;
  }
}

.df-col-card {
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .df-col-card {
  background: #111a2e;
  border-color: #2a3b53;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.df-col-card.carrier {
  border-top: 4px solid #f87171;
}

.df-col-card.mvno {
  border-top: 4px solid #34d399;
}

.df-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink, #172033);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

[data-theme="dark"] .df-col-header {
  color: #f8fafc;
  border-bottom-color: #2a3b53;
}

.df-col-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: -0.01em;
}

.df-col-card.carrier .df-col-badge {
  background: rgba(248, 113, 113, 0.15);
  color: #dc2626;
}

.df-col-card.mvno .df-col-badge {
  background: rgba(52, 211, 153, 0.15);
  color: #059669;
}

/* 상단 단말기 출고가 바 */
.df-calc-device-bar {
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

@media (max-width: 768px) {
  .df-calc-device-bar {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

[data-theme="dark"] .df-calc-device-bar {
  background: #111a2e;
  border-color: #2a3b53;
}

.df-calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.df-calc-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink, #172033);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.4;
  word-break: keep-all;
}

[data-theme="dark"] .df-calc-label {
  color: #f1f5f9;
}

.df-calc-label-tip {
  font-size: 0.76rem;
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

[data-theme="dark"] .df-calc-label-tip {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.df-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.df-calc-input,
.df-calc-select {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink, #172033);
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 8px;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.df-calc-input {
  padding-right: 38px;
}

.df-calc-select {
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

[data-theme="dark"] .df-calc-input,
[data-theme="dark"] .df-calc-select {
  background-color: #0f172a;
  border-color: #334155;
  color: #f8fafc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.df-calc-input:focus,
.df-calc-select:focus {
  border-color: var(--orange, #ef7b32);
  box-shadow: 0 0 0 3px rgba(239, 123, 50, 0.18);
}

.df-input-unit {
  position: absolute;
  right: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted, #94a3b8);
  pointer-events: none;
}

/* Range Slider */
.df-range-slider {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--orange, #ef7b32);
  cursor: pointer;
}

/* Presets Buttons */
.df-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.df-preset-btn {
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex: 1 1 auto;
  text-align: center;
}

[data-theme="dark"] .df-preset-btn {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

.df-preset-btn:hover,
.df-preset-btn.active {
  background: var(--orange, #ef7b32);
  color: #ffffff;
  border-color: var(--orange, #ef7b32);
}

/* Results Display Box */
.df-calc-result-box {
  background: linear-gradient(135deg, rgba(239, 123, 50, 0.08) 0%, rgba(43, 104, 184, 0.08) 100%);
  border: 1px solid rgba(239, 123, 50, 0.25);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .df-calc-result-box {
  background: linear-gradient(135deg, rgba(239, 123, 50, 0.15) 0%, rgba(43, 104, 184, 0.15) 100%);
  border-color: rgba(239, 123, 50, 0.35);
}

.df-result-primary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0.75rem;
}

.df-result-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink, #172033);
}

.df-result-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--orange, #ef7b32);
  letter-spacing: -0.02em;
}

.df-result-value small {
  font-size: 1rem;
  font-weight: 700;
  margin-left: 2px;
}

/* Compare Bar */
.df-compare-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(200, 200, 200, 0.4);
}

.df-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.df-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.df-bar-track {
  height: 10px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
}

[data-theme="dark"] .df-bar-track {
  background: rgba(255, 255, 255, 0.1);
}

.df-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.df-bar-fill.carrier {
  background: #f87171;
}

.df-bar-fill.mvno {
  background: #34d399;
}

.df-bar-fill.standard {
  background: #94a3b8;
}

.df-bar-fill.isa {
  background: #60a5fa;
}

/* Details summary breakdown */
.df-breakdown-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.df-breakdown-item {
  font-size: 0.86rem;
  color: var(--muted, #647083);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--paper, rgba(255, 255, 255, 0.7));
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .df-breakdown-item {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

.df-breakdown-item strong {
  color: var(--ink, #172033);
  font-weight: 700;
}

[data-theme="dark"] .df-breakdown-item strong {
  color: #f8fafc;
}

/* CTA footer inside calculator */
.df-calc-footer {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted, #647083);
  text-align: right;
  word-break: keep-all;
}

@media (max-width: 768px) {
  .df-calc-input,
  .df-calc-select {
    font-size: 16px; /* iOS Safari 16px 미만 탭 시 화면 자동 확대(줌인) 방지 */
  }
}

@media (max-width: 600px) {
  .df-calc-widget {
    padding: 1.15rem 0.9rem;
    margin: 1.25rem 0;
    border-radius: 14px;
  }
  .df-calc-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .df-calc-title {
    font-size: 1.15rem;
    line-height: 1.4;
  }
  .df-calc-desc {
    font-size: 0.84rem;
  }
  .df-calc-device-bar {
    padding: 1rem 0.85rem;
    gap: 0.85rem;
  }
  .df-col-card {
    padding: 1rem 0.85rem;
  }
  .df-col-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .df-calc-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .df-presets {
    gap: 6px;
  }
  .df-preset-btn {
    padding: 8px 8px;
    font-size: 0.8rem;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .df-calc-result-box {
    padding: 1.1rem 0.95rem;
    border-radius: 10px;
  }
  .df-result-primary {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .df-result-label {
    font-size: 0.9rem;
  }
  .df-result-value {
    font-size: 1.65rem;
    line-height: 1.2;
  }
  .df-breakdown-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .df-breakdown-item {
    font-size: 0.82rem;
    padding: 8px 10px;
    gap: 8px;
  }
  .df-calc-footer {
    text-align: left;
    font-size: 0.8rem;
    margin-top: 1rem;
  }
}
