/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Otimizações de performance */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading para imagens */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Header da loja */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.cart-icon-header {
    position: relative;
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cart-icon-header:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.menu-toggle:hover,
.menu-toggle:focus {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}

/* Menu lateral (drawer) */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
    will-change: transform;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: bold;
}

.close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.close-sidebar:hover,
.close-sidebar:focus {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}

.sidebar-menu {
    padding: 1rem 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    touch-action: manipulation;
}

.menu-item:hover,
.menu-item:focus {
    background: #f8f9fa;
    border-left-color: #667eea;
    transform: translateX(5px);
}

.menu-item .icon {
    margin-right: 1rem;
    font-size: 1.1rem;
    color: #667eea;
    width: 20px;
    text-align: center;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container principal */
.main-container {
    margin-top: 80px;
    padding: 1rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    min-height: calc(100vh - 80px);
}

/* Filtros de categoria */
.category-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    text-align: center;
}

.category-filters h3 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    text-align: center;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    justify-content: center;
    align-items: center;
}

.filter-buttons::-webkit-scrollbar {
    height: 4px;
}

.filter-buttons::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.filter-buttons::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 2px;
}

.filter-btn {
    background: #f8f9fa;
    color: #333;
    padding: 0.6rem 1.2rem;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: 2px solid transparent;
    touch-action: manipulation;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.filter-btn:hover,
.filter-btn:focus {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #764ba2;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

/* Grid de produtos */
.products-section {
    margin-bottom: 2rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.product-card {
    /* Remover width fixa, deixar o grid controlar */
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    will-change: transform;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    flex-shrink: 0;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-image.no-image {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 3rem;
}

.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 1rem;
}

.btn-buy {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.8rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
    touch-action: manipulation;
    margin-top: auto;
}

.btn-buy:hover,
.btn-buy:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    color: white;
}

/* Estado vazio */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state .icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.empty-state p {
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Utilitários */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    .header {
        padding: 0.8rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .main-container {
        margin-top: 70px;
        padding: 0.8rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-card {
        border-radius: 12px;
    }
    
    .product-image {
        height: 220px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .category-filters {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .filter-buttons {
        gap: 0.3rem;
        justify-content: center;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        max-width: 100%;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 12px;
    }
}

/* Breakpoint para tablets */
@media (max-width: 1024px) and (min-width: 769px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .product-image {
        height: 240px;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0.5rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .product-image {
        height: 220px;
    }
    
    .product-info {
        padding: 0.8rem;
    }
    
    .product-name {
        font-size: 1rem;
    }
    
    .product-price {
        font-size: 1.1rem;
    }
    
    .btn-buy {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 10px;
        text-align: center;
        width: 100%;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .filter-buttons {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Otimizações para touch devices */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover {
        transform: none;
        box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    }
    
    .product-card:hover .product-image {
        transform: none;
    }
    
    .btn-buy:hover,
    .filter-btn:hover,
    .menu-item:hover {
        transform: none;
    }
    
    /* Aumentar área de toque */
    .menu-toggle,
    .close-sidebar,
    .btn-buy,
    .filter-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .product-card,
    .category-filters {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .product-name {
        color: #e0e0e0;
    }
    
    .sidebar {
        background: #2d2d2d;
    }
    
    .menu-item {
        color: #e0e0e0;
    }
    
    .menu-item:hover {
        background: #3d3d3d;
    }
    
    .category-filters h3 {
        color: #e0e0e0; /* Garante que o texto seja visível no modo escuro */
    }
    
    .category-filters h3 .fas {
        color: #e0e0e0; /* Garante que o ícone seja visível no modo escuro */
    }
}

/* Performance optimizations */
.product-card,
.sidebar,
.overlay {
    will-change: transform;
}

/* Prevent layout shift */
.product-image {
    aspect-ratio: 16/9;
}

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

/* Focus styles for accessibility */
button:focus,
a:focus,
input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

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

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* Estilos para o header reorganizado */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    position: relative;
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
    color: white;
}

.header-icon .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

