/* css/components/pwa.css */

.pwa-install-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #e93b5a; /* 使用主题红色 */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 998; /* 比Toast低，比一般内容高 */
    cursor: pointer;
    text-decoration: none;

    /* 初始状态：隐藏且在屏幕外 */
    opacity: 0;
    transform: translateY(100px);
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s 0.3s;
}

.pwa-install-fab i {
    color: #fff;
    font-size: 24px;
}

.pwa-install-fab:hover {
    background-color: #d1304f; /* 悬停时颜色加深 */
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* 控制显示的class */
.pwa-install-fab.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s;
}

/* --- [新增] PWA 启动/欢迎界面样式 --- */
.pwa-installer-background {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
}

.pwa-installer-window {
    width: 100%;
    max-width: 480px; /* 核心：限制窗口最大宽度，使其不像网页 */
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    padding: 35px 40px;
    box-sizing: border-box;
    transform: scale(0.95);
    opacity: 0;
    animation: fadeInWindow 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    /* [核心修正] 使用flex布局确保内容垂直排列且稳定 */
    display: flex;
    flex-direction: column;
}

@keyframes fadeInWindow {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pwa-icon-container {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 20px auto;
}

/* --- [核心修改] 将光晕动画替换为加载中线条动画 --- */
.pwa-icon-container::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    /* 1. 定义轨道的样式：3px宽的浅灰色实线边框 */
    border: 3px solid rgba(0, 0, 0, 0.1);
    /* 2. 定义加载条头部的颜色，覆盖轨道颜色 */
    border-top-color: #e93b5a; /* 使用主题红色 */
    /* 3. 应用新的旋转动画 */
    animation: spin 1.2s linear infinite;
    z-index: 1;
}

.pwa-icon-container .pwa-app-icon {
    position: relative;
    width: 100%;
    height: 100%;
    /* 强制将图片裁剪为圆形，以匹配动画 */
    border-radius: 50%;
    background-color: #fff;
    padding: 5px;
    box-sizing: border-box;
    z-index: 2;
    object-fit: cover;
}

/* [移除] 旧的旋转动画 */
/* @keyframes rotateGradient ... (已删除) */

/* [新增] 定义新的旋转动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
/* --- 修改结束 --- */


.pwa-welcome-title {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.pwa-welcome-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

/* 优化表单内边距和间距 */
#pwa-dynamic-area .ac-form-group {
    margin-bottom: 18px;
}
#pwa-dynamic-area .ac-form-group label {
    margin-bottom: 8px;
    font-weight: 500;
}
/* 确保图形验证码容器尺寸合理 */
#aliyun-captcha-container {
    width: 100%;
    min-height: 40px;
}
#pwa-dynamic-area .btn-primary {
    width: 100%;
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 16px;
}
/* --- [新增] PWA 启动加载界面样式 --- */
.pwa-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #2c3e50; /* 使用一个深色背景，模仿专业软件 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.pwa-loading-content {
    text-align: center;
}

.pwa-loading-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
    animation: pulse-icon 2s infinite ease-in-out;
}

@keyframes pulse-icon {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pwa-loading-progress-bar {
    width: 250px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.pwa-loading-progress-bar-fill {
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    border-radius: 3px;
    animation: loading-progress 2.5s ease-in-out forwards;
}

@keyframes loading-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(0); }
}

.pwa-loading-status {
    color: #bdc3c7;
    margin-top: 20px;
    font-size: 14px;
}