/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f7fafc;
    color: #2d3748;
    animation: fadeIn 0.5s ease-in;
}

/* 全局动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 头部导航样式 */
.header {
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: slideIn 0.5s ease-out;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.header-logo h2 {
    margin: 0;
    color: #2d3748;
    font-size: 22px;
    font-weight: 700;
}

.header-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 25px;
}

.header-nav a {
    text-decoration: none;
    color: #4a5568;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s ease, border-bottom 0.2s ease;
    padding-bottom: 20px;
    border-bottom: 3px solid transparent;
}

.header-nav a:hover, .header-nav a.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    padding-top: 20px;
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
}

/* 可滚动内容容器样式 */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    border-radius: 12px;
    padding-right: 10px;
}

/* 自定义滚动条样式 */
.scrollable-content::-webkit-scrollbar {
    width: 8px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 为容器内的主要元素添加过渡效果 */
.container > * {
    transition: all 0.3s ease;
}

/* 标题样式 */
h1 {
    text-align: center;
    color: #1a365d;
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* 日期选择器样式 */
.date-selector {
    margin-bottom: 10px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.date-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.date-presets {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-selector label {
    margin: 0;
    font-weight: 600;
    color: #4a5568;
    white-space: nowrap;
}

.date-selector input[type="datetime-local"] {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background-color: #ffffff;
    color: #2d3748;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 200px;
}

.date-selector input[type="datetime-local"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.date-selector button {
    margin-left: 0;
    padding: 10px 24px;
    background-color: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.3);
}

.date-selector button:hover {
    background-color: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(66, 153, 225, 0.4);
}

.date-selector button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.3);
}

/* 预设日期按钮样式 */
.date-selector .date-presets .preset-btn {
    padding: 8px 16px;
    background-color: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.date-selector .date-presets .preset-btn:hover {
    background-color: #edf2f7;
    border-color: #cbd5e0;
    color: #2d3748;
}

.date-selector .date-presets .preset-btn:active {
    background-color: #e2e8f0;
    transform: translateY(1px);
}

.date-selector .date-presets .preset-btn.active {
    background-color: #4299e1;
    color: #000000 !important;
    border-color: #4299e1;
}

/* 确保所有选中状态下都应用黑色文字 */
.date-selector .date-presets .preset-btn.active:hover,
.date-selector .date-presets .preset-btn.active:active,
.date-selector .date-presets .preset-btn.active:focus {
    color: #000000 !important;
}

/* 图表容器样式 */
#myChart {
    width: 100% !important;
    flex: 1;
    min-height: 350px;
    height: auto !important;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0;
    box-sizing: content-box;
    border: 1px solid #e2e8f0;
    opacity: 0;
    animation: fadeIn 0.8s ease-in forwards;
    animation-delay: 0.2s;
}

/* 为图表容器添加加载状态 */
#myChart.loading {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* 自动刷新开关样式 */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-top: 20px;
    margin-left: 20px;
    gap: 12px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    cursor: pointer;
    width: 50px;
    height: 24px;
    background-color: #cbd5e0;
    transition: all 0.3s ease;
    border-radius: 12px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background-color: #4299e1;
}

input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

input:checked + .slider:before {
    transform: translateX(26px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch span:last-child {
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
}

/* 信息显示样式 */
#msgbox {
    font-size: 20px;
    font-weight: 700;
    color: #4299e1;
    margin: 15px 0;
    display: inline-block;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
        padding-top: 30px;
    }
    
    .date-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-selector label {
        margin-bottom: 5px;
    }
    
    .date-selector input[type="datetime-local"] {
        width: 100%;
        min-width: auto;
    }
    
    .date-selector button {
        width: 100%;
    }
    
    .date-presets {
        gap: 5px;
    }
    
    .preset-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 15px;
    }
    
    .header-nav ul {
        gap: 15px;
    }
    
    .header-nav a {
        font-size: 14px;
        padding-bottom: 15px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .stats-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    #myChart {
        height: 400px !important;
        padding: 10px;
    }
    
    .header-logo h2 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .header-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .date-presets {
        flex-direction: column;
    }
    
    .switch span:last-child {
        font-size: 12px;
    }
}

.container > div:nth-child(3) {
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
    color: #718096;
}

.container > div:nth-child(3) span:first-child,
.container > div:nth-child(3) span:last-child {
    color: #cbd5e0;
}

/* 统计卡片样式 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
    animation: fadeIn 0.5s ease-in;
    animation-delay: 0.3s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.stat-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

/* 停机时间统计样式 */
.downtime-section {
    margin-top: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 20px;
    animation: fadeIn 0.8s ease-in;
    animation-delay: 0.4s;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* 停机时间统计样式 */
.downtime-section {
    margin-top: 40px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 30px;
    animation: fadeIn 0.8s ease-in;
    animation-delay: 0.4s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.downtime-section h2 {
    color: #1a365d;
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.downtime-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.downtime-table th {
    background-color: #f7fafc;
    color: #4a5568;
    font-weight: 600;
    text-align: left;
    padding: 16px 20px;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.downtime-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
    transition: background-color 0.2s ease;
}

.downtime-table tr:hover td {
    background-color: #f7fafc;
}

.downtime-table tr:last-child td {
    border-bottom: none;
}

/* 响应式表格设计 */
@media (max-width: 768px) {
    .downtime-section {
        padding: 20px;
    }
    
    .downtime-section h2 {
        font-size: 20px;
    }
    
    .downtime-table th,
    .downtime-table td {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .table-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

.stat-card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 16px;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #4299e1;
}

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #718096;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #1a365d;
    line-height: 1.2;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    #myChart {
        height: 500px !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .date-selector {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .date-selector label, .date-selector input, .date-selector button {
        margin: 0;
        width: 100%;
    }
    
    .date-selector input[type="datetime-local"] {
        font-size: 16px;
        padding: 12px 16px;
    }
    
    #myChart {
        height: 400px !important;
        padding: 10px;
    }
    
    .switch {
        margin: 15px 0 10px 10px;
    }
    
    #msgbox {
        font-size: 18px;
    }
}