/* PWA Specific Styles */

/* Quando rodando como PWA instalado */
.pwa-mode {
    /* Remover elementos desnecessários em modo PWA */
}

.pwa-mode .navbar-brand {
    /* Ajustes específicos para PWA */
}

/* Botão de instalação PWA */
.pwa-install-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    border-radius: 25px !important;
    padding: 12px 20px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%) !important;
    border: none !important;
    color: white !important;
    font-weight: 600;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.pwa-install-button:hover {
    /* manter o translateX do estado normal e aplicar um pequeno translateY no hover */
    transform: translate(-50%, -2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #224abe 0%, #4e73df 100%) !important;
}

.pwa-install-button i {
    margin-right: 8px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow: 0 4px 12px rgba(78, 115, 223, 0.5);
    }

    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Melhorias para dispositivos móveis */
@media (max-width: 768px) {
    .pwa-install-button {
        bottom: 80px;
        /* Evitar conflito com menu móvel - manter centralizado horizontalmente */
        left: 50%;
        transform: translateX(-50%);
        padding: 10px 16px !important;
        font-size: 14px;
    }
}

/* Indicador de status offline */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #e74c3c;
    color: white;
    text-align: center;
    padding: 8px;
    z-index: 9999;
    font-size: 14px;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

.offline-indicator i {
    margin-right: 8px;
}

/* Melhorias para tela cheia em PWA */
@media (display-mode: standalone) {

    /* Ajustes quando o app está em modo standalone */
    .navbar-fixed-top {
        padding-top: 0;
    }

    /* Remover margens que consideram a barra do navegador */
    body {
        padding-top: 0;
    }
}

/* Loading spinner para PWA */
.pwa-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.pwa-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4e73df;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Badge de notificação PWA */
.pwa-notification-badge {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #27ae60;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.pwa-notification-badge.show {
    opacity: 1;
    transform: translateX(0);
}

.pwa-notification-badge .close-btn {
    background: none;
    border: none;
    color: white;
    margin-left: 10px;
    cursor: pointer;
    font-size: 16px;
}

/* Estilos para tela de splash personalizada */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    color: white;
    transition: opacity 0.5s ease;
}

.pwa-splash.hide {
    opacity: 0;
    pointer-events: none;
}

.pwa-splash .logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s infinite alternate;
}

.pwa-splash .title {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.pwa-splash .subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.pwa-splash .loading-dots {
    display: flex;
    gap: 5px;
}

.pwa-splash .loading-dots span {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: loading 1.4s infinite ease-in-out both;
}

.pwa-splash .loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.pwa-splash .loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    from {
        transform: translateY(0px);
    }

    to {
        transform: translateY(-10px);
    }
}

@keyframes loading {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsividade para PWA */
@media (max-width: 480px) {
    .pwa-splash .logo {
        font-size: 3rem;
    }

    .pwa-splash .title {
        font-size: 1.5rem;
    }

    .pwa-notification-badge {
        top: 10px;
        right: 10px;
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* Melhoria para status bar em dispositivos móveis */
@media (display-mode: standalone) and (max-width: 768px) {
    .navbar {
        padding-top: env(safe-area-inset-top, 0);
    }

    .content-wrapper {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}