/* 房贷计算器样式 */
:root {
  --bg: #ffffff;
  --bg-card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --primary-light: rgba(79, 70, 229, 0.3);
  --primary-dark: #4338ca;
}

/* ==================== 输入区域样式 ==================== */
.calc-input-section {
  margin-bottom: 32px;
}

.calc-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calc-card-header {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: white;
  padding: 24px 32px;
}

.calc-card-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: #ffffff;
}

.calc-card-header p {
  font-size: 14px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

.calc-card-body {
  padding: 32px;
}

/* 表单区域 */
.form-section {
  margin-bottom: 28px;
}

.form-section:last-of-type {
  margin-bottom: 24px;
}

.form-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

/* 贷款类型选择卡片 */
.loan-type-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.radio-card {
  position: relative;
  cursor: pointer;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
  background: var(--bg);
}

.radio-card:hover .radio-card-content {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.radio-card.active .radio-card-content,
.radio-card input:checked + .radio-card-content {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.radio-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 12px;
  margin-bottom: 12px;
  color: var(--primary);
  transition: all 0.3s ease;
}

.radio-card.active .radio-card-icon,
.radio-card input:checked + .radio-card-content .radio-card-icon {
  background: var(--primary);
  color: white;
}

.radio-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.radio-card-desc {
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
}

/* 贷款参数表单卡片 */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.form-group-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-group-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(79, 70, 229, 0.03);
  border-bottom: 1px solid var(--border);
}

.form-group-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.form-group-card-badge {
  font-size: 12px;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
}

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

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 8px;
}

.input-with-unit {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.input-with-unit:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-with-unit input {
  flex: 1;
  padding: 10px 12px;
  border: none;
  font-size: 15px;
  background: transparent;
  color: var(--text);
  outline: none;
  min-width: 0;
}

.input-with-unit input::placeholder {
  color: var(--text-light);
}

.input-with-unit .unit {
  font-size: 13px;
  color: var(--text-light);
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.02);
  border-left: 1px solid var(--border);
  align-self: stretch;
  display: flex;
  align-items: center;
}

/* 还款方式选择 */
.repay-type-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.repay-type-group .radio-card-content {
  padding: 16px 20px;
}

/* 操作按钮 */
.calc-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.btn-lg {
  flex: 1;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.btn-primary.btn-lg {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  border: none;
}

.btn-primary.btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

.btn-outline.btn-lg {
  border-width: 2px;
}

.btn-outline.btn-lg:hover {
  background: var(--bg);
}

/* ==================== 结果区域样式 ==================== */
.calc-result-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

/* 结果概览卡片 */
.result-overview-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-overview-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

.result-overview-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
}

.result-overview-header p {
  font-size: 13px;
  color: var(--text-light);
  margin: 0;
}

.result-overview-body {
  padding: 32px;
}

/* 月供高亮显示 */
.result-highlight {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(79, 70, 229, 0.1));
  border-radius: 12px;
}

.result-highlight-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-highlight-label {
  font-size: 14px;
  color: var(--text-light);
}

.result-highlight-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -1px;
}

.result-highlight-unit {
  font-size: 14px;
  color: var(--text-light);
}

/* 结果网格 */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.result-item:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.result-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 10px;
  color: var(--primary);
  flex-shrink: 0;
}

.result-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.result-item-label {
  font-size: 13px;
  color: var(--text-light);
}

.result-item-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.result-item-unit {
  font-size: 12px;
  color: var(--text-light);
}

/* 图表卡片 */
.result-chart-card {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-chart-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
}

.result-chart-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.result-chart-body {
  padding: 24px 32px;
}

.chart-bar {
  height: 28px;
  background: var(--bg);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-segment {
  height: 100%;
  transition: width 0.6s ease;
  position: relative;
}

.chart-segment.principal {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.chart-segment.interest {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.legend-color.principal {
  background: var(--primary);
}

.legend-color.interest {
  background: #f59e0b;
}

.legend-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* 详情区域 */
.detail-section {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detail-toggle {
  padding: 20px 32px;
  text-align: center;
}

.detail-toggle .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.detail-toggle .btn:hover {
  background: var(--bg);
}

.detail-toggle .btn.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border-color: var(--primary);
}

.detail-toggle .btn .arrow-icon {
  transition: transform 0.3s ease;
}

.detail-toggle .btn.active .arrow-icon {
  transform: rotate(180deg);
}

.detail-table-wrapper {
  border-top: 1px solid var(--border);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: rgba(0, 0, 0, 0.02);
}

.detail-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.detail-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-scroll {
  max-height: 400px;
  overflow-y: auto;
  padding: 0 32px 32px;
}

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

.detail-table th,
.detail-table td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.detail-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-table td {
  color: var(--text);
}

.detail-table tbody tr {
  transition: background 0.2s ease;
}

.detail-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.05);
}

.detail-table tbody tr:last-child td {
  border-bottom: none;
}

/* ==================== 信息区域样式 ==================== */
.info-section {
  margin-top: 32px;
}

.info-section > h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
}

.info-content {
  display: grid;
  gap: 24px;
}

.info-block {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.info-block h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

.info-block p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 16px;
}

.info-block ol {
  padding-left: 24px;
  margin: 0;
}

.info-block li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 12px;
  padding-left: 4px;
}

.info-block li::marker {
  color: var(--primary);
  font-weight: 600;
}

.repay-explain {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 20px;
}

.repay-item {
  background: var(--bg);
  border-radius: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.repay-item:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.repay-item h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.repay-item h4::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

.repay-item p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-light);
  margin: 0;
}

/* 利率表格 */
.rate-table {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.rate-table table {
  width: 100%;
  border-collapse: collapse;
}

.rate-table th,
.rate-table td {
  padding: 14px 20px;
  text-align: left;
}

.rate-table th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.rate-table td {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.rate-table tbody tr:last-child td {
  border-bottom: none;
}

.rate-table tbody tr:hover td {
  background: rgba(79, 70, 229, 0.05);
}

.rate-note {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  margin-top: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--border);
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 992px) {
  .loan-type-group {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .result-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .calc-card-header {
    padding: 20px 24px;
  }

  .calc-card-body {
    padding: 24px;
  }

  .loan-type-group {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .radio-card-content {
    flex-direction: row;
    padding: 16px 20px;
    gap: 16px;
  }

  .radio-card-icon {
    margin-bottom: 0;
  }

  .repay-type-group {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .calc-actions {
    gap: 12px;
  }

  .result-overview-header,
  .result-overview-body,
  .result-chart-header,
  .result-chart-body,
  .detail-header,
  .detail-toggle {
    padding-left: 24px;
    padding-right: 24px;
  }

  .table-scroll {
    padding-left: 16px;
    padding-right: 16px;
  }

  .repay-explain {
    grid-template-columns: 1fr;
  }

  .info-block {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .calc-card-header {
    padding: 16px 20px;
  }

  .calc-card-header h2 {
    font-size: 18px;
  }

  .calc-card-body {
    padding: 20px;
  }

  .form-section h3 {
    font-size: 15px;
  }

  .result-highlight-value {
    font-size: 32px;
  }

  .result-item {
    padding: 16px;
  }

  .result-item-value {
    font-size: 18px;
  }

  .detail-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 20px;
  }

  .detail-toggle {
    padding: 16px 20px;
  }

  .detail-toggle .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions .btn-small {
    width: 100%;
    justify-content: center;
  }

  .table-scroll {
    padding: 0 12px 16px;
  }

  .detail-table th,
  .detail-table td {
    padding: 10px 8px;
    font-size: 11px;
  }
}
