/* 首页仪表盘样式 */

.dashboard-container {
    padding: 24px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    min-height: calc(100vh - 128px);
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* 顶部统计卡片 */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.dashboard-stat-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.dashboard-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: all 0.3s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}

.dashboard-stat-card.overdue::before {
    background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
}

.dashboard-stat-card.pending::before {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.dashboard-stat-card.completed::before {
    background: linear-gradient(90deg, #43e97b, #38f9d7);
}

.dashboard-stat-card.in-progress::before {
    background: linear-gradient(90deg, #faad14, #ffc53d);
}

.stat-icon-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.stat-icon.device {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.maintenance {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon.overdue {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
}

.stat-icon.pending {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.completed {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon.in-progress {
    background: linear-gradient(135deg, #faad14 0%, #ffc53d 100%);
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
    margin: 0;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--bg-light);
    border-radius: 6px;
    width: fit-content;
}

.stat-trend.up {
    color: var(--success-color);
}

.stat-trend.down {
    color: var(--danger-color);
}

.stat-trend .icon {
    font-size: 12px;
}

/* 定期工作进度区域 */
.periodic-progress-section {
    background: var(--white);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.section-title h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.section-title .icon {
    font-size: 20px;
}

.progress-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

.progress-card {
    padding: 20px;
    background: var(--bg-light);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.progress-card.overdue {
    border-left-color: #ff6b6b;
}

.progress-card.pending {
    border-left-color: #4facfe;
}

.progress-card.completed {
    border-left-color: #43e97b;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.progress-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.progress-bar-container {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 4px;
    transition: width 0.6s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-bar.overdue {
    background: linear-gradient(90deg, #ff6b6b, #ee5a5a);
}

.progress-bar.pending {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.progress-bar.completed {
    background: linear-gradient(90deg, #43e97b, #38f9d7);
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* 本月/本周进度区域 */
.progress-period-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.progress-period-header {
    margin-bottom: 16px;
}

.progress-period-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.progress-period-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.progress-period-card {
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.progress-period-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.progress-period-card.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.progress-period-card.highlight .period-stat-label {
    color: rgba(255, 255, 255, 0.9);
}

.progress-period-card.highlight .period-stat-value {
    color: #fff;
}

.progress-period-card.highlight .period-stat-value.rate {
    font-size: 24px;
}

.period-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.period-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.period-stat-value.overdue {
    color: #ff6b6b;
}

.period-stat-value.pending {
    color: #4facfe;
}

.period-stat-value.in-progress {
    color: #faad14;
}

.period-stat-value.completed {
    color: #43e97b;
}

.period-stat-value.rate {
    font-size: 20px;
}

/* 快速操作区域 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.quick-action-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px solid transparent;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.quick-action-icon.search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.quick-action-icon.add {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.quick-action-icon.history {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.quick-action-icon.work {
    background: linear-gradient(135deg, #faad14 0%, #ffc53d 100%);
}

.quick-action-info {
    flex: 1;
}

.quick-action-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 4px 0;
}

.quick-action-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

/* 最近活动列表 */
.recent-activities {
    background: var(--white);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.activities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.activities-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.record-count {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.view-all-btn {
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.view-all-btn:hover {
    color: var(--primary-dark);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

.activity-list::-webkit-scrollbar {
    width: 6px;
}

.activity-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.activity-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.activity-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.activity-item:hover {
    background: #f0f0f0;
    transform: translateX(4px);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.activity-icon.maintenance {
    background: rgba(67, 233, 123, 0.15);
    color: #43e97b;
}

.activity-icon.periodic {
    background: rgba(79, 172, 254, 0.15);
    color: #4facfe;
}

.activity-icon.alert {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.activity-detail {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.activity-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* 加载提示 */
.load-more-hint {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid #e0e0e0;
    margin-top: 12px;
}

/* 加载指示器 */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid #e0e0e0;
}

.loading-indicator .loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 加载状态 */
.dashboard-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 16px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .progress-overview {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .dashboard-stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 32px;
    }

    .periodic-progress-section,
    .recent-activities {
        padding: 20px;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-stat-card,
.progress-card,
.quick-action-card,
.activity-item {
    animation: fadeInUp 0.5s ease-out;
}

.dashboard-stat-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-stat-card:nth-child(2) { animation-delay: 0.2s; }
.dashboard-stat-card:nth-child(3) { animation-delay: 0.3s; }
.dashboard-stat-card:nth-child(4) { animation-delay: 0.4s; }
