/* =============================================
   MONCV.WISDAK.NET - PWA STYLES
   Styles spécifiques pour la Progressive Web App
   ============================================= */

/* === PWA INSTALL BANNER === */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    padding: 16px 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-top: 3px solid var(--primary);
}

.pwa-install-banner.show {
    transform: translateY(0);
}

.pwa-install-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.pwa-install-text h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--dark);
}

.pwa-install-text p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: var(--gray);
}

.pwa-install-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-install-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.pwa-install-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.pwa-install-dismiss {
    background: transparent;
    color: var(--gray);
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s ease;
}

.pwa-install-dismiss:hover {
    color: var(--dark);
}

/* === SPLASH SCREEN === */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-logo {
    animation: splashPulse 2s ease-in-out infinite;
}

.splash-logo h1 {
    color: white;
    font-size: 3rem;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.splash-logo p {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    text-align: center;
    margin: 10px 0 0;
}

.splash-loader {
    margin-top: 30px;
    width: 50px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
}

.splash-loader-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    animation: splashLoading 2s ease-in-out infinite;
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes splashLoading {
    0% { width: 0%; margin-left: 0; }
    50% { width: 100%; margin-left: 0; }
    100% { width: 0%; margin-left: 100%; }
}

/* === OFFLINE INDICATOR === */
.offline-banner {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--warning);
    color: var(--dark);
    text-align: center;
    padding: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.offline-banner.show {
    transform: translateY(0);
}

.offline-banner .offline-icon {
    font-size: 1.2rem;
}

/* === UPDATE AVAILABLE BANNER === */
.update-banner {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--info);
    color: white;
    text-align: center;
    padding: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.update-banner button {
    background: white;
    color: var(--info);
    border: none;
    padding: 6px 16px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* === PWA STANDALONE MODE === */
@media (display-mode: standalone) {
    /* Ajustements quand l'app est installée */
    .main-nav {
        padding-top: env(safe-area-inset-top, 0px);
    }
    
    .hero {
        padding-top: calc(80px + env(safe-area-inset-top, 0px));
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    /* Cacher les éléments non pertinents en mode app */
    .install-prompt-desktop {
        display: none !important;
    }
    
    /* Ajuster les boutons pour les zones sûres */
    .btn-fab {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

/* Mode fullscreen */
@media (display-mode: fullscreen) {
    .main-nav {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* === PWA PULL-TO-REFRESH === */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: transform 0.3s ease;
}

.pull-to-refresh .refresh-icon {
    font-size: 1.2rem;
    animation: none;
}

.pull-to-refresh.refreshing .refresh-icon {
    animation: spin 0.8s linear infinite;
}

/* === BOTTOM NAVIGATION (Mobile) === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 998;
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
    
    body {
        padding-bottom: 70px;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--gray);
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 5px 10px;
    cursor: pointer;
    background: none;
    border: none;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-icon {
    font-size: 1.4rem;
}

.bottom-nav-badge {
    position: relative;
}

.bottom-nav-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* === FAB BUTTON (Floating Action Button) === */
.btn-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 997;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fab:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.btn-fab:active {
    transform: scale(0.95);
}

/* === TOUCH RIPPLE EFFECT === */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
    opacity: 0;
}

/* === SWIPE GESTURES === */
.swipeable {
    touch-action: pan-y;
    user-select: none;
}

.swipe-hint {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.swipe-hint-left {
    left: 20px;
}

.swipe-hint-right {
    right: 20px;
}

.swipeable:hover .swipe-hint {
    opacity: 0.5;
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg, var(--light) 0%, #e8e8e8 50%, var(--light) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 16px;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 15px;
}

.skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--dark-light);
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* === NETWORK STATUS === */
.network-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.network-online {
    background: var(--success-light);
    color: var(--success);
}

.network-offline {
    background: var(--danger-light);
    color: var(--danger);
}

.network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.network-online .network-dot {
    background: var(--success);
    animation: pulse 2s infinite;
}

.network-offline .network-dot {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === SYNC STATUS === */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--info-light);
    color: var(--info);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sync-indicator.syncing .sync-icon {
    animation: spin 1s linear infinite;
}

.sync-indicator.synced {
    background: var(--success-light);
    color: var(--success);
}

.sync-indicator.failed {
    background: var(--danger-light);
    color: var(--danger);
}

/* === STORAGE USAGE === */
.storage-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.storage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.storage-bar-fill.warning {
    background: var(--warning);
}

.storage-bar-fill.danger {
    background: var(--danger);
}

.storage-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 4px;
}

/* === SHARE BUTTON === */
.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-button:hover {
    background: var(--primary);
    color: white;
}

/* === PWA SHORTCUTS MENU === */
.shortcuts-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 20px;
}

.shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 10px;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--dark);
    border: 2px solid transparent;
}

.shortcut-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.shortcut-icon {
    font-size: 2rem;
}

.shortcut-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

/* === RESPONSIVE PWA === */
@media (max-width: 480px) {
    .pwa-install-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }
    
    .pwa-install-info {
        flex-direction: column;
        text-align: center;
    }
    
    .pwa-install-actions {
        width: 100%;
        justify-content: center;
    }
    
    .btn-fab {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
        bottom: 90px;
    }
    
    .shortcuts-menu {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .shortcut-item {
        padding: 15px 5px;
    }
}

/* === NOTCH / SAFE AREA === */
@supports (padding: env(safe-area-inset-top)) {
    .main-nav {
        padding-top: env(safe-area-inset-top);
    }
    
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .splash-screen {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* === DARK MODE SUPPORT (optionnel) === */
@media (prefers-color-scheme: dark) {
    /* Décommentez pour activer le mode sombre automatique */
    /*
    :root {
        --white: #1a1a1a;
        --light: #2a2a2a;
        --dark: #f5f5f5;
        --dark-light: #e0e0e0;
        --border: #404040;
    }
    */
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .splash-loader-bar,
    .skeleton,
    .sync-indicator.syncing .sync-icon {
        animation: none;
    }
    
    .ripple::after {
        display: none;
    }
}