/* ==================== 基于路由的页面容器样式 ==================== */

/* 页面容器基础样式 */
.page-container {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 540px;
    height: 100vh;
    height: 100dvh;
    background: #f5f5f5;
    overflow: hidden;
    display: none; /* 默认隐藏 */
    z-index: 100; /* 低于左侧菜单(200)和遮罩层 */
}

/* 激活的页面 */
.page-container.active {
    display: block;
}

/* 页面内容 */
.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
}

/* ==================== 子页面通用头部 ==================== */
.page-header {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    height: 48px;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* 返回按钮 */
.page-back-btn {
    cursor: pointer;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: all 0.2s ease;
}

.page-back-btn:hover {
    transform: scale(1.1);
}

.page-back-btn:active {
    transform: scale(0.95);
}

.page-back-btn img,
.page-back-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    transition: color 0.3s ease;
}

.page-back-btn img {
    object-fit: contain;
}

.page-back-btn svg {
    color: var(--primary-color, #ff9500);
}

.page-back-btn:hover svg {
    color: var(--primary-light, #ffad33);
}

/* SVG返回按钮样式 - 支持主题切换 */
.page-back-btn.project-back-svg svg {
    width: 24px;
    height: 24px;
    display: block;
    color: var(--primary-color, #ff9500);
    transition: color 0.3s ease;
}

.page-back-btn.project-back-svg:hover svg {
    color: var(--primary-light, #ffad33);
}

/* 页面标题 */
.page-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 17px;
    font-weight: 600;
    color: #333;
    z-index: 1;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 右侧图标 */
.page-right-icon {
    cursor: pointer;
    position: relative;
    z-index: 2;
    font-size: 22px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.page-right-icon:hover {
    background: rgba(255, 149, 0, 0.1);
    transform: scale(1.1);
}

.page-right-icon:active {
    transform: scale(0.95);
}

.page-right-icon img {
    max-width: 100%;
    max-height: 100%;
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

/* ==================== 页面主体 ==================== */
.page-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: #f5f5f5;
}

/* ==================== 外部页面iframe容器 ==================== */
.external-iframe-container {
    position: relative;
    background: white;
}

.external-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.external-page-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #ff9500;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

.loading-url {
    margin-top: 12px;
    font-size: 15px;
    color: #ff9500;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ==================== 首页特殊处理 ==================== */
/* 首页保持原有布局，不使用page-content */
#page-home {
    background: white;
}

#page-home .main-container {
    width: 100%;
    height: 100%;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .page-header {
        padding: 6px 12px;
    }
    
    .page-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 6px 8px;
    }
    
    .page-title {
        font-size: 15px;
    }
}

/* ==================== 页面切换动画（可选） ==================== */
.page-container {
    transition: opacity 0.2s ease;
    opacity: 0;
}

.page-container.active {
    opacity: 1;
}

/* 页面进入动画 */
@keyframes pageSlideIn {
    from {
        transform: translateX(-50%) translateX(100%);
    }
    to {
        transform: translateX(-50%) translateX(0);
    }
}

.page-container.slide-in {
    animation: pageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 页面退出动画 */
@keyframes pageSlideOut {
    from {
        transform: translateX(-50%) translateX(0);
    }
    to {
        transform: translateX(-50%) translateX(100%);
    }
}

.page-container.slide-out {
    animation: pageSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

