/* Estilos personalizados para Mobile App */

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* Prevenir zoom no iOS */
input,
select,
textarea {
    font-size: 16px !important;
}

/* Bottom Navigation */
#bottom-nav {
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item.active {
    color: #2563eb;
}

/* Camera Preview */
#camera-video {
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Safe area for iOS notch */
body {
    padding-bottom: env(safe-area-inset-bottom);
}

#bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Touch feedback */
button:active,
.cursor-pointer:active {
    opacity: 0.7;
}

/* Prevent pull-to-refresh on iOS */
body {
    overscroll-behavior-y: contain;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* SweetAlert2: acima do overlay global (#loading-overlay z-index: 9999) e da bottom nav */
.swal2-container {
    z-index: 10050 !important;
}

/* SweetAlert2 customizations – padding inferior em todos os modais */
.swal2-popup {
    border-radius: 1rem !important;
    overflow: hidden !important;
    padding: 0 !important;
    padding-bottom: 1.5rem !important;
}

.swal2-actions {
    margin-bottom: 0 !important;
    padding-bottom: 0.5rem !important;
}

.swal-detalhes-beneficiario.swal2-popup {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.swal2-title {
    font-size: 1rem !important;
    font-weight: 500 !important;
    padding-right: 2rem;
}

/* Header do modal Detalhes do Beneficiário: fundo azul escuro, texto e X brancos */
.swal-detalhes-beneficiario .swal2-header {
    background-color: #1e3a8a !important;
    padding: 1rem 1.5rem !important;
    margin: 0 !important;
    border-radius: 1rem 1rem 0 0 !important;
    position: relative !important;
}

.swal-detalhes-beneficiario .swal2-title {
    font-weight: 400 !important;
    font-size: 1rem !important;
    color: #ffffff !important;
    text-align: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 2rem !important;
    box-sizing: border-box !important;
    background: transparent !important;
}

.swal-detalhes-beneficiario .swal2-close {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    color: #ffffff !important;
    width: 2rem !important;
    height: 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.9 !important;
    background: transparent !important;
    font-size: 2rem !important;
    line-height: 1 !important;
}

.swal-detalhes-beneficiario .swal2-close:hover {
    color: #ffffff !important;
    opacity: 1 !important;
    background: transparent !important;
}

.swal-detalhes-beneficiario .swal2-close:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Body e Footer do modal Detalhes do Beneficiário */
.swal-detalhes-beneficiario .swal2-html-container {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

.swal-detalhes-beneficiario .swal-modal-body {
    padding: 1.5rem;
    text-align: left;
}

.swal-detalhes-beneficiario .swal-modal-footer {
    display: block;
    padding: 1rem;
    margin: 1.5rem 0 0 0;
    background: #ffffff;
    width: 100%;
}

.swal-detalhes-beneficiario .swal-modal-footer button {
    border-radius: 0.5rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

/* Modal de confirmação de entrega */
.swal-confirm-entrega.swal2-popup {
    padding: 1.75rem 1.5rem !important;
}

/* Modal Senha Gerada: espaço na parte inferior */
.swal-senha-gerada.swal2-popup {
    padding-bottom: 2rem !important;
}

.swal-senha-gerada .swal2-actions {
    margin-bottom: 0 !important;
    padding-bottom: 0.5rem !important;
}

.swal-confirm-entrega .swal2-title {
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}

.swal-confirm-entrega .swal2-html-container {
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
}

.swal-confirm-entrega .swal2-actions {
    gap: 0.75rem;
    margin-top: 0;
}

/* Botão close sem aparecer "marcado" ao abrir o modal */
.swal2-close:focus,
.swal2-close-no-focus:focus {
    outline: none !important;
    box-shadow: none !important;
}

.swal2-confirm {
    background-color: #2563eb !important;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}

.swal2-cancel {
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
}

/* Alpine transitions */
[x-cloak] {
    display: none !important;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* PWA Install Button */
.install-prompt {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
}
