/* PWA 相關樣式 */

/* Service Worker 更新通知 */
.pwa-update-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    transition: bottom 0.3s ease-in-out;
    max-width: 90%;
    width: 400px;
}

.pwa-update-notification.show {
    bottom: 20px;
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid #667eea;
}

.pwa-update-icon {
    font-size: 1.5rem;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pwa-update-text {
    flex: 1;
    font-weight: 500;
    color: #2d3748;
}

.pwa-update-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.pwa-update-btn:hover {
    background: #5568d3;
}

.pwa-update-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-update-close:hover {
    color: #718096;
}

/* 網路狀態提示 */
.pwa-network-status {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: top 0.3s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 90%;
}

.pwa-network-status.show {
    top: 20px;
}

.pwa-network-status.online {
    background: #48bb78;
    color: white;
}

.pwa-network-status.offline {
    background: #fc8181;
    color: white;
}

.pwa-status-icon {
    font-weight: bold;
    font-size: 1.2rem;
}

/* 安裝橫幅 */
.pwa-install-banner {
    position: fixed;
    bottom: -200px;
    left: 0;
    right: 0;
    z-index: 9998;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    transition: bottom 0.3s ease-in-out;
}

.pwa-install-banner.show {
    bottom: 0;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.pwa-install-icon {
    font-size: 2.5rem;
}

.pwa-install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pwa-install-text strong {
    font-size: 1.1rem;
    color: #2d3748;
}

.pwa-install-text span {
    font-size: 0.9rem;
    color: #718096;
}

.pwa-install-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pwa-install-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.pwa-install-btn:hover {
    background: #5568d3;
}

.pwa-install-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #a0aec0;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-install-close:hover {
    color: #718096;
}

/* 感謝訊息 */
.pwa-thank-you-message {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: #48bb78;
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: top 0.3s ease-in-out;
}

.pwa-thank-you-message.show {
    top: 20px;
}

.pwa-thank-you-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pwa-thank-you-icon {
    font-size: 1.5rem;
    font-weight: bold;
}

.pwa-thank-you-text {
    font-weight: 500;
}

/* iOS 安裝說明彈窗 */
.pwa-ios-install-modal {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: white;
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transition: bottom 0.3s ease-in-out;
    max-height: 80vh;
    overflow-y: auto;
}

.pwa-ios-install-modal.show {
    bottom: 0;
}

.pwa-ios-install-content {
    padding: 2rem;
    position: relative;
}

.pwa-ios-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #a0aec0;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-ios-close:hover {
    color: #718096;
}

.pwa-ios-install-content h3 {
    margin-top: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.pwa-ios-install-content p {
    color: #718096;
    margin: 1rem 0;
}

.pwa-ios-install-content ol {
    padding-left: 1.5rem;
}

.pwa-ios-install-content li {
    margin: 0.75rem 0;
    color: #4a5568;
    font-size: 1.05rem;
}

.pwa-ios-icon {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 1.2rem;
}

/* Standalone 模式樣式調整 */
.pwa-standalone {
    /* 在 standalone 模式下可以調整一些樣式 */
}

.pwa-standalone .navbar {
    /* 例如增加頂部安全區域 */
    padding-top: env(safe-area-inset-top);
}

/* 手動安裝按鈕 */
.pwa-manual-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .pwa-install-content {
        flex-wrap: wrap;
    }

    .pwa-install-text {
        width: 100%;
        text-align: center;
    }

    .pwa-install-actions {
        width: 100%;
        justify-content: center;
    }

    .pwa-update-notification {
        width: 95%;
    }

    .pwa-update-content {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
}

/* 深色模式支援（可選） */
@media (prefers-color-scheme: dark) {
    .pwa-update-content,
    .pwa-install-banner {
        background: #2d3748;
        border-color: #4a5568;
    }

    .pwa-update-text,
    .pwa-install-text strong {
        color: #e2e8f0;
    }

    .pwa-install-text span {
        color: #a0aec0;
    }

    .pwa-ios-install-modal,
    .pwa-ios-install-content {
        background: #2d3748;
    }

    .pwa-ios-install-content h3 {
        color: #e2e8f0;
    }

    .pwa-ios-install-content p,
    .pwa-ios-install-content li {
        color: #a0aec0;
    }
}
