/* PWA Native App-like Styles for Android */

/* PWA Install Banner */
#pwa-install-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 9999;
    transition: bottom 0.3s ease;
}

#pwa-install-banner.show {
    bottom: 0;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.pwa-banner-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pwa-banner-text {
    flex: 1;
}

.pwa-banner-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.pwa-banner-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

.pwa-banner-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pwa-install-btn {
    background: #fff;
    color: #667eea;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.pwa-install-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.pwa-install-btn:active {
    transform: scale(0.98);
}

.pwa-dismiss-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.pwa-dismiss-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* iOS Install Modal */
.ios-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.ios-install-content {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.ios-install-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.ios-install-close:hover {
    background: #f0f0f0;
}

.ios-install-content h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    color: #333;
}

.ios-install-content p {
    margin: 0 0 12px 0;
    color: #666;
}

.ios-install-content ol {
    margin: 0 0 20px 0;
    padding-left: 24px;
    color: #444;
}

.ios-install-content ol li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* PWA Mode Styles */
.pwa-installed body,
.pwa-mode {
    /* Remove browser chrome effects */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Native-like status bar */
.pwa-installed .navbar,
.pwa-mode .navbar {
    padding-top: env(safe-area-inset-top, 0);
}

/* Native-like bottom navigation */
.pwa-installed .bottom-nav,
.pwa-mode .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* PWA Back Button */
.pwa-back-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none !important;
    border: none !important;
    color: inherit !important;
    font-size: 24px;
    padding: 8px !important;
    z-index: 10;
}

.pwa-back-btn:hover {
    background: rgba(0,0,0,0.05) !important;
    border-radius: 50%;
}

/* Smooth scrolling for native feel */
.pwa-installed *,
.pwa-mode * {
    -webkit-overflow-scrolling: touch;
}

/* Remove text selection on buttons (native behavior) */
.pwa-installed button,
.pwa-installed .btn,
.pwa-mode button,
.pwa-mode .btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Native-like ripple effect */
.pwa-installed button,
.pwa-installed .btn,
.pwa-mode button,
.pwa-mode .btn {
    position: relative;
    overflow: hidden;
}

.pwa-installed button::after,
.pwa-installed .btn::after,
.pwa-mode button::after,
.pwa-mode .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.pwa-installed button:active::after,
.pwa-installed .btn:active::after,
.pwa-mode button:active::after,
.pwa-mode .btn:active::after {
    width: 200px;
    height: 200px;
}

/* Native-like pull-to-refresh indicator */
.pwa-ptr-indicator {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s ease;
    z-index: 9999;
}

.pwa-ptr-indicator.active {
    top: 20px;
}

.pwa-ptr-indicator i {
    font-size: 20px;
    color: #667eea;
    animation: spin 1s linear infinite;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    z-index: 9998;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Native-like toast notifications */
.pwa-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 9999;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.pwa-toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    #pwa-install-banner {
        padding: 12px 16px;
    }
    
    .pwa-banner-content {
        gap: 10px;
    }
    
    .pwa-banner-icon {
        font-size: 28px;
    }
    
    .pwa-banner-text strong {
        font-size: 14px;
    }
    
    .pwa-banner-text p {
        font-size: 12px;
    }
    
    .pwa-install-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .pwa-dismiss-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .pwa-banner-text p {
        display: none;
    }
    
    .pwa-install-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Landscape mode */
@media (max-width: 768px) and (orientation: landscape) {
    #pwa-install-banner {
        padding: 8px 16px;
    }
    
    .pwa-banner-icon {
        font-size: 24px;
    }
    
    .pwa-banner-text strong {
        font-size: 13px;
    }
}

/* Android-specific styles */
@supports (-webkit-appearance: none) {
    .pwa-installed,
    .pwa-mode {
        /* Android status bar color */
        background: #fff;
    }
}

/* Prevent zoom on input focus (native behavior) */
.pwa-installed input,
.pwa-installed textarea,
.pwa-installed select,
.pwa-mode input,
.pwa-mode textarea,
.pwa-mode select {
    font-size: 16px !important;
}

/* Native-like loading spinner */
.pwa-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 9999;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Splash screen styles */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeOut 0.5s ease 2s forwards;
}

.pwa-splash img {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.pwa-splash h1 {
    color: #fff;
    font-size: 32px;
    margin: 0;
    font-weight: 700;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* Safe area support for notched devices */
.pwa-installed,
.pwa-mode {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
