/**
 * PWA Install and Mobile App Styles
 */

/* Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.install-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.install-text {
    flex: 1;
}

.install-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.install-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.install-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-install {
    background: white;
    color: #0d6efd;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-install:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    opacity: 1;
}

/* Update Banner */
.update-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #198754;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
    }
    to {
        transform: translateX(0);
    }
}

.update-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.update-banner i {
    font-size: 1.5rem;
}

.btn-update {
    background: white;
    color: #198754;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* iOS Install Banner */
.ios-install-banner {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    animation: slideUp 0.3s ease-out;
}

.ios-install-content {
    text-align: center;
}

.ios-install-content h3 {
    margin: 0 0 0.5rem;
    color: #0d6efd;
}

.ios-install-content p {
    margin: 0 0 1rem;
    color: #6c757d;
}

.ios-install-content i {
    color: #0d6efd;
    font-size: 1.2rem;
    vertical-align: middle;
}

/* Add to Home FAB */
.add-to-home-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(13, 110, 253, 0.6);
    }
}

.add-to-home-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.6);
}

/* App Notifications */
.app-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: top 0.3s ease-out;
    max-width: 90%;
    text-align: center;
}

.app-notification.show {
    top: 20px;
}

.app-notification.success {
    background: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #198754;
}

.app-notification.warning {
    background: #fff3cd;
    color: #664d03;
    border-left: 4px solid #ffc107;
}

.app-notification.error {
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
}

/* Standalone Mode Adjustments */
@media (display-mode: standalone) {
    body {
        /* Add safe area for notch/status bar */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .main-nav {
        padding-top: env(safe-area-inset-top);
    }

    /* Hide browser UI elements */
    .browser-only {
        display: none !important;
    }

    /* Show standalone-specific elements */
    .standalone-only {
        display: block !important;
    }
}

/* Mobile Scan Button */
.mobile-scan-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.mobile-scan-button .scan-fab {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    transition: all 0.3s;
}

.mobile-scan-button .scan-fab:active {
    transform: scale(0.95);
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeOut 0.5s 2s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.splash-screen img {
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    animation: bounceIn 0.6s;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.splash-screen h1 {
    color: white;
    font-size: 2rem;
    margin: 0;
}

.splash-screen .loading-spinner {
    margin-top: 2rem;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffc107;
    color: #000;
    text-align: center;
    padding: 0.5rem;
    z-index: 10000;
    font-weight: 600;
    transform: translateY(-100%);
    transition: transform 0.3s;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Touch Feedback */
button, a, .clickable {
    -webkit-tap-highlight-color: rgba(13, 110, 253, 0.2);
}

/* Prevent Pull-to-Refresh */
body {
    overscroll-behavior-y: contain;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .pwa-install-banner {
        padding: 0.75rem;
    }

    .install-banner-content {
        gap: 0.75rem;
    }

    .install-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .install-text strong {
        font-size: 1rem;
    }

    .install-text p {
        font-size: 0.85rem;
    }

    .btn-install {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .update-banner {
        right: 10px;
        top: 10px;
        left: 10px;
        padding: 0.75rem;
    }

    .add-to-home-fab {
        bottom: 70px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}
