* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    padding: 15px;
    background-color: #f5f7f9;
    max-width: 100%;
}

.section {
    background-color: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.section-title {
    font-size: 16px;
    color: #3498db;
    margin-bottom: 10px;
    border-left: 4px solid #3498db;
    padding-left: 8px;
}

.btn {
    padding: 6px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    font-size: 12px;
    display: inline-block;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-success {
    background-color: #27ae60;
}

.btn:hover {
    opacity: 0.9;
}

.btn:active {
    transform: scale(0.95);
}

.btn:disabled {
    background-color: #95a5a6 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

input, select {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 12px;
    display: inline-block;
}

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

.main-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.row {
    display: flex;
    gap: 15px;
    width: 100%;
}

.row .section {
    flex: 1;
    width: 50%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.row-first .section {
    min-height: 230px;
}

.data-table th {
    background-color: #3498db;
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

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

.data-table tbody tr:hover {
    background-color: #d5e8f0;
}

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

.data-table tbody tr:nth-child(even):hover {
    background-color: #d5e8f0;
}

/* 统一表格基础样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.data-table th, .data-table td {
    border: 1px solid #ddd;
    padding: 4px 6px;
    text-align: center;
}

/* 特定表格的差异化样式 */
#dataTable .data-table th,
#dataTable .data-table td {
    white-space: nowrap;
}

.table-container {
    width: 100%;
    overflow: auto;
    flex: 1;
    max-height: 500px;
    padding-right: 8px;
    box-sizing: border-box;
}

.tip {
    color: #7f8d8d;
    font-size: 11px;
    margin-top: 5px;
}

.import-area {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    min-width: 0;
}

.import-area .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.import-area input[type="file"] {
    flex-shrink: 1;
    min-width: 80px;
    max-width: 200px;
}

.import-info {
    margin-left: 8px;
    font-weight: bold;
    color: #3498db;
    font-size: 12px;
    white-space: nowrap;
}

.local-count {
    font-size: 13px;
    color: #2c3e50;
}

.local-count span {
    font-weight: bold;
}

.search-area {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    min-width: 0;
}

.search-area label {
    font-size: 13px;
    color: #2c3e50;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-area select {
    flex-shrink: 0;
}

.search-area input[type="text"] {
    flex: 1;
    flex-shrink: 1;
    min-width: 100px;
    max-width: 300px;
}

.search-area .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.stats-bar {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    font-size: 12px;
}

.stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stats-bar .stat-label {
    color: #2c3e50;
}

.stats-bar .stat-value {
    font-weight: bold;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #2c3e50;
    transition: all 0.2s ease;
}

.pagination button:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination button:active {
    transform: scale(0.9);
}

.pagination button.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination button:disabled {
    background-color: #ecf0f1;
    color: #95a5a6;
    cursor: not-allowed;
    border-color: #ddd;
}

.pagination-info {
    font-size: 12px;
    color: #7f8d8d;
    margin: 0 8px;
}

.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.nav-tab {
    padding: 12px 40px;
    font-size: 18px;
    color: #7f8d8d;
    cursor: pointer;
    margin-bottom: -2px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: "Microsoft YaHei", sans-serif;
    font-weight: bold;
}

.nav-tab:hover {
    color: #3498db;
}

.nav-tab:active {
    transform: scale(0.95);
}

.nav-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: bold;
}

.page-content {
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s ease;
    height: 0;
    overflow: hidden;
}

.page-content.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    height: auto;
    overflow: visible;
}

.comp-row-first .section {
    min-height: 200px;
}

.comp-row-second .section {
    min-height: 300px;
}

.comp-row-third .section {
    min-height: 320px;
}

#compDataTable {
    width: 100%;
    overflow: auto;
    flex: 1;
    max-height: 500px;
    padding-right: 8px;
    box-sizing: border-box;
}

#compDataTable .table-wrapper {
    display: inline-block;
    min-width: 100%;
}

#compDataTable .data-table th,
#compDataTable .data-table td {
    white-space: nowrap;
}

#compDataTable .data-table th {
    background-color: #3498db;
    color: white;
    position: sticky;
    top: 0;
}

#selectTable {
    table-layout: fixed;
}

#selectTable th, #selectTable td {
    padding: 3px 2px;
}

#selectTable th {
    background-color: #3498db;
    color: white;
    position: sticky;
    top: 0;
}

.col-check { width: 5%; }
.col-id { width: 12%; }
.col-date { width: 18%; }
.col-delta { width: 15%; }

.result-box {
    padding: 8px;
    background-color: #ecf0f1;
    border-radius: 6px;
    margin-top: 10px;
}

.result-item {
    margin: 8px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-item label {
    width: 100px;
    font-weight: bold;
    color: #2c3e50;
}

.result-item input {
    flex: 1;
    min-width: 100px;
}

.highlight {
    color: #e74c3c;
    font-weight: bold;
}

.highlight-green {
    color: #27ae60;
    font-weight: bold;
}

.result-display {
    display: flex;
    align-items: center;
    gap: 0;
}

.result-display .result-label {
    width: 100px;
    font-weight: bold;
    color: #2c3e50;
    flex-shrink: 0;
}

.result-display .result-value {
    flex: 1;
    min-width: 60px;
    text-align: left;
}

.result-display .result-unit {
    width: 30px;
    flex-shrink: 0;
}

#chart-container {
    width: 100%;
    flex: 1;
    height: 250px;
    min-height: 200px;
    position: relative;
}

.fit-selector {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.auto-fit-feedback {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    font-size: 13px;
    font-weight: bold;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.auto-fit-feedback.show {
    opacity: 1;
    transform: translateX(0);
}

.auto-fit-feedback.success {
    color: #27ae60;
}

.auto-fit-feedback.error {
    color: #e74c3c;
}

.auto-fit-feedback .feedback-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 6px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    color: white;
    animation: feedbackPop 0.4s ease;
}

.auto-fit-feedback.success .feedback-icon {
    background-color: #27ae60;
}

.auto-fit-feedback.error .feedback-icon {
    background-color: #e74c3c;
}

@keyframes feedbackPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes feedbackShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.auto-fit-feedback.error {
    animation: feedbackShake 0.5s ease;
}

tr.excluded {
    background-color: #ffebee !important;
    color: #b71c1c;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-title {
    font-size: 16px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 16px;
}

.modal-message {
    font-size: 14px;
    color: #555;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.modal-btn {
    padding: 8px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s, transform 0.15s ease;
}

.modal-btn:hover {
    opacity: 0.9;
}

.modal-btn:active {
    transform: scale(0.95);
}

.modal-btn-confirm {
    background-color: #e74c3c;
    color: white;
}

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

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 10px 24px;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: bold;
    z-index: 99999;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background-color: #27ae60;
}

.toast-error {
    background-color: #e74c3c;
}

.toast-info {
    background-color: #3498db;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state .empty-text {
    font-size: 14px;
}

.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f7f9;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.password-box {
    background-color: white;
    padding: 40px 50px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 380px;
    min-width: 320px;
}

.password-title {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: bold;
}

.password-subtitle {
    font-size: 13px;
    color: #7f8d8d;
    margin-bottom: 25px;
}

.password-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.password-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    font-family: "Microsoft YaHei", sans-serif;
}

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

.password-btn {
    width: 100%;
    padding: 10px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-family: "Microsoft YaHei", sans-serif;
}

.password-btn:hover {
    opacity: 0.9;
}

.password-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 12px;
    display: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

@keyframes unlockSuccess {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

@keyframes checkmark {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.unlock-success {
    animation: unlockSuccess 0.6s ease-in-out forwards;
}

.unlock-checkmark {
    font-size: 64px;
    color: #27ae60;
    animation: checkmark 0.5s ease-out forwards;
    display: none;
}

.unlock-checkmark.show {
    display: block;
}

.password-overlay.hidden {
    display: none;
}

@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }
    .title {
        font-size: 16px;
        margin-bottom: 15px;
    }
    .section {
        padding: 10px;
        margin-bottom: 10px;
        overflow: hidden;
    }
    .section-title {
        font-size: 14px;
        margin-bottom: 8px;
    }
    .row {
        flex-direction: column;
        gap: 10px;
    }
    .row .section {
        width: 100%;
        min-height: 0;
    }
    #dataTable table,
    #compDataTable table,
    #selectTable {
        font-size: 10px;
    }
    #dataTable th, #dataTable td,
    #compDataTable th, #compDataTable td,
    #selectTable th, #selectTable td {
        padding: 3px 2px;
    }
    input, select, .btn {
        font-size: 12px;
        padding: 8px 10px;
        margin-right: 4px;
    }
    .tip {
        font-size: 10px;
    }
    .modal-content {
        padding: 20px;
        max-width: 300px;
    }
    .modal-title {
        font-size: 14px;
    }
    .modal-message {
        font-size: 12px;
    }
    .table-container {
        max-height: 400px;
    }
    .nav-tab {
        padding: 10px 20px;
        font-size: 15px;
    }
}

@media (max-width: 900px) {
    .import-area {
        gap: 8px;
    }
    .search-area {
        gap: 8px;
    }
}

@media (max-width: 768px) {
    .import-area {
        flex-wrap: wrap;
        gap: 8px;
    }
    .import-area input[type="file"] {
        min-width: 0;
        max-width: none;
        flex: 1 1 120px;
    }
    .import-area .btn {
        flex-shrink: 0;
    }
}

@media (max-width: 700px) {
    .search-area {
        gap: 4px;
    }
    .search-area input[type="text"] {
        min-width: 80px;
    }
}
