/* PWA Install Button & Modal Styles */

/* Floating Install Button */
#pwa-install-btn {
    display: none;
    /* Hidden by default, shown via JS */
    position: fixed;
    top: auto;
    bottom: 110px;
    /* Positioned in the red circle area, above bottom nav */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 9999;
    background: linear-gradient(135deg, #00C853 0%, #009624 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 150, 36, 0.3);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#pwa-install-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 150, 36, 0.4);
}

#pwa-install-btn i {
    font-size: 16px;
}

/* Adjust position if scroll-to-top is present */
body.has-scroll-top #pwa-install-btn {
    bottom: 80px;
}

/* iOS Instructions Modal */
.pwa-ios-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: flex-end;
    /* Sheet style from bottom */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding-bottom: 20px;
    /* Safe area */
}

.pwa-ios-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.pwa-ios-content {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    margin-bottom: 20px;
}

.pwa-ios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.pwa-ios-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.pwa-ios-close {
    background: #f0f2f5;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    font-size: 16px;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
    text-align: left;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
}

.pwa-ios-step-icon {
    font-size: 24px;
    color: #007AFF;
    /* iOS Blue */
    width: 30px;
    text-align: center;
}

.pwa-ios-step-text {
    font-size: 14px;
    color: #444;
    line-height: 1.4;
    margin: 0;
}

.pwa-ios-step-text strong {
    color: #000;
    font-weight: 600;
}

/* Arrow pointing to share button */
.pwa-ios-arrow {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    /* Contrast against dark overlay or bottom bar */
    font-size: 24px;
    animation: bounce 2s infinite;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: none;
    /* Only show if we can detect bottom bar position aproximately */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    40% {
        transform: translateX(-50%) translateY(-10px);
    }

    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Dark mode support for OS preference */
@media (prefers-color-scheme: dark) {
    .pwa-ios-content {
        background: #1c1c1e;
        color: white;
    }

    .pwa-ios-title {
        color: white;
    }

    .pwa-ios-step {
        background: #2c2c2e;
    }

    .pwa-ios-step-text {
        color: #e5e5e5;
    }

    .pwa-ios-step-text strong {
        color: white;
    }

    .pwa-ios-close {
        background: #3a3a3c;
        color: #ddd;
    }
}