* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.calculator-container {
    max-width: 1400px;
    margin: 50px auto;
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 功能按钮样式 */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

/* 筛选功能样式 */
.filter-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.filter-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: end;
}

.filter-controls .input-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.filter-controls select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.filter-controls select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.filter-result {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#filter-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

#filter-btn:hover {
    background-color: #2980b9;
}

#reset-filter-btn {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

#reset-filter-btn:hover {
    background-color: #7f8c8d;
}

.filter-controls .button-group {
    margin-top: 0;
}

@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls .input-group {
        min-width: auto;
    }
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#generate-btn {
    background-color: #3498db;
    color: white;
}

#generate-btn:hover {
    background-color: #2980b9;
}

#import-btn {
    background-color: #f39c12;
    color: white;
}

#import-btn:hover {
    background-color: #e67e22;
}

#export-btn {
    background-color: #27ae60;
    color: white;
}

#export-btn:hover {
    background-color: #229954;
}

/* 合计栏样式 */
.loan-table tfoot {
    background-color: #f8f9fa;
    font-weight: bold;
}

.loan-table tfoot td {
    padding: 12px;
    border-top: 2px solid #3498db;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 24px;
}

h2 {
    color: #34495e;
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

h3 {
    color: #7f8c8d;
    margin-bottom: 15px;
    font-size: 16px;
}

.input-section {
    flex: 1;
    margin-right: 30px;
}

.horizontal-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.results-container {
    flex: 1;
    min-width: 300px;
}

@media (max-width: 992px) {
    .horizontal-layout {
        flex-direction: column;
    }
    
    .input-section {
        margin-right: 0;
        margin-bottom: 30px;
    }
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="number"], input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

#calculate-btn {
    background-color: #3498db;
    color: white;
}

#calculate-btn:hover {
    background-color: #2980b9;
}

#add-loan-btn {
    background-color: #27ae60;
    color: white;
}

#add-loan-btn:hover {
    background-color: #229954;
}

.result-section, .summary-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.label {
    font-weight: bold;
    color: #555;
}

.value {
    font-size: 18px;
    font-weight: bold;
    color: #27ae60;
}

.loan-list-section {
    margin-bottom: 30px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.loan-list {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.loan-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
}

.loan-table th, .loan-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loan-table th {
    background-color: #3498db;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    font-size: 12px;
}

.loan-table th:first-child {
    width: 80px;
}

.loan-table th:nth-child(2),
.loan-table th:nth-child(3),
.loan-table th:nth-child(7),
.loan-table th:nth-child(8),
.loan-table th:nth-child(10),
.loan-table th:nth-child(11) {
    width: 100px;
}

.loan-table th:nth-child(4) {
    width: 50px;
}

.loan-table th:nth-child(5) {
    width: 80px;
}

.loan-table th:nth-child(6) {
    width: 70px;
}

.loan-table th:nth-child(9) {
    width: 70px;
}

.loan-table th:last-child {
    width: 140px;
}

.loan-table td {
    font-size: 12px;
}

.loan-table tr:hover {
    background-color: #f5f5f5;
}

.loan-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.view-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    margin-right: 4px;
    width: 65px;
    text-align: center;
}

.view-btn:hover {
    background-color: #2980b9;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    width: 65px;
    text-align: center;
}

.delete-btn:hover {
    background-color: #c0392b;
}

.empty-message {
    text-align: center;
    color: #7f8c8d;
    padding: 40px 0;
}

.loan-detail-section {
    margin-bottom: 30px;
}

.loan-detail {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
}

.loan-detail table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.loan-detail table th, .loan-detail table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.loan-detail table th {
    background-color: #3498db;
    color: white;
    font-weight: bold;
}

.loan-detail table tr:hover {
    background-color: #f5f5f5;
}

.loan-detail table tr.paid {
    background-color: #e8f5e8;
    color: #27ae60;
}

.repay-btn {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.repay-btn:hover {
    background-color: #229954;
}

.paid-status {
    color: #27ae60;
    font-weight: bold;
    font-size: 12px;
}

.explanation {
    background-color: #e8f4f8;
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid #3498db;
    margin-top: 30px;
}

.explanation p {
    margin-bottom: 8px;
    color: #555;
}

@media (max-width: 768px) {
    .calculator-container {
        margin: 20px;
        padding: 20px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    input[type="number"], input[type="text"] {
        padding: 10px;
    }
    
    .button-group button {
        padding: 12px;
    }
    
    .loan-item-info {
        grid-template-columns: 1fr;
    }
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 10px;
}

.delete-btn:hover {
    background-color: #c0392b;
}