/**
 * Enhanced PWA Styles for Finmagine
 * Includes install prompts, onboarding tour, and PWA-specific UI enhancements
 */

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: -100px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, #0a4d68 0%, #05bfdb 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s ease;
    max-width: 400px;
    margin: 0 auto;
}

.pwa-install-banner.show {
    bottom: 20px;
}

.pwa-install-banner.hide {
    bottom: -100px;
    opacity: 0;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 16px;
}

.pwa-install-icon img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.pwa-install-text h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
}

.pwa-install-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.pwa-install-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.pwa-dismiss-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 1;
    transition: all 0.2s ease;
    padding: 8px;
    line-height: 1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

/* Connection Status */
.connection-status {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9998;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.connection-status.show {
    transform: translateX(0);
}

.connection-status.hide {
    transform: translateX(100%);
}

.connection-status.online {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.offline {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Notification Prompt */
.notification-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white !important;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 360px;
    width: 90%;
    border: 2px solid #e2e8f0;
}

.notification-prompt.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.notification-prompt.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
}

.notification-prompt-content {
    padding: 24px;
    text-align: center;
}

.notification-prompt-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.notification-prompt-text h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #1a202c !important;
    font-weight: 600;
}

.notification-prompt-text p {
    margin: 0 0 24px 0;
    color: #4a5568 !important;
    line-height: 1.5;
}

.notification-prompt-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-enable-notifications,
.btn-dismiss-notifications {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-enable-notifications {
    background: #0a4d68;
    color: white;
}

.btn-enable-notifications:hover {
    background: #083d52;
    transform: translateY(-1px);
}

.btn-dismiss-notifications {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #dee2e6;
}

.btn-dismiss-notifications:hover {
    background: #e9ecef;
}

/* PWA Welcome Message */
.pwa-welcome-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: linear-gradient(135deg, #0a4d68 0%, #05bfdb 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 360px;
    width: 90%;
}

.pwa-welcome-message.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pwa-welcome-message.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
}

.pwa-welcome-content {
    padding: 24px;
    text-align: center;
}

.pwa-welcome-content h3 {
    margin: 0 0 12px 0;
    font-size: 20px;
}

.pwa-welcome-content p {
    margin: 0 0 20px 0;
    opacity: 0.9;
    line-height: 1.5;
}

.pwa-welcome-content button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-welcome-content button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* Onboarding Tour Overlay */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.onboarding-overlay.active {
    opacity: 1;
    visibility: visible;
}

.onboarding-tooltip {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 320px;
    z-index: 10001;
}

.onboarding-content {
    padding: 24px;
}

.onboarding-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.onboarding-text {
    margin: 0 0 20px 0;
    color: #666;
    line-height: 1.5;
    font-size: 14px;
}

.onboarding-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-skip {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-skip:hover {
    color: #333;
}

.onboarding-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-prev,
.btn-next {
    background: #0a4d68;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-prev:hover,
.btn-next:hover {
    background: #083d52;
    transform: translateY(-1px);
}

.step-indicator {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.onboarding-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: white;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
}

/* Onboarding Highlight */
.onboarding-highlight {
    position: relative;
    z-index: 10002 !important;
    box-shadow: 0 0 0 4px rgba(5, 191, 219, 0.8) !important;
    border-radius: 4px;
    animation: onboarding-pulse 2s infinite;
}

@keyframes onboarding-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(5, 191, 219, 0.8);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(5, 191, 219, 0.4);
    }
}

/* PWA-Specific Enhancements */
@media (display-mode: standalone) {
    /* Hide elements that don't make sense in app mode */
    .browser-only {
        display: none !important;
    }
    
    /* Add app-specific styles */
    body {
        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);
    }
    
    /* Enhance touch targets for mobile */
    .btn, button, .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .pwa-install-banner {
        left: 10px;
        right: 10px;
        bottom: -120px;
    }
    
    .pwa-install-banner.show {
        bottom: 10px;
    }
    
    .pwa-dismiss-btn {
        width: 40px;
        height: 40px;
        font-size: 22px;
        background: rgba(255, 255, 255, 0.3) !important;
        border: 2px solid rgba(255, 255, 255, 0.5) !important;
        min-height: 44px; /* iOS touch target minimum */
        min-width: 44px;
        font-weight: bold;
    }
    
    .pwa-dismiss-btn:active {
        background: rgba(255, 255, 255, 0.6) !important;
        transform: scale(0.95);
    }
    
    .pwa-install-content {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .pwa-install-text h3 {
        font-size: 14px;
    }
    
    .pwa-install-text p {
        font-size: 13px;
    }
    
    .onboarding-tooltip {
        max-width: 280px;
        margin: 10px;
    }
    
    .onboarding-content {
        padding: 20px;
    }
    
    .notification-prompt,
    .pwa-welcome-message {
        margin: 20px;
        width: calc(100% - 40px);
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .pwa-install-banner {
        border: 2px solid white;
    }
    
    .onboarding-highlight {
        box-shadow: 0 0 0 4px yellow !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .pwa-install-banner,
    .connection-status,
    .notification-prompt,
    .pwa-welcome-message,
    .onboarding-overlay,
    .btn-prev,
    .btn-next,
    .pwa-install-btn {
        transition: none;
    }
    
    .onboarding-highlight {
        animation: none;
        box-shadow: 0 0 0 4px rgba(5, 191, 219, 0.8) !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .notification-prompt,
    .onboarding-tooltip {
        background: #2d3748;
        color: white;
    }
    
    .onboarding-title {
        color: white;
    }
    
    .onboarding-text,
    .step-indicator {
        color: #cbd5e0;
    }
    
    .btn-skip {
        color: #cbd5e0;
    }
    
    .btn-skip:hover {
        color: white;
    }
    
    .btn-dismiss-notifications {
        background: #4a5568;
        color: #cbd5e0;
        border-color: #718096;
    }
    
    .btn-dismiss-notifications:hover {
        background: #718096;
    }
}