/* ==================== 错误处理优化 ==================== */

/* 错误消息容器 */
.error-message {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-left: 4px solid var(--color-error, #ef4444);
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    display: flex;
    gap: 16px;
    align-items: start;
    animation: error-slide-in 0.3s ease;
}

@keyframes error-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-icon {
    font-size: 32px;
    flex-shrink: 0;
    animation: error-shake 0.5s ease;
}

@keyframes error-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.error-content {
    flex: 1;
}

.error-content h4 {
    margin: 0 0 8px 0;
    color: var(--color-error, #ef4444);
    font-size: 1.1rem;
}

.error-content p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.error-actions .btn {
    min-width: 100px;
}

/* 警告消息 */
.warning-message {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
    border-left: 4px solid var(--color-warning, #f59e0b);
}

.warning-message .error-icon {
    animation: warning-pulse 1.5s ease infinite;
}

@keyframes warning-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.warning-message h4 {
    color: var(--color-warning, #f59e0b);
}

/* 信息消息 */
.info-message {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-left: 4px solid var(--color-info, #3b82f6);
}

.info-message h4 {
    color: var(--color-info, #3b82f6);
}

/* 成功消息 */
.success-message {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-left: 4px solid var(--color-success, #10b981);
}

.success-message h4 {
    color: var(--color-success, #10b981);
}

.success-message .error-icon {
    animation: success-bounce 0.6s ease;
}

@keyframes success-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* 错误详情折叠 */
.error-details {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.error-details.expanded {
    max-height: 300px;
    overflow-y: auto;
}

.error-details-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 0;
    text-decoration: underline;
}

.error-details-toggle:hover {
    color: var(--accent-color);
}

/* 空状态设计 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 16px;
}

.empty-icon {
    font-size: 64px;
    opacity: 0.5;
    animation: empty-float 3s ease-in-out infinite;
}

@keyframes empty-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.empty-state h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 8px;
}

/* 重试按钮特效 */
.retry-button {
    position: relative;
    overflow: hidden;
}

.retry-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.retry-button:active::before {
    width: 300px;
    height: 300px;
}

/* 网络状态指示器 */
.network-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.network-status.visible {
    transform: translateY(0);
    opacity: 1;
}

.network-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-success);
    animation: network-pulse 2s ease infinite;
}

.network-status.offline .network-status-dot {
    background: var(--color-error);
    animation: none;
}

@keyframes network-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.network-status-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .error-message {
        flex-direction: column;
        padding: 16px;
    }

    .error-icon {
        font-size: 24px;
    }

    .error-actions {
        width: 100%;
    }

    .error-actions .btn {
        flex: 1;
        min-width: auto;
    }

    .empty-state {
        padding: 40px 20px;
    }

    .empty-icon {
        font-size: 48px;
    }

    .network-status {
        bottom: 80px;
        right: 16px;
        left: 16px;
    }
}

/* 暗色主题优化 */
[data-theme="dark"] .error-details {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .network-status {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
}