/* ===== Main Layout ===== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ===== Tab Navigation ===== */
.tab-nav {
  display: flex;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 24px;
  box-shadow: 0 1px 8px rgba(27,58,92,0.06);
  position: relative;
}
.tab-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  color: #718096;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.25s ease;
  position: relative;
  z-index: 1;
}
.tab-btn:hover { color: #1B3A5C; }
.tab-btn.active {
  background: #1B3A5C;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(27,58,92,0.25);
}
.tab-btn .tab-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.8;
  margin-top: 2px;
}

/* ===== Content Grid ===== */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ===== Card ===== */
.card {
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 1px 8px rgba(27,58,92,0.06);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header-icon {
  width: 32px; height: 32px;
  background: #E8F0F8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: #2D3748;
}
.card-body { padding: 24px; }

/* ===== Form ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #2D3748;
  margin-bottom: 8px;
}
.form-label .label-hint {
  font-weight: 400;
  color: #718096;
  font-size: 12px;
  margin-left: 6px;
}
.form-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 16px;
  color: #2D3748;
  background: #F7F9FC;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: "DIN Alternate", "Roboto Mono", monospace;
}
.form-input:focus {
  outline: none;
  border-color: #2C5F8A;
  box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
  background: #FFFFFF;
}
.form-input.error {
  border-color: #E53E3E;
  box-shadow: 0 0 0 3px rgba(229,62,62,0.1);
}
.input-suffix {
  position: absolute;
  right: 14px;
  font-size: 14px;
  color: #718096;
  pointer-events: none;
}
.form-input.has-suffix { padding-right: 50px; }
.form-error {
  font-size: 12px;
  color: #E53E3E;
  margin-top: 4px;
  display: none;
}
.form-error.show { display: block; }

/* ===== Radio Group ===== */
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-item { flex: 1; min-width: 120px; }
.radio-item input[type="radio"] { display: none; }
.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #718096;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.radio-label:hover { border-color: #2C5F8A; color: #1B3A5C; }
.radio-item input[type="radio"]:checked + .radio-label {
  border-color: #1B3A5C;
  background: #E8F0F8;
  color: #1B3A5C;
  font-weight: 600;
}

/* ===== Select ===== */
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 15px;
  color: #2D3748;
  background: #F7F9FC;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23718096' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-select:focus {
  outline: none;
  border-color: #2C5F8A;
  box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
}

/* ===== Button ===== */
.btn-calc {
  width: 100%;
  padding: 14px 24px;
  background: #1B3A5C;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  letter-spacing: 1px;
}
.btn-calc:hover {
  background: #0F2744;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27,58,92,0.3);
}
.btn-calc:active { transform: translateY(0); }
.btn-reset {
  width: 100%;
  padding: 12px 24px;
  background: transparent;
  color: #718096;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
}
.btn-reset:hover { border-color: #1B3A5C; color: #1B3A5C; }

/* ===== Result Panel ===== */
.result-panel { position: sticky; top: 90px; }
.result-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.result-item {
  background: #E8F0F8;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.result-item.highlight {
  background: #1B3A5C;
  color: #FFFFFF;
  grid-column: 1 / -1;
}
.result-item-label {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 6px;
}
.result-item-value {
  font-size: 26px;
  font-weight: 800;
  font-family: "DIN Alternate", "Roboto Mono", monospace;
  line-height: 1.2;
}
.result-item.highlight .result-item-value { font-size: 32px; }
.result-item-unit {
  font-size: 14px;
  font-weight: 400;
  margin-left: 2px;
}

/* ===== Compare Bar ===== */
.compare-bar {
  background: #F0FFF4;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: none;
}
.compare-bar.show { display: block; }
.compare-text {
  font-size: 13px;
  color: #276749;
  line-height: 1.6;
}
.compare-text strong {
  font-family: "DIN Alternate", "Roboto Mono", monospace;
  font-size: 15px;
}

/* ===== Detail Table ===== */
.detail-section { margin-top: 24px; }
.detail-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  cursor: pointer;
  border-top: 1px solid #E2E8F0;
}
.detail-toggle-text {
  font-size: 15px;
  font-weight: 600;
  color: #2D3748;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-toggle-arrow {
  font-size: 12px;
  color: #718096;
  transition: transform 0.25s;
}
.detail-toggle.open .detail-toggle-arrow { transform: rotate(180deg); }
.detail-table-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.detail-table-wrap.open {
  max-height: 2000px;
  overflow-y: auto;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.detail-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.detail-table th {
  background: #1B3A5C;
  color: #FFFFFF;
  padding: 10px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.detail-table th:first-child { text-align: center; }
.detail-table td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid #E2E8F0;
  font-family: "DIN Alternate", "Roboto Mono", monospace;
  font-size: 13px;
  white-space: nowrap;
}
.detail-table td:first-child { text-align: center; color: #718096; }
.detail-table tbody tr:hover { background: #F7F9FC; }
.detail-table tbody tr:nth-child(even) { background: #FAFCFE; }
.detail-table tbody tr:nth-child(even):hover { background: #F0F5FA; }

/* ===== Placeholder ===== */
.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #CBD5E0;
}
.result-placeholder-icon { font-size: 48px; margin-bottom: 16px; }
.result-placeholder-text { font-size: 15px; }

/* ===== FAQ Section ===== */
.faq-section { margin-top: 40px; }
.faq-title {
  font-size: 20px;
  font-weight: 700;
  color: #2D3748;
  text-align: center;
  margin-bottom: 24px;
}
.faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.faq-item {
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 1px 8px rgba(27,58,92,0.06);
  overflow: hidden;
}
.faq-question {
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #2D3748;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
}
.faq-question:hover { background: #F7F9FC; }
.faq-question .faq-icon {
  color: #1B3A5C;
  font-size: 18px;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}
.faq-question .faq-arrow {
  font-size: 12px;
  color: #718096;
  transition: transform 0.25s;
  flex-shrink: 0;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.faq-answer-inner {
  padding: 0 20px 16px;
  font-size: 13px;
  color: #718096;
  line-height: 1.8;
}
.faq-item.open .faq-answer { max-height: 500px; }

/* ===== Quick Rate Tags ===== */
.rate-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.rate-tag {
  padding: 4px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  font-size: 12px;
  color: #718096;
  cursor: pointer;
  transition: all 0.2s;
}
.rate-tag:hover {
  border-color: #2C5F8A;
  color: #1B3A5C;
  background: #E8F0F8;
}

/* ===== Loan Type Info ===== */
.loan-type-info {
  background: #E8F0F8;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #1B3A5C;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.loan-type-info-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ===== News Section ===== */
.news-section { margin-top: 40px; }
.news-title {
  font-size: 20px;
  font-weight: 700;
  color: #2D3748;
  text-align: center;
  margin-bottom: 24px;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.news-card {
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 1px 8px rgba(27,58,92,0.06);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(27,58,92,0.1);
  color: inherit;
}
.news-card-banner {
  height: 120px;
  background: linear-gradient(135deg, #E8F0F8 0%, #D0E0F0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.news-card-banner-icon { font-size: 40px; opacity: 0.5; }
.news-card-category {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #1B3A5C;
  color: #FFFFFF;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.news-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.news-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #2D3748;
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-summary {
  font-size: 12px;
  color: #718096;
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #E2E8F0;
}
.news-card-date { font-size: 11px; color: #A0AEC0; }
.news-card-more { font-size: 12px; color: #2C5F8A; font-weight: 500; }
.news-more-link {
  text-align: center;
  margin-top: 24px;
}
.news-more-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  border: 2px solid #1B3A5C;
  border-radius: 8px;
  color: #1B3A5C;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}
.news-more-link a:hover {
  background: #1B3A5C;
  color: #FFFFFF;
}

/* ===== Hidden ===== */
.hidden { display: none !important; }

/* ===== Responsive (Index) ===== */
@media (max-width: 768px) {
  .content-grid { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .tab-btn { font-size: 13px; padding: 10px 8px; }
  .tab-btn .tab-sub { font-size: 11px; }
  .result-summary { grid-template-columns: 1fr; }
  .result-item.highlight { grid-column: auto; }
  .faq-grid { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr 1fr; }
  .detail-table { font-size: 12px; }
  .detail-table th, .detail-table td { padding: 8px 6px; }
}
@media (max-width: 480px) {
  .news-grid { grid-template-columns: 1fr; }
}
