/**
 * Design System Unificado - Cards de Produtos
 * Corpo Bueno Theme - Versão Tailwind + Utilitários
 * Version: 3.0 - Convertido para Tailwind
 */

/* ========================================
   VARIÁVEIS CSS GLOBAIS
   ======================================== */
:root {
    --cb-pink: #EC2552;
    --cb-pink-dark: #86152F;
    --cb-pink-light: #fdf2f8;
    --cb-gray-dark: #1d1d1f;
    --cb-gray-medium: #6b7280;
    --cb-gray-light: #f3f4f6;
    --cb-white: #ffffff;
}

/* ========================================
   UTILITÁRIOS TAILWIND CUSTOMIZADOS
   ======================================== */

/* Truncate para múltiplas linhas */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Aspect ratio personalizado (fallback para navegadores antigos) */
.aspect-square {
    aspect-ratio: 1 / 1;
}

@supports not (aspect-ratio: 1 / 1) {
    .aspect-square {
        position: relative;
        width: 100%;
        height: 0;
        padding-bottom: 100%;
    }
    
    .aspect-square > * {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ========================================
   SCROLLING E CAROUSEL
   ======================================== */

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

/* Snap scrolling */
.snap-x {
    scroll-snap-type: x mandatory;
}

.snap-start {
    scroll-snap-align: start;
}

/* Hide scrollbar */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ========================================
   GRADIENTES PERSONALIZADOS
   ======================================== */
.bg-gradient-cb {
    background: linear-gradient(135deg, var(--cb-pink), var(--cb-pink-dark));
}

.hover\:bg-gradient-cb-light:hover {
    background: linear-gradient(135deg, #FF1493, var(--cb-pink)) !important;
}

/* ========================================
   ESTADOS ESPECIAIS E ANIMAÇÕES
   ======================================== */

/* Loading state */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    border: 3px solid var(--cb-gray-light);
    border-top: 3px solid var(--cb-pink);
    border-radius: 50%;
    animation: cb-spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

@keyframes cb-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Efeito glassmorphism para badges */
.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ========================================
   RESPONSIVIDADE CUSTOMIZADA
   ======================================== */

/* Ajustes específicos para mobile */
@media (max-width: 640px) {
    .grid-cols-mobile {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

/* ========================================
   ACESSIBILIDADE
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Estados de foco melhorados */
.focus-visible\:outline-pink:focus-visible {
    outline: 3px solid var(--cb-pink);
    outline-offset: 4px;
}

/* ========================================
   RESET E OTIMIZAÇÕES
   ======================================== */

/* Performance otimizada */
.transform-gpu {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Box-sizing reset para componentes */
.product-card-system *,
.product-card-system *::before,
.product-card-system *::after {
    box-sizing: border-box;
}

/* ========================================
   CLASSES DE COMPATIBILIDADE
   ======================================== */

/* Para manter compatibilidade com código existente */
.cb-products-grid {
    @apply grid gap-6 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4;
}

/* Garantir que as animações hover funcionem corretamente */
.group:hover .group-hover\:scale-110 {
    transform: scale(1.1);
}

.group:hover .group-hover\:text-pink-600 {
    color: #dc2626;
}