/* Marketplace Mobile Optimizations */

/* Container principal responsivo */
.marketplace-container {
    padding: 1rem;
}

@media (min-width: 640px) {
    .marketplace-container {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .marketplace-container {
        padding: 2rem;
    }
}

/* Header do marketplace */
.marketplace-header {
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (min-width: 640px) {
    .marketplace-header {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }
}

@media (min-width: 1024px) {
    .marketplace-header {
        padding: 2rem;
        margin-bottom: 2rem;
    }
}

/* Título responsivo */
.marketplace-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .marketplace-title {
        font-size: 1.875rem;
        margin-bottom: 0.75rem;
    }
}

@media (min-width: 1024px) {
    .marketplace-title {
        font-size: 2.25rem;
    }
}

.marketplace-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
}

@media (min-width: 640px) {
    .marketplace-subtitle {
        font-size: 1rem;
    }
}

/* Seção de filtros */
.filters-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
}

@media (min-width: 640px) {
    .filters-section {
        margin-bottom: 2rem;
        padding: 1.5rem;
    }
}

/* Campos de filtro */
.filter-input {
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
}

@media (min-width: 640px) {
    .filter-input {
        padding: 1rem;
    }
}

.filter-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Select responsivo */
.filter-select {
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    background-color: white;
}

@media (min-width: 640px) {
    .filter-select {
        padding: 1rem;
    }
}

.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Botões de filtro */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .filter-actions {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        margin-top: 1.5rem;
    }
}

.filter-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .filter-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    text-decoration: none;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    color: #374151;
    transform: translateY(-1px);
}

/* Resultados da busca */
.search-results {
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    background-color: #f3f4f6;
    border-radius: 0.5rem;
}

@media (min-width: 640px) {
    .search-results {
        padding: 1rem;
        margin-bottom: 2rem;
    }
}

.search-results-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

@media (min-width: 640px) {
    .search-results-text {
        font-size: 1rem;
    }
}

/* Grid de produtos */
.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Card do produto */
.product-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Container da imagem */
.product-image-container {
    position: relative;
    height: 12rem;
    background-color: #f3f4f6;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 640px) {
    .product-image-container {
        height: 16rem;
    }
}

@media (min-width: 1024px) {
    .product-image-container {
        height: 18rem;
    }
}

/* Imagem do produto */
.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 0.5rem;
    transition: transform 0.3s ease;
    max-width: 100%;
    max-height: 100%;
}

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

/* Melhorar responsividade das imagens */
@media (max-width: 640px) {
    .product-image {
        padding: 0.25rem;
    }
}

@media (min-width: 1024px) {
    .product-image {
        padding: 0.75rem;
    }
}

/* Garantir que imagens muito grandes ou pequenas se ajustem */
.product-image {
    min-width: 0;
    min-height: 0;
    flex-shrink: 1;
}

/* Melhorar comportamento de imagens com proporções diferentes */
.product-image-container img {
    object-fit: contain !important;
    object-position: center !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Garantir que imagens de diferentes tamanhos se ajustem */
.product-image-container img[src*="amazon"] {
    object-fit: contain !important;
}

.product-image-container img[src*="media"] {
    object-fit: contain !important;
}

/* Placeholder da imagem */
.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    font-size: 3rem;
    color: #9ca3af;
}

@media (min-width: 640px) {
    .product-image-placeholder {
        font-size: 4rem;
    }
}

/* Badge de categoria */
.category-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: #3b82f6;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .category-badge {
        top: 0.75rem;
        left: 0.75rem;
    }
}

/* Informações do produto */
.product-info {
    background: rgba(255,255,255,0.92); /* Fundo branco translúcido para contraste */
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

@media (min-width: 640px) {
    .product-info {
        padding: 1.5rem;
    }
}

.product-title {
    font-size: 1rem;
    font-weight: bold;
    color: #111827; /* Preto mais forte */
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 640px) {
    .product-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
}

.product-description {
    font-size: 0.75rem;
    color: #374151; /* Cinza escuro para contraste */
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 640px) {
    .product-description {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
}

/* Preço */
.price-section {
    margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
    .price-section {
        margin-bottom: 1rem;
    }
}

.price-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 0.25rem;
}

@media (min-width: 640px) {
    .price-value {
        font-size: 1.5rem;
    }
}

.price-label {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Botões de ação */
.action-buttons {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .action-buttons {
        gap: 0.75rem;
    }
}

.action-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .action-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.action-btn:active {
    transform: translateY(0);
}

/* Cores dos botões */
.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-primary-action {
    background: #3b82f6;
    color: white;
    border: none;
}

.btn-primary-action:hover {
    background: #2563eb;
}

/* Estados vazios */
.empty-state {
    padding: 1.5rem;
    text-align: center;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .empty-state {
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .empty-state {
        padding: 3rem;
    }
}

.empty-icon {
    width: 3rem;
    height: 3rem;
    color: #9ca3af;
    margin: 0 auto 1rem;
}

@media (min-width: 640px) {
    .empty-icon {
        width: 4rem;
        height: 4rem;
        margin-bottom: 1.5rem;
    }
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .empty-title {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
}

.empty-description {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

@media (min-width: 640px) {
    .empty-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
}

/* Melhorias para touch */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover {
        transform: none;
    }
    
    .product-card:hover .product-image {
        transform: none;
    }
    
    .action-btn:hover {
        transform: none;
    }
    
    .action-btn:active {
        transform: scale(0.98);
    }
    
    .filter-btn:hover {
        transform: none;
    }
    
    .filter-btn:active {
        transform: scale(0.98);
    }
}

/* Melhorias para telas muito pequenas */
@media (max-width: 375px) {
    .marketplace-container {
        padding: 0.5rem;
    }
    
    .marketplace-header {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .marketplace-title {
        font-size: 1.25rem;
    }
    
    .products-grid {
        gap: 0.75rem;
    }
    
    .product-image-container {
        height: 10rem;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .action-btn {
        padding: 0.5rem;
        font-size: 0.625rem;
    }
}

/* Melhorias para telas médias */
@media (min-width: 640px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Melhorias para telas grandes */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Melhorias para telas muito grandes */
@media (min-width: 1536px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Melhorias específicas para formulários */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-row {
        flex-direction: row;
        gap: 1.5rem;
    }
}

.form-group {
    flex: 1;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .form-label {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

/* Input group para busca */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group-text {
    position: absolute;
    left: 0.75rem;
    color: #6b7280;
    z-index: 10;
}

.input-group .filter-input {
    padding-left: 2.5rem;
}

/* Melhorias para acessibilidade */
.filter-input:focus,
.filter-select:focus,
.action-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Melhorias para performance */
.product-card {
    will-change: transform;
}

.product-image {
    will-change: transform;
}

/* Melhorias para loading states */
.product-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-card.loading .product-image {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Regras finais para garantir que imagens se ajustem corretamente */
.product-image-container {
    box-sizing: border-box;
}

.product-image-container img {
    box-sizing: border-box;
    display: block;
}

/* Forçar ajuste de imagens problemáticas */
.product-image-container img[style*="width"] {
    width: 100% !important;
    height: 100% !important;
}

.product-image-container img[style*="height"] {
    width: 100% !important;
    height: 100% !important;
}

/* Regras de alta especificidade para sobrescrever conflitos */
.marketplace-container .products-grid .product-card .product-image-container .product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 0.5rem !important;
    box-sizing: border-box !important;
    display: block !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/* Sobrescrever regras do image_responsive.css */
.marketplace-container .products-grid .product-card .product-image-container .product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 0.5rem !important;
    box-sizing: border-box !important;
    display: block !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/* Sobrescrever regras do custom_tailwind.css */
.marketplace-container .products-grid .product-card .product-image-container .product-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 0.5rem !important;
    box-sizing: border-box !important;
    display: block !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

/* Regras específicas para diferentes tamanhos de tela */
@media (max-width: 640px) {
    .marketplace-container .products-grid .product-card .product-image-container .product-image {
        padding: 0.25rem !important;
    }
}

@media (min-width: 1024px) {
    .marketplace-container .products-grid .product-card .product-image-container .product-image {
        padding: 0.75rem !important;
    }
}

/* Garantir que o container da imagem tenha as dimensões corretas */
.marketplace-container .products-grid .product-card .product-image-container {
    position: relative !important;
    height: 12rem !important;
    background-color: #f3f4f6 !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

@media (min-width: 640px) {
    .marketplace-container .products-grid .product-card .product-image-container {
        height: 16rem !important;
    }
}

@media (min-width: 1024px) {
    .marketplace-container .products-grid .product-card .product-image-container {
        height: 18rem !important;
    }
}

/* Regras para telas muito pequenas */
@media (max-width: 375px) {
    .marketplace-container .products-grid .product-card .product-image-container {
        height: 10rem !important;
    }
    
    .marketplace-container .products-grid .product-card .product-image-container .product-image {
        padding: 0.25rem !important;
    }
} 