/**
 * CODDB PWA Styles
 * Styles for Progressive Web App functionality
 */

/* PWA Install Button */
.coddb-btn-install {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6600, #e55a00);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.2);
}

.coddb-btn-install:hover {
    background: linear-gradient(135deg, #e55a00, #cc5200);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
    transform: translateY(-1px);
}

.coddb-btn-install:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 102, 0, 0.2);
}

.coddb-install-icon {
    font-size: 16px;
    filter: grayscale(0);
}

/* PWA Notifications */
.coddb-pwa-update-notification,
.coddb-pwa-installed-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border: 1px solid #ff6600;
    border-radius: 8px;
    padding: 16px;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
}

.coddb-pwa-notification-content,
.coddb-pwa-message-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coddb-pwa-notification-text,
.coddb-pwa-message-text {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
}

.coddb-pwa-notification-text strong {
    color: #ff6600;
    font-weight: 600;
}

.coddb-pwa-notification-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.coddb-btn-primary {
    background: #ff6600;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.coddb-btn-primary:hover {
    background: #e55a00;
}

.coddb-btn-secondary {
    background: transparent;
    color: #cccccc;
    border: 1px solid #666666;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.coddb-btn-secondary:hover {
    background: #333333;
    border-color: #888888;
}

/* Installed Message */
.coddb-pwa-message-content {
    flex-direction: row;
    align-items: center;
}

.coddb-pwa-message-icon {
    font-size: 24px;
    margin-right: 12px;
}

/* Connection Status Messages */
.coddb-pwa-connection-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideInDown 0.3s ease;
}

.coddb-pwa-success {
    background: linear-gradient(135deg, #28a745, #20963c);
}

.coddb-pwa-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #000;
}

/* PWA Specific Body Classes */
.coddb-pwa-enabled {
    /* Add any global PWA-enabled styles here */
}

.coddb-pwa-installed {
    /* Styles when PWA is installed */
}

.coddb-pwa-offline {
    /* Styles when offline */
}

.coddb-pwa-offline::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #ffc107 0px,
        #ffc107 10px,
        transparent 10px,
        transparent 20px
    );
    z-index: 9999;
    animation: offlineStripe 1s linear infinite;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes offlineStripe {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 20px 0;
    }
}

/* Mobile PWA Adjustments */
@media (max-width: 768px) {
    .coddb-pwa-update-notification,
    .coddb-pwa-installed-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .coddb-btn-install {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .coddb-pwa-connection-message {
        left: 10px;
        right: 10px;
        transform: none;
    }
}

/* PWA Splash Screen Styles (for when app is loading) */
.coddb-pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
}

.coddb-pwa-splash-logo {
    font-size: 48px;
    font-weight: bold;
    color: #ff6600;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 102, 0, 0.5);
}

.coddb-pwa-splash-text {
    font-size: 18px;
    color: #cccccc;
    margin-bottom: 24px;
}

.coddb-pwa-splash-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333333;
    border-top: 3px solid #ff6600;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* iOS PWA Status Bar */
@media (display-mode: standalone) {
    /* Styles for when running as installed PWA */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .coddb-navigation {
        padding-top: env(safe-area-inset-top);
    }
}

/* Android PWA Specific */
@media (display-mode: standalone) and (orientation: portrait) {
    .coddb-main-container {
        min-height: 100vh;
        min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
}
