/* 公共样式 */
.error-message {
  background: #fff3f3;
  border: 1px solid #ffc9c9;
  color: #c92a2a;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  display: none;
}

.success-message {
  background: #ebfbee;
  border: 1px solid #b2f2bb;
  color: #2b8a3e;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
}

.schedule-table-wrapper {
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  overflow: hidden;
}

/* 双轴固定表格容器 */
.dual-fixed-container {
  position: relative;
  overflow: hidden;
  margin: 16px 0;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

/* 左上角固定区域 */
.corner-fixed {
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 38px;
  background: #f8f9fa;
  border-right: 2px solid #dee2e6;
  border-bottom: 2px solid #dee2e6;
  z-index: 4;
}

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

.corner-table th {
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  line-height: 22px;
}

/* 顶部滚动区域 */
.top-scroll {
  position: absolute;
  top: 0;
  left: 80px;
  right: 0;
  height: 38px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 3;
}

.top-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

.top-table th {
  padding: 8px 12px;
  text-align: right;
  font-weight: 600;
  font-size: 14px;
  line-height: 22px;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  white-space: nowrap;
}

.top-table th:last-child {
  border-right: none;
}

/* 左侧固定区域 */
.left-scroll {
  position: absolute;
  top: 38px;
  left: 0;
  width: 80px;
  bottom: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 2;
}

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

.left-table td {
  padding: 8px 12px;
  text-align: center;
  font-size: 14px;
  line-height: 22px;
  height: 38px;
  border-bottom: 1px solid #dee2e6;
  white-space: nowrap;
}

/* 主体滚动区域 */
.main-scroll {
  position: absolute;
  top: 38px;
  left: 80px;
  right: 0;
  bottom: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
}

.main-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

.main-table td {
  padding: 8px 12px;
  text-align: right;
  font-size: 14px;
  line-height: 22px;
  height: 38px;
  border-right: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
  white-space: nowrap;
}

.main-table td:last-child {
  border-right: none;
}

/* 列宽定义 */
.top-table th:nth-child(1),
.main-table td:nth-child(1) {
  width: 120px;
}

.top-table th:nth-child(2),
.main-table td:nth-child(2) {
  width: 120px;
}

.top-table th:nth-child(3),
.main-table td:nth-child(3) {
  width: 120px;
}

.top-table th:nth-child(4),
.main-table td:nth-child(4) {
  width: 140px;
}

.schedule-table th {
  background: #f8f9fa;
  font-weight: 600;
  text-align: center;
  font-size: 13px;
}

.schedule-table td:first-child,
.schedule-table th:first-child {
  text-align: center;
  position: sticky;
  left: 0;
  background: #f8f9fa;
  z-index: 1;
}

.schedule-table tr:nth-child(even) td:first-child {
  background: #f8f9fa;
}

.schedule-table tr:nth-child(even) {
  background: #fafbfc;
}

.schedule-note {
  color: #868e96;
  font-size: 13px;
  margin: 8px 0;
  text-align: center;
}

/* 提前还款对比表格 */
.compare-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
}

.compare-table th,
.compare-table td {
  border: 1px solid #dee2e6;
  padding: 12px 10px;
  text-align: center;
  white-space: nowrap;
}

.compare-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 13px;
  color: #495057;
  min-width: 90px;
}

.compare-table td:first-child,
.compare-table th:first-child {
  text-align: center;
  position: sticky;
  left: 0;
  background: #f8f9fa;
  z-index: 1;
  min-width: 130px;
  max-width: 130px;
  border-right: 2px solid #dee2e6;
}

.compare-table td:nth-child(2),
.compare-table th:nth-child(2) {
  min-width: 110px;
}

.compare-table td:nth-child(3),
.compare-table th:nth-child(3) {
  min-width: 90px;
}

.compare-table td:nth-child(4),
.compare-table th:nth-child(4) {
  min-width: 100px;
}

.compare-table td:nth-child(5),
.compare-table th:nth-child(5) {
  min-width: 130px;
}

.compare-table .highlight {
  background: #fff3cd;
}

.compare-table .highlight td:first-child {
  background: #ffeeba;
}

/* 滑动提示 */
.swipe-hint {
    text-align: center;
    padding: 8px 0;
    color: #64748b;
    font-size: 12px;
    animation: pulse 2s ease-in-out infinite;
}

.swipe-hint span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* 桌面端隐藏滑动提示 */
@media screen and (min-width: 768px) {
    .swipe-hint {
        display: none;
    }
}

/* 收缩按钮 */
.collapse-button-container {
    text-align: center;
    padding: 12px 0;
    margin-top: 8px;
}

.collapse-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.collapse-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.collapse-button:active {
    transform: translateY(0);
}

/* PC端样式 */
@media screen and (min-width: 768px) {
    .collapse-button-container-mobile {
        display: none;
    }
}

/* 移动端样式 */
@media screen and (max-width: 767px) {
    .collapse-button-top {
        display: none;
    }
    
    .collapse-button-container-mobile {
        text-align: center;
        padding: 12px 0;
        margin-top: 8px;
    }
    
    .schedule-body-wrapper {
        max-height: 300px;
    }
}



.compare-table td:nth-child(2),
.compare-table td:nth-child(5) {
  font-weight: 600;
}

.compare-table td:nth-child(2) {
  color: #212529;
}

.compare-table td:nth-child(5) {
  color: #28a745;
}

.compare-table tr:nth-child(even):not(.highlight) {
  background: #fafbfc;
}

/* 移动端优化 */
@media screen and (max-width: 480px), screen and (max-width: 768px) {
  .schedule-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 12px -8px !important;
    padding: 0 8px !important;
  }
  
  .schedule-table,
  .compare-table {
    font-size: 12px !important;
    min-width: 500px !important;
  }
  
  .schedule-table th,
  .schedule-table td,
  .compare-table th,
  .compare-table td {
    padding: 8px 6px !important;
    font-size: 12px !important;
  }
  
  .schedule-table th,
  .compare-table th {
    font-size: 11px !important;
  }
  
  .compare-table td:first-child,
  .compare-table th:first-child {
    min-width: 90px !important;
  }
  
  .compare-table td:nth-child(5) {
    min-width: 110px !important;
  }
}

/* 可视化图表样式 */
.visualization {
  margin: 24px 0;
}

.pie-chart-container {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.pie-chart {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  position: relative;
}

.pie-legend {
  flex: 1;
  min-width: 200px;
}

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

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

/* 对比表格 */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.compare-table th,
.compare-table td {
  border: 1px solid #dee2e6;
  padding: 12px;
  text-align: center;
}

.compare-table th {
  background: #f1f3f5;
  font-weight: 600;
}

.compare-table .highlight {
  background: #fff3bf;
  font-weight: 600;
}

/* 按钮样式 */
.btn-secondary {
  background: #868e96 !important;
}

.btn-secondary:hover {
  background: #495057 !important;
}

.btn-copy {
  background: #40c057 !important;
  margin-left: 8px;
}

.btn-copy:hover {
  background: #2f9e44 !important;
}

.btn-small {
  padding: 8px 12px !important;
  font-size: 14px !important;
}

/* 历史记录 */
.history-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e9ecef;
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  padding: 12px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin: 8px 0;
  background: #f8f9fa;
}

.history-item:hover {
  background: #e9ecef;
}

.history-date {
  color: #868e96;
  font-size: 12px;
}

.history-content {
  margin: 8px 0;
}

/* 加载动画 */
.loading {
  display: none;
  text-align: center;
  padding: 20px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e9ecef;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 结果卡片 */
.result-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  margin: 16px 0;
}

.result-card h3 {
  margin: 0 0 16px 0;
  color: white;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

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

.result-label {
  opacity: 0.9;
}

.result-value {
  font-weight: 600;
  font-size: 16px;
}

/* 折叠面板 */
.collapsible {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 12px 0;
}

.collapsible-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:hover {
    background: #e9ecef;
}

.collapsible-content {
    padding: 0;
    display: none;
}

.collapsible.open .collapsible-content {
    display: block;
}

.collapsible-content .schedule-table-wrapper {
    border: none;
    border-radius: 0 0 8px 8px;
}

.collapsible-arrow {
    transition: transform 0.3s;
}

.collapsible.open .collapsible-arrow {
    transform: rotate(180deg);
}

/* 底部内容区域 */
.footer-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.footer-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
}

/* ========== UI交互优化样式 ========== */

/* 输入框聚焦效果 */
input:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    transition: all 0.3s ease;
}

/* 按钮样式 */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* 按钮加载状态 */
.btn-primary.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-primary.loading .btn-text {
    visibility: hidden;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 结果卡片美化 */
.result-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.result-card h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1e293b;
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.result-label {
    font-size: 15px;
    color: #64748b;
}

.result-value {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.result-value.highlight {
    color: #dc2626;
    font-size: 22px;
}

.result-value.success {
    color: #059669;
}

/* 复制按钮 */
.copy-btn {
    background: #f1f5f9;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.copy-btn:hover {
    background: #e2e8f0;
    color: #3b82f6;
}

.copy-btn.copied {
    background: #dcfce7;
    color: #16a34a;
}
