/* ================================================================
   PWA & MOBILE OPTIMIZATIONS
   Owner & Programmer: Onyeka E. Henry
   Copyright (c) 2025 Onyeka E. Henry. All rights reserved.
   ================================================================ */

/* PWA Safe Areas */
body.pwa-mode {
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
    padding-left: var(--safe-area-left);
    padding-right: var(--safe-area-right);
}

/* PWA Install Button */
.pwa-install-button {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulse-install 2s infinite;
}

.pwa-install-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.pwa-install-button i {
    font-size: 1.2em;
}

@keyframes pulse-install {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
    }
}

/* PWA Install Badge */
.pwa-install-badge {
    position: fixed;
    bottom: -200px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 20px;
    z-index: 9999;
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pwa-install-badge.show {
    bottom: 0;
}

.pwa-install-badge .badge-content {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.pwa-install-badge i {
    font-size: 2.5em;
    color: var(--primary-color);
}

.pwa-install-badge strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 4px;
}

.pwa-install-badge p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.install-badge-btn {
    margin-left: auto;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.install-badge-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.close-badge-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 10px;
    transition: color 0.3s ease;
}

.close-badge-btn:hover {
    color: var(--text-primary);
}

/* Mobile Touch Improvements */
@media (hover: none) {
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover {
        transform: none;
    }
    
    /* Add active states for touch */
    .btn:active {
        transform: scale(0.98);
    }
    
    .card:active {
        transform: scale(0.99);
    }
}

/* Touch-Friendly Buttons */
.btn {
    min-height: 44px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Network Status Notifications */
.network-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transition: top 0.4s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: white;
}

.network-notification.show {
    top: 20px;
}

.network-notification.online {
    background: var(--success-color);
}

.network-notification.offline {
    background: var(--error-color);
}

/* Standalone PWA Mode */
@media (display-mode: standalone) {
    body {
        padding-top: var(--safe-area-top);
        padding-bottom: var(--safe-area-bottom);
    }
    
    /* Hide install prompts when already installed */
    .pwa-install-button,
    .pwa-install-badge {
        display: none !important;
    }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--border-color);
        padding: 8px 0;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-bottom-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 0;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.75em;
        transition: color 0.3s ease;
    }
    
    .mobile-bottom-nav a.active {
        color: var(--primary-color);
    }
    
    .mobile-bottom-nav a i {
        font-size: 1.5em;
        margin-bottom: 4px;
    }
    
    body.pwa-mode main,
    body.pwa-mode .container {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    /* Ensure bottom padding for all mobile users with bottom nav */
    main, .main-content {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    /* Currency button style in bottom nav */
    .mobile-bottom-nav .mobile-currency-btn {
        background: none;
        border: none;
    }
}
