/* PWA 增強功能樣式 */

/* 安裝橫幅 */
.pwa-install-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: bottom 0.3s ease-in-out;
}

.pwa-install-banner.show {
    bottom: 0;
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.install-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.install-banner-text {
    flex: 1;
}

.install-banner-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.install-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

#pwa-install-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

#pwa-install-btn:hover {
    transform: scale(1.05);
}

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-close:hover {
    opacity: 1;
}

/* 網路狀態提示 */
.network-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.network-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #10b981;
    color: white;
}

.toast-warning {
    background: #f59e0b;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

/* 通知權限提示 */
.notification-prompt {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    max-width: 350px;
    z-index: 9998;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.notification-prompt.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-prompt-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification-prompt-icon {
    font-size: 2.5rem;
    text-align: center;
}

.notification-prompt-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.notification-prompt-text p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

#enable-notifications {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#enable-notifications:hover {
    background: #5568d3;
}

#dismiss-notifications {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#dismiss-notifications:hover {
    background: #f3f4f6;
}

/* 更新通知 */
.update-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #1f2937;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    transition: transform 0.3s ease;
}

.update-notification.show {
    transform: translateX(-50%) translateY(0);
}

.update-notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#reload-page {
    background: white;
    color: #1f2937;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

/* 搜尋自動完成樣式 */
.search-container {
    position: relative;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

#search-results[aria-hidden="false"] {
    display: block;
}

.search-section {
    padding: 0.5rem 0;
}

.search-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f9fafb;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #1f2937;
    text-decoration: none;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.search-result-item:hover,
.search-result-item.active {
    background: #f3f4f6;
    border-left-color: #667eea;
}

.search-item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.search-item-title mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 0.2em;
    border-radius: 2px;
}

.search-item-meta {
    font-size: 0.85rem;
    color: #6b7280;
    display: flex;
    gap: 0.75rem;
}

.search-no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: #6b7280;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .pwa-install-banner {
        padding: 0.75rem;
    }
    
    .install-banner-content {
        flex-wrap: wrap;
    }
    
    .install-banner-icon {
        font-size: 1.5rem;
    }
    
    .install-banner-text strong {
        font-size: 1rem;
    }
    
    .notification-prompt {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .network-toast {
        left: 10px;
        right: 10px;
    }
}

/* 離線指示器 */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 9997;
}

/* 載入動畫 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
