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

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

/* 头部样式 */
header {
    background-color: #4CAF50;
    color: white;
    padding: 1rem;
    text-align: center;
    position: relative;
}

.install-btn {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    background-color: white;
    color: #4CAF50;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.install-btn:hover {
    background-color: #f0f0f0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 主内容区域 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 上传区域 */
.upload-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.upload-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.upload-btn-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.upload-btn-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-btn,
.export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1rem;
    height: 48px;
    box-sizing: border-box;
    width: 200px;
    text-align: center;
    flex: none;
    font-family: inherit;
    border: none;
}

.upload-btn {
    background-color: #4CAF50;
}

.upload-btn-wrapper:hover .upload-btn {
    background-color: #45a049;
}

.export-btn {
    background-color: #2196F3;
}

.export-btn:hover {
    background-color: #0b7dda;
}

.export-btn:hover {
    background-color: #0b7dda;
}

.export-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 配置区域 */
.config-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.date-pickers {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.date-pickers label {
    margin-right: 0.5rem;
}

.date-pickers span {
    margin: 0 0.5rem;
}

.date-pickers input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.date-pickers input[type="number"] {
    width: 100px;
}

.allowance-wrapper {
    margin-left: auto;
}

#allowance {
    text-align: right;
}

/* 表格区域 */
.sampling-overview-section,
.personnel-overview-section,
.driver-overview-section {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow-x: auto;
}

/* 筛选区域 */
.filter-container {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-container select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1;
    min-width: 150px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    table-layout: fixed;
}

#samplingOverviewTable th,
#samplingOverviewTable td {
    width: 33.33%;
}

#personnelOverviewTable th,
#personnelOverviewTable td {
    width: 20%;
}

#driverOverviewTable th,
#driverOverviewTable td {
    width: 50%;
}

table th,
table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#samplingOverviewTable th:nth-child(3),
#samplingOverviewTable td:nth-child(3),
#personnelOverviewTable th:nth-child(2),
#personnelOverviewTable td:nth-child(2),
#personnelOverviewTable th:nth-child(3),
#personnelOverviewTable td:nth-child(3),
#personnelOverviewTable th:nth-child(4),
#personnelOverviewTable td:nth-child(4),
#personnelOverviewTable th:nth-child(5),
#personnelOverviewTable td:nth-child(5),
#driverOverviewTable th:nth-child(2),
#driverOverviewTable td:nth-child(2) {
    text-align: right;
}

table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

table tfoot {
    font-weight: bold;
    background-color: #f2f2f2;
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: white;
    padding: 1rem;
    text-align: center;
    margin-top: 2rem;
}

/* 更新通知样式 */
.update-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2196F3;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1001;
    animation: slideUp 0.3s ease;
}

.update-notification.show {
    display: flex;
}

.update-btn {
    background-color: white;
    color: #2196F3;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.update-btn:hover {
    background-color: #f0f0f0;
}

.dismiss-btn {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.dismiss-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 4px;
    color: white;
    z-index: 1000;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    max-width: 300px;
    word-wrap: break-word;
}

.toast-success {
    background-color: #4CAF50;
}

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

.toast-warning {
    background-color: #ff9800;
}

.toast-info {
    background-color: #2196F3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    
    .upload-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .upload-btn-wrapper,
    .upload-btn,
    .export-btn {
        width: 100%;
        max-width: none;
    }
    
    .date-pickers {
        flex-direction: column;
        align-items: stretch;
    }
    
    .allowance-wrapper {
        margin-left: 0;
        margin-top: 1rem;
    }
    
    .date-pickers input {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    .date-pickers input[type="number"] {
        width: 100%;
    }
    
    .filter-container {
        flex-direction: column;
    }
    
    .filter-container select {
        margin-bottom: 0.5rem;
        width: 100%;
    }
    
    table {
        font-size: 0.85rem;
        table-layout: auto;
    }
    
    table th,
    table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
    }
    
    .update-notification {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        padding: 12px 16px;
        flex-direction: column;
        text-align: center;
    }
    
    .update-notification.show {
        display: flex;
    }
    
    .update-btn,
    .dismiss-btn {
        width: 100%;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0.5rem;
    }
    
    .upload-section,
    .config-section,
    .sampling-overview-section,
    .personnel-overview-section,
    .driver-overview-section {
        padding: 1rem;
        border-radius: 4px;
    }
    
    header {
        padding: 0.8rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .install-btn {
        top: 1rem;
        right: 1rem;
        transform: none;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    table th,
    table td {
        padding: 0.3rem;
    }
}