/* SPA路由核心样式 */
/* 所有类名使用 spa- 前缀避免冲突 */

/* 容器样式 */
.spa-router-container {
    position: relative;
    min-height: 400px;
}

/* 过渡动画 */
.spa-transition {
    animation: spa-fade-in 0.3s ease forwards;
}

@keyframes spa-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载器样式 */
.spa-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 10000;
    overflow: hidden;
}

.spa-loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
}

.spa-loader-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #e4393c, #ff6b6b);
    animation: spa-loader-animation 1.5s ease-in-out infinite;
}

@keyframes spa-loader-animation {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(300%);
    }
}

/* 加载状态 */
body.spa-loading {
    cursor: wait;
}

body.spa-loading * {
    pointer-events: none;
}

/* 错误提示样式 */
.spa-error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    animation: spa-slide-in 0.3s ease forwards;
}

.spa-error-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #ffecec;
    border: 1px solid #ffcccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    max-width: 400px;
}

.spa-error-icon {
    font-size: 18px;
    margin-right: 10px;
    flex-shrink: 0;
}

.spa-error-text {
    flex: 1;
    color: #e4393c;
    font-size: 14px;
    line-height: 1.4;
}

.spa-error-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    margin-left: 10px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.spa-error-close:hover {
    color: #333;
}

/* 错误状态 */
body.spa-error {
    position: relative;
}

body.spa-error::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.02);
    z-index: 9999;
    pointer-events: none;
}

@keyframes spa-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 路由链接样式 */
a.spa-active {
    color: #e4393c;
    font-weight: bold;
    position: relative;
}

a.spa-active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e4393c;
    border-radius: 1px;
}

/* 禁用拦截的链接 */
a.spa-no-intercept {
    cursor: pointer;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .spa-error-message {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .spa-error-content {
        min-width: auto;
        max-width: none;
    }
}

/* 打印样式 */
@media print {
    .spa-loader,
    .spa-error-message {
        display: none !important;
    }
    
    .spa-router-container {
        animation: none !important;
    }
}