* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Tema Escuro Neutro */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2d2d2d;
    --bg-card: #1f1f1f;
    
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    
    --border-color: #404040;
    --border-light: #525252;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: 24px;
    width: 100%;
}

/* HEADER */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 16px;
    width: 100%;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.action-button:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.action-button svg {
    transition: var(--transition);
}

.action-button:hover svg {
    stroke: white;
}

.button-label {
    display: none;
}

.badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.action-button:hover .badge {
    background: white;
    color: var(--primary);
}

/* PESQUISA */
.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--primary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-muted);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.clear-search.show {
    display: flex;
}

.clear-search:hover {
    background: var(--danger);
}

.clear-search svg {
    stroke: white;
}

/* FILTROS */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 113px;
    z-index: 99;
    width: 100%;
}

.sort-select {
    flex: 1;
    max-width: 240px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.sort-select:hover {
    border-color: var(--primary);
}

.sort-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.product-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* PRODUTOS - OTIMIZADO PARA MOBILE */
.products-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    width: 100%;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 8px;
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin-bottom: 10px;
    cursor: pointer;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.product-image-container:hover .product-img {
    transform: scale(1.05);
}

.favorite-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(8px);
    border: 1.5px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.favorite-toggle:hover {
    transform: scale(1.1);
    border-color: var(--danger);
}

.favorite-toggle.active {
    background: var(--danger);
    border-color: var(--danger);
}

.favorite-toggle.active svg {
    fill: white;
    stroke: white;
}

.product-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 8px;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
    word-wrap: break-word;
}

.product-title:hover {
    color: var(--primary);
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 10px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.quantity-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    flex: 1;
}

.quantity-selector {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    border: none;
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.quantity-btn:hover {
    background: var(--primary);
    color: white;
}

.quantity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.quantity-value {
    min-width: 32px;
    padding: 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.btn-cart,
.btn-whatsapp {
    width: 100%;
    padding: 10px 8px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-cart {
    background: var(--primary);
    color: white;
    margin-bottom: 6px;
}

.btn-cart:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-cart.in-cart {
    background: var(--success);
}

.btn-cart.in-cart:hover {
    background: var(--success-dark);
}

.btn-whatsapp {
    background: var(--success);
    color: white;
}

.btn-whatsapp:hover {
    background: var(--success-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* CARREGAR MAIS */
.load-more-container {
    display: none;
    justify-content: center;
    padding: 24px 16px;
}

.load-more-container.show {
    display: flex;
}

.load-more-btn {
    padding: 14px 32px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.load-more-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ESTADO VAZIO */
.empty-state {
    display: none;
    text-align: center;
    padding: 80px 20px;
}

.empty-state.show {
    display: block;
}

.empty-icon {
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.modal-close:hover svg {
    stroke: white;
}

.cart-summary {
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-row.total {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 18px;
    color: var(--text-primary);
}

.summary-row.total strong {
    color: var(--success);
    font-size: 22px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.modal-btn.primary {
    background: var(--primary);
    color: white;
}

.modal-btn.primary:hover {
    background: var(--primary-dark);
}

.modal-btn.secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
}

.modal-btn.secondary:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.modal-btn.success {
    background: var(--success);
    color: white;
}

.modal-btn.success:hover {
    background: var(--success-dark);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

#favGrid,
#cartGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.modal-empty {
    text-align: center;
    padding: 60px 20px;
}

.modal-empty svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 16px;
}

/* MODAL IMAGEM */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.image-modal.show {
    display: block;
}

.image-modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(26, 26, 26, 0.9);
    border: 1.5px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.image-modal-close:hover {
    background: var(--danger);
}

.image-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#expandedImage {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.image-modal-info {
    text-align: center;
    color: white;
}

.image-modal-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.image-modal-info p {
    font-size: 22px;
    font-weight: 700;
    color: var(--success);
}

/* LOADING */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.loading-spinner.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* RESPONSIVO */
@media (min-width: 640px) {
    .products-grid,
    #favGrid,
    #cartGrid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
    
    .button-label {
        display: inline;
    }
    
    .filters-bar {
        top: 129px;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .product-title {
        font-size: 14px;
        min-height: 40px;
    }
    
    .product-price {
        font-size: 18px;
    }
    
    .btn-cart,
    .btn-whatsapp {
        font-size: 14px;
        padding: 12px;
    }
}

@media (min-width: 1024px) {
    .products-grid,
    #favGrid,
    #cartGrid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (min-width: 1280px) {
    .products-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}