/**
 * Styles PWA - Installation et Notifications
 * Mayramfh Progressive Web App
 */

/* ========================================
   BOUTON D'INSTALLATION PWA
   ======================================== */

.btn-pwa-install {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), #b8941f);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-pwa-install::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-pwa-install:hover::before {
    left: 100%;
}

.btn-pwa-install:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-pwa-install:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.btn-pwa-install svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

.pwa-btn-show {
    display: flex !important;
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   NOTIFICATIONS PWA
   ======================================== */

.pwa-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    min-width: 320px;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    z-index: 10000;
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pwa-notification-content {
    flex: 1;
}

.pwa-notification-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.pwa-notification-message {
    font-size: 0.875rem;
    color: var(--text-light);
    line-height: 1.5;
}

.pwa-notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.pwa-notification-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.notification-action {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-action:hover {
    background: #b8941f;
    transform: translateY(-1px);
}

/* Types de notifications */
.pwa-notification-success {
    border-left: 4px solid #10b981;
}

.pwa-notification-success .pwa-notification-title {
    color: #10b981;
}

.pwa-notification-info {
    border-left: 4px solid #3b82f6;
}

.pwa-notification-info .pwa-notification-title {
    color: #3b82f6;
}

.pwa-notification-warning {
    border-left: 4px solid #f59e0b;
}

.pwa-notification-warning .pwa-notification-title {
    color: #f59e0b;
}

.pwa-notification-error {
    border-left: 4px solid #ef4444;
}

.pwa-notification-error .pwa-notification-title {
    color: #ef4444;
}

/* ========================================
   INDICATEUR DE STATUT HORS LIGNE
   ======================================== */

.pwa-offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ========================================
   MODE SOMBRE
   ======================================== */

[data-theme="dark"] .btn-pwa-install {
    background: linear-gradient(135deg, #f4d03f, #d4af37);
    box-shadow: 0 4px 15px rgba(244, 208, 63, 0.4);
}

[data-theme="dark"] .btn-pwa-install:hover {
    box-shadow: 0 6px 20px rgba(244, 208, 63, 0.5);
}

[data-theme="dark"] .pwa-notification {
    background: #1e293b;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .pwa-notification-title {
    color: #f1f5f9;
}

[data-theme="dark"] .pwa-notification-message {
    color: #cbd5e1;
}

[data-theme="dark"] .pwa-notification-close {
    color: #cbd5e1;
}

[data-theme="dark"] .pwa-notification-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .btn-pwa-install {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .pwa-install-text {
        display: none;
    }
    
    .btn-pwa-install svg {
        width: 18px;
        height: 18px;
    }
    
    .pwa-notification {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .btn-pwa-install {
        padding: 0.5rem;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
    
    .pwa-notification {
        padding: 1rem;
        font-size: 0.875rem;
    }
    
    .pwa-notification-title {
        font-size: 0.9375rem;
    }
    
    .pwa-notification-message {
        font-size: 0.8125rem;
    }
}

/* ========================================
   ANIMATION DE PULSE POUR ATTIRER L'ATTENTION
   ======================================== */

@keyframes pulsePWA {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow: 0 4px 25px rgba(212, 175, 55, 0.6);
    }
}

.btn-pwa-install.pulse {
    animation: pulsePWA 2s ease-in-out infinite;
}

/* ========================================
   BADGE "NOUVEAU" SUR LE BOUTON
   ======================================== */

.btn-pwa-install::after {
    content: 'Nouveau';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Masquer le badge après 10 secondes */
.btn-pwa-install.no-badge::after {
    display: none;
}

/* ========================================
   SPLASH SCREEN (iOS)
   ======================================== */

@media (display-mode: standalone) {
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, var(--primary-color), #b8941f);
        z-index: 99999;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: fadeOutSplash 0.5s ease-out 1s forwards;
    }
}

@keyframes fadeOutSplash {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* ========================================
   INDICATEUR D'INSTALLATION RÉUSSIE
   ======================================== */

.pwa-install-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 10001;
    animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.pwa-install-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.pwa-install-success-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.pwa-install-success-message {
    font-size: 0.875rem;
    color: var(--text-light);
}

[data-theme="dark"] .pwa-install-success {
    background: #1e293b;
}

[data-theme="dark"] .pwa-install-success-title {
    color: #f1f5f9;
}

[data-theme="dark"] .pwa-install-success-message {
    color: #cbd5e1;
}

