/* home.css - Versão completa com design moderno */

/* Slider Section - Largura total (corrigido) */
.slider-section {
    padding: 0;
    background: #910085;
}

.slider-container {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin: 0;
}

.slider {
    position: relative;
    height: 100%;
}

.slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.slide.active {
    opacity: 1;
}

.slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgb(0 0 0 / 0%), transparent);
    padding: 40px 30px 30px;
    color: white;
}

.slide-caption h3 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.slide-caption p {
    font-size: 1rem;
    opacity: 0.9;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    z-index: 10;
}

.slider-btn:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.05);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.2s;
}

.dot.active {
    background: #ff7800;
    width: 24px;
    border-radius: 10px;
}

/* Categorias Section */
.categorias-section {
    padding: 60px 0;
    background: white;
}

.section-title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 40px;
    color: var(--dark);
}

.categorias-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
}

.categoria-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: #f9f9f9;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.categoria-card:hover {
    transform: translateY(-4px);
    background: var(--primary);
    color: white;
}

.categoria-card:hover .categoria-icon {
    transform: scale(1.1);
}

.categoria-icon {
    font-size: 2.5rem;
    transition: transform 0.2s;
}

.categoria-card span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================ */
/* Anúncios - Design moderno inspirado em catálogo */
/* ============================================ */

/* Anúncios Header */
.anuncios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.anuncios-header .section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
    text-align: left;
    position: relative;
}

.anuncios-header .section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.ordenacao {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--gray);
    background: #f8f9fa;
    padding: 6px 16px;
    border-radius: 40px;
}

.ordenacao span {
    font-weight: 500;
}

.ordenacao select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 30px;
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.ordenacao select:focus {
    border-color: var(--primary);
}

/* Anúncios Grid - Estilo moderno tipo catálogo */
.anuncios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
    margin-bottom: 48px;
}

/* Card de Anúncio - Design inspirado em site moderno */
.anuncio-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: relative;
    animation: fadeInUp 0.4s ease forwards;
}

.anuncio-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.15);
}

/* Área de imagens */
.anuncio-imagens {
    position: relative;
    height: 220px;
    background: #f5f7fa;
    overflow: hidden;
}

.anuncio-imagem-principal {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.anuncio-card:hover .anuncio-imagem-principal {
    transform: scale(1.05);
}

/* Badge de status (opcional) */
.anuncio-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 30px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Navegação de imagens */
.nav-imagens {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.nav-img-btn {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-img-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

.indicadores {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 3;
}

.indicador {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transition: all 0.2s;
}

.indicador.ativo {
    background: white;
    width: 18px;
    border-radius: 3px;
}

/* Informações do Anúncio */
.anuncio-info {
    padding: 18px 16px 20px;
    background: white;
}

.anuncio-preco {
    font-size: 1.4rem;
    font-weight: 700;
    color: #00b721;
    margin-bottom: 8px;
    line-height: 1.2;
}

.anuncio-preco::before {
    content: "R$ ";
    font-size: 0.85rem;
    font-weight: 500;
}

.anuncio-titulo {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}

.anuncio-local {
    font-size: 0.75rem;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.anuncio-vendedor {
    font-size: 0.7rem;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: #ff7800;
    border-radius: 30px;
    transition: all 0.2s;
}

.anuncio-vendedor:hover {
    color: #ffffff;
    background: #2800c1;
}

/* Botão de ação visual (opcional) */
.anuncio-card .btn-detalhe {
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.anuncio-card .btn-detalhe:hover {
    background: var(--primary-dark);
    transform: translateX(4px);
}

/* Loading e estados vazios */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--gray);
    font-size: 1rem;
    grid-column: 1 / -1;
    background: white;
    border-radius: 20px;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.sem-resultados {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    font-size: 1rem;
    grid-column: 1 / -1;
    background: white;
    border-radius: 20px;
}

.sem-resultados p:first-child {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--dark);
}

/* Animações */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================ */
/* Responsividade */
/* ============================================ */

@media (max-width: 768px) {
    .slider-container {
        height: 250px;
    }
    
    .slide-caption h3 {
        font-size: 1.2rem;
    }
    
    .slide-caption p {
        font-size: 0.85rem;
    }
    
    .categorias-section {
        padding: 40px 0;
    }
    
    .categorias-grid {
        gap: 16px;
    }
    
    .categoria-card {
        padding: 16px;
        min-width: 80px;
    }
    
    .categoria-icon {
        font-size: 1.8rem;
    }
    
    .categoria-card span {
        font-size: 0.75rem;
    }
    
    /* Ajustes dos anúncios */
    .anuncios-header {
        margin-bottom: 20px;
        padding-bottom: 12px;
    }
    
    .anuncios-header .section-title {
        font-size: 1.2rem;
    }
    
    .anuncios-header .section-title::after {
        width: 30px;
        bottom: -6px;
    }
    
    .anuncios-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }
    
    .anuncio-imagens {
        height: 180px;
    }
    
    .anuncio-preco {
        font-size: 1.2rem;
    }
    
    .anuncio-titulo {
        font-size: 0.85rem;
    }
    
    .nav-img-btn {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .slider-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .prev {
        left: 10px;
    }
    
    .next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .slider-container {
        height: 180px;
    }
    
    .slide-caption {
        padding: 20px 16px 16px;
    }
    
    .slide-caption h3 {
        font-size: 1rem;
    }
    
    .slide-caption p {
        font-size: 0.7rem;
    }
    
    .slider-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .prev {
        left: 8px;
    }
    
    .next {
        right: 8px;
    }
    
    .categorias-section {
        padding: 24px 0;
    }
    
    .categoria-card {
        padding: 12px;
        min-width: 70px;
    }
    
    .categoria-icon {
        font-size: 1.4rem;
    }
    
    .categoria-card span {
        font-size: 0.7rem;
    }
    
    /* Ajustes dos anúncios mobile */
    .anuncios-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .anuncio-imagens {
        height: 140px;
    }
    
    .anuncio-info {
        padding: 12px 10px 14px;
    }
    
    .anuncio-preco {
        font-size: 1rem;
    }
    
    .anuncio-titulo {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        min-height: 2.2em;
    }
    
    .anuncio-local {
        font-size: 0.65rem;
        margin-bottom: 8px;
    }
    
    .nav-img-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .ordenacao {
        padding: 4px 12px;
        font-size: 0.75rem;
    }
    
    .ordenacao select {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

/* Desktop ajustes */
@media (min-width: 1024px) {
    .slider-container {
        height: 400px;
    }
    
    .slide-caption h3 {
        font-size: 1.8rem;
    }
    
    .slide-caption p {
        font-size: 1rem;
    }
    
    .anuncios-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
    
    .anuncio-imagens {
        height: 200px;
    }
}

/* ============================================ */
/* Touch Feedback e Otimizações Mobile */
/* ============================================ */

@media (hover: none) and (pointer: coarse) {
    .categoria-card:active {
        transform: scale(0.98);
        background: var(--primary);
        color: white;
    }
    
    .anuncio-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .nav-img-btn:active {
        transform: scale(0.92);
        background: var(--primary);
    }
    
    .anuncio-vendedor:active {
        color: var(--primary);
        background: #eef2ff;
    }
    
    button, 
    .categoria-card,
    .anuncio-card,
    .nav-img-btn,
    .ordenacao select {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Smooth scrolling para toda a página */
html {
    scroll-behavior: smooth;
}

/* Melhorias de performance */
img {
    content-visibility: auto;
}

/* Safe area para notches */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}