/* ===== Calculator Page Layout ===== */
.calculator-page {
  padding: 2rem 0;
}

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

.calculator-main {
  min-width: 0;
}

/* ===== Calculator Widget ===== */
.calculator-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.calculator-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* ===== Form Fields ===== */
.calc-field {
  margin-bottom: 1.25rem;
}

.calc-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: help;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
  background: var(--bg);
}

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

.input-prefix,
.input-suffix {
  padding: 0 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  height: 100%;
  min-height: 48px;
}

.input-prefix {
  border-right: 1px solid var(--border);
}

.input-suffix {
  border-left: 1px solid var(--border);
}

.calc-input {
  width: 100%;
  border: none;
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--text);
  background: transparent;
  outline: none;
  min-height: 48px;
}

.calc-field > select.calc-input {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23555770' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.5rem;
}

.calc-field > select.calc-input:focus {
  border-color: var(--primary);
}

/* Slider */
.calc-slider {
  width: 100%;
  margin-top: 0.5rem;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
}

/* Radio / Checkbox */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.radio-label,
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
  min-height: 44px;
}

.radio-label:has(input:checked),
.checkbox-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-label input,
.checkbox-label input {
  accent-color: var(--primary);
}

/* Validation errors */
.field-error {
  font-size: 0.8rem;
  color: #CC3333;
  margin-top: 0.3rem;
  min-height: 0;
}

/* ===== Results ===== */
.calculator-results {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}

.results-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.results-grid {
  display: grid;
  gap: 0.75rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
}

.result-highlight {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  padding: 1.25rem 1.25rem;
}

.result-highlight .result-label {
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
}

.result-highlight .result-value {
  font-size: 1.5rem;
}

.result-label {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

.result-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.result-highlight .result-value {
  color: white;
}

/* ===== Content Sections ===== */
.content-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.content-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.content-section p,
.content-section li {
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.content-section ul,
.content-section ol {
  padding-left: 1.5rem;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.faq-item summary:hover {
  background: var(--bg-alt);
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 400;
}

.faq-item[open] summary::after {
  content: '\2212';
}

.faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===== Sidebar ===== */
.calculator-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
}

.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.sidebar-widget h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.related-list {
  list-style: none;
}

.related-list li {
  margin-bottom: 0.4rem;
}

.related-list a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-light);
  transition: background 0.2s, color 0.2s;
}

.related-list a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== Responsive Calculator ===== */
@media (max-width: 900px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .calculator-sidebar {
    position: static;
  }

  .calculator-widget {
    padding: 1.25rem;
  }

  .result-highlight .result-value {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .radio-group {
    flex-direction: column;
  }
}
