/* PWA Specific Styles */

/* Splash Screen Enhancements for PWA */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #0B0F14;
    display: none; /* Hidden by default - PWA manager will show it */
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: auto; /* Ensure it can receive clicks when visible */
}

/* PWA Mode: Show splash screen only on cold start */
body.pwa-mode .splash-screen.cold-start {
    display: flex !important;
}

/* Hide splash screen on warm starts */
body.pwa-mode .splash-screen:not(.cold-start) {
    display: none !important;
}

/* Ensure splash screen doesn't block interactions when hidden */
.splash-screen[style*="display: none"] {
    pointer-events: none !important;
}

.splash-logo {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    animation: logoAppear 0.8s ease 0.2s forwards;
}

.splash-logo img {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    object-fit: contain;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.splash-text {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', sans-serif;
    letter-spacing: 3px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(15px);
    animation: fadeInUpText 0.8s ease 1s forwards;
}

@keyframes logoAppear {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0px) scale(1);
    }
}

@keyframes fadeInUpText {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PWA Mode Specific Styles - Fixed */
body.pwa-mode {
    /* Ensure PWA mode is fully interactive */
    overflow: auto !important;
    pointer-events: auto !important;
    user-select: auto !important;
    touch-action: auto !important;
}

/* Hide elements in PWA mode */
body.pwa-mode .browser-only {
    display: none !important;
}

/* Install Button Styles */
.install-button {
    animation: installButtonBounce 2s infinite;
}

@keyframes installButtonBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Enhanced mobile experience in PWA */
@media (max-width: 768px) {
    body.pwa-mode .splash-logo img {
        width: 100px;
        height: 100px;
    }
    
    body.pwa-mode .splash-text {
        font-size: 28px;
    }
}

/* Update notification styles */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #0088C2;
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    font-family: 'Vazirmatn', sans-serif;
    z-index: 1001;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideInFromRight 0.3s ease;
    max-width: 300px;
}

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

/* PWA Install Success Animation */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Enhanced Install Button */
.install-button {
    animation: installButtonBounce 2s infinite, pulse 3s ease-in-out infinite;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #0088C2, #4a7c57);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 30px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 6px 20px rgba(63, 112, 77, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.install-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(63, 112, 77, 0.5);
    background: linear-gradient(135deg, #4a7c57, #0088C2);
}

.install-button:active {
    transform: translateY(-1px);
}

/* PWA Messages */
.pwa-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    z-index: 10001;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    animation: slideInFromRight 0.5s ease;
    max-width: 350px;
    backdrop-filter: blur(10px);
}

.pwa-message.success {
    background: linear-gradient(135deg, #00AEEF, #43A047);
    color: white;
}

.pwa-message.info {
    background: linear-gradient(135deg, #1976D2, #1E88E5);
    color: white;
}

.pwa-message.warning {
    background: linear-gradient(135deg, #F57C00, #FB8C00);
    color: white;
}

.pwa-message-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-message-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.pwa-message-text {
    flex: 1;
    line-height: 1.4;
}

.pwa-message-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.pwa-message-close:hover {
    opacity: 1;
}

/* Force PWA UI to be interactive - Critical Fix */
body.pwa-mode * {
    pointer-events: auto !important;
}

body.pwa-mode .navbar,
body.pwa-mode .btn,
body.pwa-mode button,
body.pwa-mode a,
body.pwa-mode input,
body.pwa-mode select,
body.pwa-mode textarea {
    pointer-events: auto !important;
    user-select: auto !important;
    touch-action: auto !important;
}

/* Ensure no z-index conflicts */
body.pwa-mode .splash-screen[style*="display: none"] {
    z-index: -1 !important;
    pointer-events: none !important;
}

/* PWA Connection Status */
.pwa-connection-status {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-family: 'Vazirmatn', sans-serif;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pwa-connection-status.show {
    opacity: 1;
}

.pwa-connection-status.offline {
    background: #f44336;
}

.pwa-connection-status.online {
    background: #33C1F5;
}

/* PWA Mode Header Adjustments */
body.pwa-mode header {
    padding-top: env(safe-area-inset-top, 0);
}

/* Loading indicator for PWA */
.pwa-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
}

.pwa-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(63, 112, 77, 0.3);
    border-top: 4px solid #0088C2;
    border-radius: 50%;
    animation: pwaSpin 1s linear infinite;
}

@keyframes pwaSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 