/* ==================== PWA SPLASH SCREEN ==================== */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2196f3 0%, #1565c0 50%, #0d47a1 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.pwa-splash-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pwa-splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    animation: pwaFadeInUp 0.8s ease-out;
}

.pwa-splash-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    background: #fff;
    padding: 10px;
    animation: pwaPulse 2s ease-in-out infinite;
}

.pwa-splash-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pwa-splash-title {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.pwa-splash-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 300;
    margin: 0 0 30px 0;
    letter-spacing: 1px;
}

.pwa-splash-loader {
    width: 40px;
    height: 40px;
    margin-bottom: 16px;
}

.pwa-spinner {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pwaSpin 0.8s linear infinite;
}

.pwa-splash-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin: 0;
    letter-spacing: 0.5px;
    min-height: 18px;
}

.pwa-splash-footer {
    position: absolute;
    bottom: 24px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* ==================== INSTALL BANNER ==================== */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 99998;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 12px 16px;
}

.pwa-install-banner-visible {
    transform: translateY(0);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    gap: 12px;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pwa-install-text strong {
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}

.pwa-install-text span {
    font-size: 12px;
    color: #777;
}

.pwa-install-button {
    background: #2196f3;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.pwa-install-button:hover {
    background: #1976d2;
}

.pwa-install-button:active {
    transform: scale(0.97);
}

.pwa-dismiss-button {
    background: none;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

/* ==================== iOS INSTRUCTIONS ==================== */
.pwa-ios-instructions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 99998;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 20px;
    text-align: center;
}

.pwa-ios-instructions-visible {
    transform: translateY(0);
}

.pwa-ios-content {
    max-width: 400px;
    margin: 0 auto;
    position: relative;
}

.pwa-ios-content h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
}

.pwa-ios-content p {
    margin: 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.pwa-ios-content i {
    color: #2196f3;
}

.pwa-ios-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #eee;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.pwa-ios-arrow {
    font-size: 24px;
    color: #2196f3;
    margin-top: 12px;
    animation: pwaBounce 1s ease-in-out infinite;
}

/* ==================== OFFLINE INDICATOR ==================== */
.pwa-offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    z-index: 99999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.pwa-offline-indicator-visible {
    transform: translateY(0);
}

.pwa-offline-indicator i {
    margin-right: 6px;
}

/* ==================== STANDALONE MODE ADJUSTMENTS ==================== */
.pwa-standalone .page-wrapper {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.pwa-standalone body {
    overscroll-behavior-y: none;
}

/* ==================== ANIMATIONS ==================== */
@keyframes pwaSpin {
    to { transform: rotate(360deg); }
}

@keyframes pwaFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pwaPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pwaBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .pwa-splash-logo {
        width: 80px;
        height: 80px;
    }
    .pwa-splash-title {
        font-size: 24px;
    }
    .pwa-install-button {
        padding: 7px 14px;
        font-size: 12px;
    }
    .pwa-install-icon {
        width: 40px;
        height: 40px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .pwa-install-banner,
    .pwa-ios-instructions {
        background: #1e1e1e;
    }
    .pwa-install-text strong,
    .pwa-ios-content h3 {
        color: #fff;
    }
    .pwa-install-text span,
    .pwa-ios-content p {
        color: #aaa;
    }
    .pwa-ios-close {
        background: #333;
        color: #ccc;
    }
}