/**
 * SBNews PWA Styles
 * Install prompts, toasts, and standalone mode adjustments
 */

/* Install Button */
.sbnews-pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    animation: slideInUp 0.5s ease-out;
}

.sbnews-pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.sbnews-pwa-install-btn:active {
    transform: translateY(0);
}

.sbnews-pwa-install-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Toast Notifications */
.sbnews-pwa-toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #1a1a1a;
    color: #ffffff;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease-out;
}

.sbnews-pwa-toast.sbnews-pwa-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.sbnews-pwa-toast.sbnews-pwa-update {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.sbnews-pwa-toast.sbnews-pwa-offline {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.sbnews-pwa-toast.sbnews-pwa-online {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.sbnews-pwa-toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sbnews-pwa-toast button {
    margin-left: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sbnews-pwa-toast button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Standalone Mode Adjustments */
.sbnews-pwa-standalone {
    /* Add safe area insets for notched devices */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.sbnews-pwa-standalone body {
    /* Prevent overscroll bounce effect */
    overscroll-behavior-y: contain;
}

/* iOS Standalone Mode Fixes */
@supports (-webkit-touch-callout: none) {
    .sbnews-pwa-standalone {
        /* Fix for iOS status bar */
        padding-top: max(env(safe-area-inset-top), 20px);
    }

    .sbnews-pwa-standalone .site-header {
        /* Adjust header for iOS */
        padding-top: env(safe-area-inset-top);
    }
}

/* Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sbnews-pwa-install-btn {
        bottom: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 13px;
    }

    .sbnews-pwa-install-btn svg {
        width: 18px;
        height: 18px;
    }

    .sbnews-pwa-toast {
        bottom: 70px;
        right: 15px;
        left: 15px;
        font-size: 13px;
    }
}

/* Small Screens */
@media (max-width: 480px) {
    .sbnews-pwa-install-btn span {
        display: none;
    }

    .sbnews-pwa-install-btn {
        width: 50px;
        height: 50px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .sbnews-pwa-install-btn svg {
        margin: 0;
    }
}

/* Dark Mode Support (already dark, but for consistency) */
@media (prefers-color-scheme: dark) {
    .sbnews-pwa-toast {
        background: #1a1a1a;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .sbnews-pwa-install-btn,
    .sbnews-pwa-toast {
        animation: none;
    }

    .sbnews-pwa-install-btn:hover {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .sbnews-pwa-install-btn,
    .sbnews-pwa-toast {
        display: none !important;
    }
}
