/* ===================== ESTILOS PARA COMPONENTES JQUERY UI/UX ===================== */

/* 1. EFEITOS DE HOVER NOS CARDS - SUAVIZADOS */
.card-hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.image-zoom {
    transform: scale(1.05);
}

/* 2. EFEITO RIPPLE NOS BOTÕES */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* 3. FEEDBACK DE CLIQUE NAS CATEGORIAS */
.category-clicked {
    transform: scale(0.95);
    background: linear-gradient(145deg, #e0f2fe, #b3e5fc) !important;
}

/* 4. ESTADO DE LOADING DA PÁGINA */
.page-loading {
    position: relative;
}

.page-loading::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 100; /* Reduzido para não conflitar com menu mobile */
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-loading::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 101; /* Reduzido para não conflitar com menu mobile */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 5. IMAGENS CARREGADAS */
.image-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.image-error {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* 6. LAYOUT MOBILE */
.mobile-layout .product-card {
    margin-bottom: 1rem;
}

.mobile-layout .product-title {
    font-size: 0.9rem;
    min-height: 2.5rem;
}

/* 7. OTIMIZAÇÃO DE SCROLL */
.scroll-optimized {
    transition: none !important;
}

/* 8. FORMULÁRIOS FOCADOS */
.input-focused {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* 9. ANIMAÇÕES DE ENTRADA */
.animate-in {
    animation: slideInUp 0.6s ease-out forwards;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 10. OVERLAY DE LOADING */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100; /* Reduzido para não conflitar com menu mobile */
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 11. MENSAGENS DE ERRO */
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 101; /* Reduzido para não conflitar com menu mobile */
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.close-error {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* 12. MENSAGENS DE SUCESSO */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 101; /* Reduzido para não conflitar com menu mobile */
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.close-success {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* 13. CARDS FOCADOS */
.card-focused {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 14. GESTOS TOUCH */
.swipe-left {
    animation: swipeLeft 0.3s ease-out;
}

.swipe-right {
    animation: swipeRight 0.3s ease-out;
}

@keyframes swipeLeft {
    0% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

@keyframes swipeRight {
    0% { transform: translateX(0); }
    50% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

/* 15. TOOLTIPS */
.ui-tooltip {
    background: #1f2937;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10; /* Reduzido para não conflitar com menu mobile */
}

.ui-tooltip::before {
    border-color: #1f2937;
}

/* 16. RESPONSIVIDADE PARA MENSAGENS */
@media (max-width: 768px) {
    .error-message,
    .success-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 0.875rem;
    }
    
    .loading-overlay {
        background: rgba(255, 255, 255, 0.95);
    }
}

/* 17. MELHORIAS DE ACESSIBILIDADE */
@media (prefers-reduced-motion: reduce) {
    .ripple,
    .animate-in,
    .swipe-left,
    .swipe-right,
    .category-clicked {
        animation: none !important;
        transition: none !important;
    }
    
    .card-hover {
        transform: none !important;
    }
    
    .image-zoom {
        transform: none !important;
    }
}

/* 18. ESTADOS DE FOCO MELHORADOS */
.product-card:focus-within {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* 19. MELHORIAS PARA TELAS DE ALTA DENSIDADE */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-card img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 20. ESTADOS DE HOVER MELHORADOS */
@media (hover: hover) {
    .product-card:hover .product-title {
        color: #2563eb;
    }
    
    .product-card:hover .price {
        color: #1d4ed8;
    }
}

/* 21. MELHORIAS PARA TELAS TOUCH */
@media (hover: none) and (pointer: coarse) {
    .product-card {
        -webkit-tap-highlight-color: transparent;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
}

/* 22. ESTADOS DE CARREGAMENTO SKELETON */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.skeleton-text {
    height: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-image {
    height: 200px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* 23. MELHORIAS NO CONTRASTE */
@media (prefers-contrast: high) {
    .product-card {
        border: none !important;
        box-shadow: 0 0 0 2px #000 !important;
    }
    
    .product-card:hover {
        box-shadow: 0 0 0 2px #2563eb !important;
    }
    
    .error-message {
        border: 2px solid #000;
    }
    
    .success-message {
        border: 2px solid #000;
    }
}

/* 24. MELHORIAS PARA MODO ESCURO */
@media (prefers-color-scheme: dark) {
    .loading-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .error-message {
        background: #dc2626;
    }
    
    .success-message {
        background: #059669;
    }
}
