/**
 * Estilos para Prompt de Instalação PWA
 * VibeCode PWA Maker
 */

/* Overlay */
.vibecode-pwa-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

/* Container do Prompt */
.vibecode-pwa-prompt {
    position: fixed;
    z-index: 99999;
    display: none;
}

.vibecode-pwa-prompt.visible {
    display: block !important;
}

/* Container interno - TOTALMENTE CORRIGIDO */
.vibecode-pwa-prompt-container {
    position: fixed !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    max-width: 500px !important;
    width: calc(100% - 40px) !important;
    padding: 24px !important;
    padding-top: 50px !important;
    animation: slideUp 0.4s ease !important;
    z-index: 100000 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Garantir que container é visível quando prompt tem classe visible */
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* FORÇAR visibilidade de TODOS os elementos dentro do container */
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-container * {
    visibility: visible !important;
}

/* Garantir que conteúdo, ações e botões são visíveis */
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-content,
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-actions,
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-button {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-text,
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-title,
.vibecode-pwa-prompt.visible .vibecode-pwa-prompt-message {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile: Prompt em baixo */
@media (max-width: 768px) {
    .vibecode-pwa-prompt-container {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        max-width: none !important;
        width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        padding: 20px !important;
        padding-top: 50px !important;
    }
}

/* Botão Fechar - CORRIGIDO */
.vibecode-pwa-prompt-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border: none !important;
    cursor: pointer !important;
    padding: 8px !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    color: #666 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    z-index: 100000 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.vibecode-pwa-prompt-close:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    color: #000 !important;
    transform: scale(1.1) !important;
}

.vibecode-pwa-prompt-close:active {
    transform: scale(0.95) !important;
}

/* SVG dentro do botão close */
.vibecode-pwa-prompt-close svg {
    display: block !important;
    width: 16px !important;
    height: 16px !important;
    pointer-events: none !important;
    fill: currentColor !important;
}

.vibecode-pwa-prompt-close svg path {
    fill: currentColor !important;
}

/* Conteúdo */
.vibecode-pwa-prompt-content {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-start;
    position: relative;
    z-index: 1;
    padding-right: 44px; /* Espaço para botão × */
}

/* Ícone da App */
.vibecode-pwa-prompt-icon {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.vibecode-pwa-prompt-icon img {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

@media (max-width: 480px) {
    .vibecode-pwa-prompt-icon img {
        width: 56px;
        height: 56px;
    }
}

/* Texto */
.vibecode-pwa-prompt-text {
    flex: 1;
    position: relative;
    z-index: 1;
    padding-right: 0; /* Removido - padding já está no content */
}

.vibecode-pwa-prompt-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    margin: 0 0 8px 0 !important;
    color: #111111 !important;
    line-height: 1.3 !important;
    position: relative !important;
    z-index: 1 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    display: block !important;
    visibility: visible !important;
}

.vibecode-pwa-prompt-message {
    font-size: 14px !important;
    color: #666666 !important;
    margin: 0 0 12px 0 !important;
    line-height: 1.5 !important;
    position: relative !important;
    z-index: 1 !important;
    display: block !important;
    visibility: visible !important;
}

/* Instruções iOS */
.vibecode-pwa-ios-instructions {
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    padding: 12px;
    margin-top: 12px;
    border-radius: 4px;
}

.vibecode-pwa-ios-instructions p {
    margin: 0;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.6;
}

.vibecode-pwa-ios-instructions strong {
    display: block;
    margin-bottom: 8px;
    color: #1e3a8a;
}

/* Ações */
.vibecode-pwa-prompt-actions {
    display: flex;
    gap: 12px;
}

@media (max-width: 480px) {
    .vibecode-pwa-prompt-actions {
        flex-direction: column;
    }
}

/* Botões */
.vibecode-pwa-prompt-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vibecode-pwa-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.vibecode-pwa-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
    color: #ffffff !important;
}

.vibecode-pwa-btn-primary:active {
    transform: translateY(0);
    color: #ffffff !important;
}

.vibecode-pwa-btn-primary svg {
    width: 20px;
    height: 20px;
    fill: #ffffff !important;
    color: #ffffff !important;
}

.vibecode-pwa-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.vibecode-pwa-btn-secondary:hover {
    background: #e5e7eb;
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 768px) {
    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Estado: Escondido */
.vibecode-pwa-prompt.hiding .vibecode-pwa-prompt-container {
    animation: slideDown 0.3s ease forwards;
}

.vibecode-pwa-prompt.hiding .vibecode-pwa-prompt-overlay {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(50px);
    }
}

@media (max-width: 768px) {
    @keyframes slideDown {
        from {
            opacity: 1;
            transform: translateY(0);
        }
        to {
            opacity: 0;
            transform: translateY(100%);
        }
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .vibecode-pwa-prompt-container,
    .vibecode-pwa-prompt-overlay {
        animation: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .vibecode-pwa-prompt-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .vibecode-pwa-prompt-title {
        color: #f9fafb;
    }
    
    .vibecode-pwa-prompt-message {
        color: #d1d5db;
    }
    
    .vibecode-pwa-prompt-close {
        color: #9ca3af;
    }
    
    .vibecode-pwa-prompt-close:hover {
        background: #374151;
        color: #f9fafb;
    }
    
    .vibecode-pwa-btn-secondary {
        background: #374151;
        color: #f9fafb;
    }
    
    .vibecode-pwa-btn-secondary:hover {
        background: #4b5563;
    }
}
