/* PWA Styles für AK Systems */

/* Install Button Styles */
#install-button {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 25px;
    color: white;
    font-weight: 500;
    padding: 10px 20px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
}

#install-button:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

#install-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

/* Update Banner Styles */
.update-banner {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border: none;
    border-radius: 10px;
    color: white;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.update-banner .btn-outline-info {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.update-banner .btn-outline-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* Online/Offline Status Indicator */
#online-status {
    font-weight: 500;
    text-align: center;
    min-width: 80px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* PWA Standalone Mode Styles */
@media (display-mode: standalone) {
    /* Verstecke Browser-spezifische Elemente im Standalone-Modus */
    .browser-only {
        display: none !important;
    }
    
    /* Anpassungen für Standalone-Modus */
    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);
    }
    
    /* Navigation anpassen für Standalone */
    .navbar {
        padding-top: calc(env(safe-area-inset-top) + 0.5rem);
    }
    
    /* Install Button im Standalone-Modus verstecken */
    #install-button {
        display: none !important;
    }
    
    /* PWA-spezifische Styles */
    .pwa-only {
        display: block !important;
    }
}

/* PWA Loading Spinner */
.pwa-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    display: none;
}

.pwa-loading.show {
    display: block;
}

.pwa-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* PWA Toast Notifications */
.pwa-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 1003;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.pwa-toast.show {
    opacity: 1;
    pointer-events: auto;
}

.pwa-toast.success {
    background: #28a745;
}

.pwa-toast.error {
    background: #dc3545;
}

.pwa-toast.warning {
    background: #ffc107;
    color: #212529;
}

/* Responsive Anpassungen für PWA */
@media (max-width: 768px) {
    #install-button {
        bottom: 15px;
        right: 15px;
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .update-banner {
        max-width: 280px !important;
        font-size: 14px;
    }
    
    #online-status {
        font-size: 11px;
        padding: 4px 12px;
    }
}

/* Dark Mode Anpassungen für PWA */
@media (prefers-color-scheme: dark) {
    .pwa-toast {
        background: #495057;
    }
    
    .pwa-loading {
        background: rgba(33, 37, 41, 0.9);
    }
}

/* iOS Safari spezifische Anpassungen */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    .navbar {
        padding-top: calc(env(safe-area-inset-top) + 0.5rem);
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Android Chrome spezifische Anpassungen */
@media (display-mode: standalone) and (orientation: portrait) {
    .navbar {
        min-height: 60px;
    }
}

/* Landscape Modus Anpassungen */
@media (display-mode: standalone) and (orientation: landscape) {
    .navbar {
        min-height: 50px;
    }
    
    #install-button {
        bottom: 10px;
        right: 10px;
    }
}

/* PWA Splash Screen Simulation */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.pwa-splash.hide {
    opacity: 0;
    pointer-events: none;
}

.pwa-splash-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.pwa-splash-text {
    color: white;
    font-size: 24px;
    font-weight: 300;
    text-align: center;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Accessibility Verbesserungen für PWA */
@media (prefers-reduced-motion: reduce) {
    #install-button,
    .pwa-toast,
    #online-status,
    .pwa-splash-logo {
        animation: none;
        transition: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    #install-button {
        border: 2px solid white;
    }
    
    .pwa-toast {
        border: 1px solid currentColor;
    }
    
    #online-status {
        border: 1px solid currentColor;
    }
}