/* ==========================================================================
   PWA Install Banner & iOS Prompts
   ========================================================================== */

/* Zone colorée au-dessus du bandeau pour couvrir l'encoche */
.install-banner::before {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    content: '';
    height: calc(var(--safe-area-inset-top, 20px) + 20px);
    left: 0;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 9998;
}

.install-banner {
    animation: slideDown 0.4s ease-out;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
    color: white;
    left: 0;
    padding: 12px 16px;
    padding-left: calc(16px + var(--safe-area-inset-left, 0));
    padding-right: calc(16px + var(--safe-area-inset-right, 0));
    position: fixed;
    right: 0;
    top: calc(var(--safe-area-inset-top, 20px) + 20px);
    z-index: 9999;
}

.install-banner-content {
    align-items: center;
    display: flex;
    gap: 12px;
    margin: 0 auto;
    max-width: var(--container-max-width);
}

.install-icon {
    font-size: 20px;
    opacity: 0.9;
}

.install-text {
    flex: 1;
    min-width: 0;
}

.install-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.install-text span {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}

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

.install-btn-primary {
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgb(255 255 255 / 20%);
    border: 1px solid rgb(255 255 255 / 30%);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    font-size: 12px;
    font-weight: 600;
    gap: 4px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.install-btn-primary:hover {
    background: rgb(255 255 255 / 30%);
    transform: translateY(-1px);
}

.install-btn-close {
    background: transparent;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    padding: 8px;
    transition: all 0.2s ease;
}

.install-btn-close:hover {
    background: rgb(255 255 255 / 10%);
    opacity: 1;
}

/* iOS Install Prompt */
.ios-install-prompt {
    align-items: flex-end;
    animation: fadeIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    background: rgb(0 0 0 / 70%);
    inset: 0;
    display: flex;
    padding: 20px 16px calc(20px + var(--safe-area-inset-bottom, 20px));
    position: fixed;
    z-index: 10000;
}

.ios-install-content {
    animation: slideUp 0.4s ease-out;
    background: white;
    border-radius: 16px 16px 8px 8px;
    margin: 0 auto;
    max-width: 400px;
    overflow: hidden;
    width: 100%;
}

.ios-install-header {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    color: white;
    padding: 20px 20px 16px;
    position: relative;
    text-align: center;
}

.ios-install-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.ios-install-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.ios-close-btn {
    align-items: center;
    background: rgb(255 255 255 / 20%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    height: 32px;
    justify-content: center;
    position: absolute;
    right: 16px;
    top: 16px;
    transition: all 0.2s ease;
    width: 32px;
}

.ios-close-btn:hover {
    background: rgb(255 255 255 / 30%);
}

.ios-install-steps {
    padding: 20px;
}

.ios-step {
    align-items: center;
    background: #f9fafb;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
}

.ios-step:last-child {
    margin-bottom: 0;
}

.ios-step-number {
    align-items: center;
    background: #dc2626;
    border-radius: 50%;
    color: white;
    display: flex;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.ios-step-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.4;
}

.ios-step-text i {
    color: #dc2626;
    margin: 0 2px;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mobile optimizations */
@media (width <= 768px) {
    .install-banner::before {
        height: calc(var(--safe-area-inset-top, 44px) + 20px);
    }
    
    .install-banner {
        padding: 10px 12px;
        padding-left: calc(12px + var(--safe-area-inset-left, 0));
        padding-right: calc(12px + var(--safe-area-inset-right, 0));
        top: calc(var(--safe-area-inset-top, 44px) + 20px);
    }
    
    .install-banner-content {
        gap: 8px;
    }
    
    .install-text strong {
        font-size: 13px;
    }
    
    .install-text span {
        font-size: 11px;
    }
    
    .install-btn-primary {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    body.install-banner-visible {
        padding-top: calc(64px + var(--safe-area-inset-top, 44px));
    }
}
    
    .ios-install-prompt {
        padding: 16px 12px calc(16px + var(--safe-area-inset-bottom, 16px));
    }
    
    .ios-install-header {
        padding: 16px 16px 12px;
    }
    
    .ios-install-steps {
        padding: 16px;
    }
    
    .ios-step {
        margin-bottom: 12px;
        padding: 10px;
    }

/* Dark theme adjustments */
[data-theme="dark"] .ios-install-content {
    background: #111827;
}

[data-theme="dark"] .ios-step {
    background: rgb(255 255 255 / 5%);
}

[data-theme="dark"] .ios-step-text {
    color: #e5e7eb;
}

/* Ensure proper spacing when banner is shown */
body.install-banner-visible {
    padding-top: calc(68px + var(--safe-area-inset-top, 20px));
}

/* High DPI displays */
@media (min-device-pixel-ratio: 2), (resolution >= 192dpi) {
    .install-banner {
        backdrop-filter: blur(20px);
    }
}
}