/**
 * ==========================================
 * JUTALOMPONT PWA STYLES
 * Install banner és PWA-specifikus stílusok
 * ==========================================
 * @version 1.0.0
 */

/* ============================================
   PWA INSTALL BANNER
   ============================================ */

#pwa-install-banner {
    position: fixed;
    bottom: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 480px;
    background: linear-gradient(135deg, var(--jp-bg-card, #1e293b), var(--jp-bg-elevated, #334155));
    border: 1px solid var(--jp-border, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow: 
        0 -4px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(99, 102, 241, 0.1);
    z-index: 10000;
    transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#pwa-install-banner.show {
    bottom: 20px;
}

/* Desktop positioning */
@media (min-width: 768px) {
    #pwa-install-banner {
        left: auto;
        right: 24px;
        bottom: -120px;
        transform: none;
        max-width: 400px;
    }
    
    #pwa-install-banner.show {
        bottom: 24px;
    }
}

/* Banner content layout */
.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* App icon */
.pwa-install-icon {
    flex-shrink: 0;
    position: relative;
}

.pwa-install-icon img {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 
        0 4px 12px rgba(99, 102, 241, 0.3),
        0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Pulse animation on icon */
.pwa-install-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--jp-primary, #6366f1), transparent);
    opacity: 0;
    animation: iconPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes iconPulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.1); }
}

/* Text content */
.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--jp-text, #f8fafc);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-text span {
    display: block;
    font-size: 13px;
    color: var(--jp-text-muted, #94a3b8);
    line-height: 1.4;
}

/* Action buttons */
.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Install button */
.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--jp-primary, #6366f1), var(--jp-primary-light, #818cf8));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-install-btn i {
    font-size: 14px;
}

/* Close button */
.pwa-install-close {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--jp-text-muted, #94a3b8);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--jp-text, #f8fafc);
    border-color: rgba(255, 255, 255, 0.2);
}

.pwa-install-close i {
    font-size: 16px;
}

/* ============================================
   STANDALONE MODE STYLES
   (Telepített alkalmazás esetén)
   ============================================ */

@media (display-mode: standalone) {
    /* Rejtjük a telepítés elemeket */
    #pwa-install-banner,
    .pwa-install-prompt,
    .install-app-cta {
        display: none !important;
    }
    
    /* Biztonsági terület iOS-en */
    body {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }
    
    /* Fixed elemek igazítása */
    .navbar-fixed-top,
    header.fixed-top {
        top: env(safe-area-inset-top, 0);
    }
    
    .footer-fixed,
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    /* Standalone indikátor (debug) */
    body::after {
        content: '';
        /* Opcionális: jelzés hogy standalone módban vagyunk */
        /* content: 'PWA'; */
        /* position: fixed; top: 5px; right: 5px; */
        /* background: var(--jp-primary); color: white; */
        /* padding: 2px 6px; border-radius: 4px; font-size: 10px; */
    }
}

/* ============================================
   iOS SAFARI SPECIFIKUS
   ============================================ */

@supports (-webkit-touch-callout: none) {
    /* iOS safe area padding */
    #pwa-install-banner {
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }
    
    /* Standalone módban */
    @media (display-mode: standalone) {
        .navbar,
        header {
            padding-top: env(safe-area-inset-top, 0);
        }
    }
}

/* ============================================
   PWA UPDATE NOTIFICATION
   ============================================ */

.pwa-update-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 350px;
    background: var(--jp-bg-card, #1e293b);
    border: 1px solid var(--jp-border, rgba(255, 255, 255, 0.1));
    border-left: 4px solid var(--jp-info, #3b82f6);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.pwa-update-toast.show {
    transform: translateX(0);
}

.pwa-update-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pwa-update-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--jp-info, #3b82f6);
}

.pwa-update-text h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--jp-text, #f8fafc);
    margin: 0 0 4px 0;
}

.pwa-update-text p {
    font-size: 13px;
    color: var(--jp-text-muted, #94a3b8);
    margin: 0 0 12px 0;
}

.pwa-update-actions {
    display: flex;
    gap: 8px;
}

.pwa-update-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-update-btn.primary {
    background: var(--jp-info, #3b82f6);
    color: white;
    border: none;
}

.pwa-update-btn.secondary {
    background: transparent;
    color: var(--jp-text-muted, #94a3b8);
    border: 1px solid var(--jp-border, rgba(255, 255, 255, 0.1));
}

/* ============================================
   OFFLINE INDICATOR
   ============================================ */

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    color: white;
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10002;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.offline-indicator.show {
    transform: translateY(0);
}

.offline-indicator i {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   LOADING SPLASH (App start)
   ============================================ */

.pwa-splash {
    position: fixed;
    inset: 0;
    background: var(--jp-bg, #0f172a);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.pwa-splash.fade-out {
    opacity: 0;
    pointer-events: none;
}

.pwa-splash-logo {
    font-size: 48px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pwa-splash-text {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--jp-primary, #6366f1), var(--jp-primary-light, #818cf8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pwa-splash-loader {
    margin-top: 30px;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--jp-primary, #6366f1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
    #pwa-install-banner {
        width: calc(100% - 24px);
        padding: 14px 16px;
        border-radius: 16px;
    }
    
    .pwa-install-content {
        gap: 12px;
    }
    
    .pwa-install-icon img {
        width: 44px;
        height: 44px;
    }
    
    .pwa-install-text strong {
        font-size: 14px;
    }
    
    .pwa-install-text span {
        font-size: 12px;
    }
    
    .pwa-install-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .pwa-install-close {
        width: 34px;
        height: 34px;
    }
}
