/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    color: #1e293b;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    color: #1e293b;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #0f172a;
}

header p {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 400;
}

/* 主要内容区域 */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
}

/* 面板通用样式 */
.input-panel, .output-panel {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.panel-header {
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.panel-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
}

/* 货物输入区域 */
.cargo-input {
    margin-bottom: 25px;
}

.cargo-input h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.table-container {
    overflow-x: auto;
    margin-bottom: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

tbody tr:nth-child(even):hover {
    background-color: #f1f5f9;
}

th {
    background: #1e293b;
    color: #f8fafc;
    font-weight: 600;
    position: sticky;
    top: 0;
    letter-spacing: 0.025em;
    font-size: 14px;
    text-transform: uppercase;
    border-bottom: 1px solid #334155;
}

td input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

td input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background-color: #fefefe;
}

td input:hover {
    border-color: #9ca3af;
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-calculate, .btn-remove {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-right: 10px;
}

#loadDemoBtn {
    background: #f59e0b;
    color: white;
    position: relative;
    overflow: hidden;
}

#loadDemoBtn:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

#loadDemoBtn::before {
    content: '✨';
    margin-right: 5px;
}

#downloadTemplateBtn {
    background: #8b5cf6;
    color: white;
    position: relative;
    overflow: hidden;
}

#downloadTemplateBtn:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

#downloadTemplateBtn::before {
    content: '📄';
    margin-right: 5px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.btn-calculate {
    background: #10b981;
    color: white;
    font-size: 16px;
    padding: 16px 32px;
    width: 100%;
    margin-top: 24px;
    font-weight: 600;
}

.btn-calculate:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-remove {
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-remove:hover {
    background: #c0392b;
}

/* 集装箱设置 */
.container-settings {
    margin-bottom: 25px;
}

.container-settings h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.container-types {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.container-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.container-type:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.container-type label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.container-type input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.cost-input {
    width: 150px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 策略设置 */
.strategy-settings {
    margin-bottom: 25px;
}

.strategy-settings h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.strategy-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.strategy-options label {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.strategy-options label:hover {
    background: #e9ecef;
}

.strategy-options input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
}

/* 方案卡片 */
.solution-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.solution-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.solution-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.solution-card.selected {
    border-color: #2ecc71;
    background: linear-gradient(135deg, #d5f4e6, #c8e6c9);
}

.solution-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.solution-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.solution-cost {
    font-size: 1.4rem;
    font-weight: 700;
    color: #e74c3c;
}

.solution-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 14px;
    color: #555;
}

.solution-savings {
    margin-top: 10px;
    padding: 8px 12px;
    background: #2ecc71;
    color: white;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

/* 报告区域 */
.report-section {
    margin-bottom: 25px;
}

.report-section h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.report-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.report-actions {
    display: flex;
    gap: 10px;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-panel, .output-panel {
        padding: 15px;
    }
    
    .solution-details {
        grid-template-columns: 1fr;
    }
    
    .container-type {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cost-input {
        width: 100%;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 提示信息 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 警告和成功提示 */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 10px 0;
    font-weight: 500;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* 详细报告样式 */
.report-placeholder {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #bdc3c7;
}

.report-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.report-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

.report-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.report-summary {
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 5px solid #667eea;
}

.summary-card h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.summary-item .label {
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.summary-item .value {
    font-weight: 700;
    color: #2c3e50;
    font-size: 15px;
}

.summary-item .value.cost {
    color: #e74c3c;
    font-size: 16px;
}

.summary-item .value.utilization {
    color: #27ae60;
    font-size: 16px;
}

.report-details {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 16px;
}

.containers-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

.report-details h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin-bottom: 30px;
    font-weight: 600;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}

.report-details h3::before {
    content: '📋';
    margin-right: 10px;
    font-size: 1.2rem;
}

.container-card {
    background: white;
    border-radius: 20px;
    margin: 25px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 2px solid #f1f3f4;
    transition: all 0.4s ease;
    position: relative;
}

.container-card:first-child {
    margin-top: 0;
}

.container-card:last-child {
    margin-bottom: 0;
}

.container-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    z-index: 1;
}

.container-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
    border-color: #667eea;
}

.container-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 25px;
    position: relative;
    z-index: 2;
}

.container-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.container-title h4 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.container-title h4::before {
    content: '📦';
    font-size: 1.2rem;
    background: rgba(255,255,255,0.25);
    padding: 8px 12px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.container-dimensions {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.9;
}

.dimension-label {
    font-weight: 500;
}

.dimensions {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.container-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255,255,255,0.15);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 80px;
}

.stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 2px;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
}

.stat-value.utilization {
    color: #2ecc71;
}

.cargo-list {
    padding: 0;
}

.cargo-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.cargo-table thead {
    background: #f8f9fa;
}

.cargo-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    position: static;
}

.cargo-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.cargo-table tbody tr:hover {
    background: #f8f9fa;
}

.cargo-name {
    font-weight: 600;
    color: #2c3e50;
}

.cargo-quantity {
    color: #667eea;
    font-weight: 600;
}

.cargo-arrangement {
    color: #7f8c8d;
    font-style: italic;
}

.cargo-weight {
    color: #27ae60;
    font-weight: 500;
}

.details-text {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3e50;
    border-left: 4px solid #667eea;
}

/* 货物详情样式 */
.cargo-details {
    padding: 25px;
    background: #fafbfc;
    border-radius: 0 0 16px 16px;
}

.cargo-details h5 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.cargo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.cargo-item-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cargo-item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.cargo-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.cargo-item-header h6 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}

.cargo-item-header .cargo-quantity {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.cargo-item-details {
    margin-bottom: 15px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row.total {
    background: #e8f5e8;
    margin: 5px -10px;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
}

.detail-label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 600;
}

.detail-value.arrangement {
    background: #fff3cd;
    color: #856404;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.detail-value.dimensions {
    font-family: 'Courier New', monospace;
    color: #495057;
}

.detail-value.weight {
    color: #fd7e14;
}

.detail-value.volume {
    color: #6f42c1;
}

.detail-value.total-weight {
    color: #dc3545;
    font-size: 15px;
}

.detail-value.total-volume {
    color: #6610f2;
    font-size: 15px;
}

.cargo-item-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.loading-efficiency {
    display: flex;
    align-items: center;
    gap: 10px;
}

.efficiency-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    min-width: 60px;
}

.efficiency-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.efficiency-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.efficiency-value {
    font-size: 12px;
    font-weight: 600;
    color: #28a745;
    min-width: 40px;
    text-align: right;
}

.container-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-top: 2px solid #e9ecef;
    border-radius: 0 0 20px 20px;
    position: relative;
}

.container-summary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.summary-stat {
    text-align: center;
    flex: 1;
}

.summary-label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.summary-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

/* 响应式设计 - 报告部分 */
@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .container-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 20px;
    }
    
    .container-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .stat-item {
        flex: 1;
        min-width: 70px;
    }
    
    .cargo-grid {
        grid-template-columns: 1fr;
    }
    
    .cargo-item-card {
        padding: 15px;
    }
    
    .cargo-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .loading-efficiency {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .efficiency-label {
        min-width: auto;
    }
    
    .efficiency-bar {
        width: 100%;
    }
    
    .cargo-table {
        font-size: 12px;
    }
    
    .cargo-table th,
    .cargo-table td {
        padding: 8px;
    }
    
    .report-header h2 {
        font-size: 1.5rem;
    }
    
    .container-title h4 {
        font-size: 1.2rem;
    }
    
    .container-dimensions {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}