/* PWA Styles for CV Logger Django App */

/* Install Prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    animation: slideUp 0.3s ease-out;
}

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

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.pwa-install-info {
    flex: 1;
    min-width: 200px;
}

.pwa-install-info strong {
    display: block;
    color: #0f172a;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.pwa-install-info p {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0;
}

.pwa-install-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pwa-install-btn:hover {
    background: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.pwa-close-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Connection Status */
.pwa-status {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9998;
    display: none;
}

.pwa-status-online,
.pwa-status-offline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pwa-status-online {
    background: #d1fae5;
    color: #065f46;
}

.pwa-status-offline {
    background: #fee2e2;
    color: #991b1b;
}

.pwa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .pwa-install-prompt {
        bottom: max(1rem, env(safe-area-inset-bottom));
        left: max(1rem, env(safe-area-inset-left));
        right: max(1rem, env(safe-area-inset-right));
    }
    
    .pwa-status {
        top: max(1rem, env(safe-area-inset-top));
        right: max(1rem, env(safe-area-inset-right));
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .pwa-install-prompt {
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 12px 12px 0 0;
    }
    
    .pwa-install-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pwa-install-btn {
        width: 100%;
    }
    
    .pwa-close-btn {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
}

/* Standalone Mode Adjustments */
@media (display-mode: standalone) {
    /* Add extra padding for iOS notch */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Loading Indicator for PWA */
.pwa-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    z-index: 10000;
}

.pwa-loading.active {
    transform: scaleX(1);
}
