/**
 * GMIT PWA Styles
 * Version: 1.0.0
 */

/* ==============================================
   BUTON INSTALARE PWA
   ============================================== */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    
    display: flex;
    align-items: center;
    gap: 10px;
    
    padding: 14px 24px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    border-radius: 50px;
    
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
    
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-btn.visible {
    transform: translateY(0);
    opacity: 1;
}

.pwa-install-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.5);
    transform: translateY(-2px);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-install-btn svg {
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 768px) {
    .pwa-install-btn {
        bottom: 80px;
        right: 50%;
        transform: translateX(50%) translateY(100px);
        width: calc(100% - 40px);
        max-width: 320px;
        justify-content: center;
    }
    
    .pwa-install-btn.visible {
        transform: translateX(50%) translateY(0);
    }
}

/* ==============================================
   NOTIFICARE ACTUALIZARE
   ============================================== */
.pwa-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-update-notification.visible {
    transform: translateX(0);
    opacity: 1;
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 16px;
    
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #f59e0b;
}

.pwa-update-content span {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.pwa-update-btn {
    padding: 8px 16px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.pwa-update-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 768px) {
    .pwa-update-notification {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .pwa-update-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .pwa-update-btn {
        width: 100%;
    }
}

/* ==============================================
   MESAJ INSTALARE REUȘITĂ
   ============================================== */
.pwa-success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10001;
    
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-success-message.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pwa-success-content {
    padding: 32px 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    
    font-size: 18px;
    font-weight: 600;
    color: #10b981;
    line-height: 1.6;
}

.pwa-success-content small {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 400;
    color: #6b7280;
}

/* Backdrop */
.pwa-success-message::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* Mobile */
@media (max-width: 768px) {
    .pwa-success-content {
        padding: 24px 28px;
        font-size: 16px;
    }
}

/* ==============================================
   BANNER STATUS CONEXIUNE
   ============================================== */
.pwa-online-banner,
.pwa-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    
    animation: slideDown 0.3s ease-out;
}

.pwa-online-banner {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.pwa-offline-banner {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ==============================================
   STANDALONE MODE - Ajustări UI
   ============================================== */
.pwa-standalone {
    /* Padding extra sus pentru status bar */
    padding-top: env(safe-area-inset-top);
}

.pwa-standalone .pm-single-container,
.pwa-standalone .pm-form,
.pwa-standalone .pm-wrapper {
    /* Ajustări pentru safe areas */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ==============================================
   SPLASH SCREEN LOADING
   ============================================== */
.pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.pwa-splash.hidden {
    opacity: 0;
    pointer-events: none;
}

.pwa-splash-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    animation: pulse 2s ease-in-out infinite;
}

.pwa-splash-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.pwa-splash-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ==============================================
   OFFLINE INDICATOR
   ============================================== */
.pwa-offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9997;
    
    display: flex;
    align-items: center;
    gap: 10px;
    
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border-radius: 20px;
    
    font-size: 13px;
    font-weight: 600;
    
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-offline-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Mobile */
@media (max-width: 768px) {
    .pwa-offline-indicator {
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ==============================================
   INSTALL PROMPT CARD (alternativă)
   ============================================== */
.pwa-install-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    
    padding: 20px;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pwa-install-card.visible {
    transform: translateY(0);
}

.pwa-install-card-content {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-install-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    flex-shrink: 0;
}

.pwa-install-card-text {
    flex: 1;
}

.pwa-install-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.pwa-install-card-description {
    font-size: 13px;
    color: #6b7280;
}

.pwa-install-card-actions {
    display: flex;
    gap: 10px;
}

.pwa-install-card-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-card-btn-primary {
    background: #4f46e5;
    color: white;
}

.pwa-install-card-btn-primary:hover {
    background: #4338ca;
}

.pwa-install-card-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.pwa-install-card-btn-secondary:hover {
    background: #e5e7eb;
}

/* ==============================================
   LOADING SPINNER (pentru sync)
   ============================================== */
.pwa-sync-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    
    width: 60px;
    height: 60px;
    border: 4px solid rgba(79, 70, 229, 0.2);
    border-top-color: #4f46e5;
    border-radius: 50%;
    
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==============================================
   PRINT STYLES - ascunde elementele PWA
   ============================================== */
@media print {
    .pwa-install-btn,
    .pwa-update-notification,
    .pwa-success-message,
    .pwa-online-banner,
    .pwa-offline-banner,
    .pwa-offline-indicator,
    .pwa-install-card {
        display: none !important;
    }
}