:root {
    --primary: #16A34A;
    --primary-dark: #15803D;
    --bg: #F8FAFC;
    --white: #FFFFFF;
    --text: #111827;
    --text-muted: #64748B;
    --danger: #DC2626;
    --warning: #F59E0B;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    line-height: 1.6; 
    padding-bottom: 0;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.narrow-container { max-width: 600px; }

/* ==========================================
   HEADER
   ========================================== */
.main-header { 
    background: var(--white); 
    border-bottom: 1px solid var(--border); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
}

.header-content { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 1rem 0; 
    gap: 1rem; 
}

.logo { 
    font-size: 1.5rem; 
    font-weight: 800; 
    color: var(--text); 
}

.logo span { color: var(--primary); }

/* Search Bar Desktop - CORRIGIDO */
.search-bar-desktop { 
    flex: 1; 
    max-width: 500px; 
}

.search-bar-desktop form { 
    display: flex; 
    width: 100%; 
}

.search-bar-desktop input { 
    flex: 1; 
    padding: 0.75rem 1rem; 
    border: 1px solid var(--border); 
    border-radius: var(--radius) 0 0 var(--radius); 
    outline: none; 
    font-size: 0.95rem;
    min-width: 0;
}

.search-bar-desktop input:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1); 
}

.search-bar-desktop button { 
    padding: 0.75rem 1.5rem; 
    background: var(--primary); 
    color: var(--white); 
    border: none; 
    border-radius: 0 var(--radius) var(--radius) 0; 
    cursor: pointer; 
    font-weight: 700; 
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.search-bar-desktop button:hover { 
    background: var(--primary-dark); 
}

.header-actions { 
    display: flex; 
    gap: 0.5rem; 
    align-items: center; 
}

.user-avatar img { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    object-fit: cover; 
    border: 2px solid var(--primary); 
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    padding: 0.75rem 1.5rem; 
    border-radius: var(--radius); 
    font-weight: 600; 
    cursor: pointer; 
    border: none; 
    transition: all 0.2s; 
    font-size: 0.95rem; 
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { 
    background: transparent; 
    border: 1px solid var(--border); 
    color: var(--text); 
}

.btn-outline:hover { 
    border-color: var(--primary); 
    color: var(--primary); 
}

.btn-whatsapp { background: #25D366; color: var(--white); }
.btn-large { padding: 1rem 2rem; font-size: 1.1rem; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 0.5rem; }

/* ==========================================
   HERO
   ========================================== */
.hero { 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
    color: var(--white); 
    padding: 3rem 0; 
    text-align: center; 
}

.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 2rem; }

/* Hero Search - CORRIGIDO */
.hero-search { 
    max-width: 600px; 
    margin: 0 auto 1rem; 
    display: flex; 
}

.hero-search form {
    display: flex;
    width: 100%;
}

.hero-search input { 
    flex: 1; 
    padding: 1rem 1.25rem; 
    border: none; 
    border-radius: var(--radius) 0 0 var(--radius); 
    font-size: 1rem;
    outline: none;
    min-width: 0;
}

.hero-search input:focus {
    box-shadow: inset 0 0 0 2px var(--primary);
}

.hero-search button { 
    padding: 1rem 2rem; 
    background: var(--warning); 
    color: var(--text); 
    border: none; 
    border-radius: 0 var(--radius) var(--radius) 0; 
    font-weight: 700; 
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.hero-search button:hover { 
    background: #d97706; 
}

.hero-location { 
    font-size: 0.9rem; 
    opacity: 0.8; 
    margin-bottom: 1.5rem; 
}

.hero-cta { margin-top: 1rem; }

/* ==========================================
   SECTIONS
   ========================================== */
.section { padding: 3rem 0; }
.bg-light { background: var(--white); }
.section-title { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--text); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.link-see-all { color: var(--primary); font-weight: 600; }
.text-center { text-align: center; }
.subtitle { color: var(--text-muted); margin-bottom: 2rem; }

/* ==========================================
   CATEGORIES GRID
   ========================================== */
.categories-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 1rem; 
}

.category-card { 
    background: var(--white); 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    padding: 1.5rem 1rem; 
    text-align: center; 
    transition: transform 0.2s, box-shadow 0.2s; 
}

.category-card:hover { 
    transform: translateY(-3px); 
    box-shadow: var(--shadow); 
    border-color: var(--primary); 
}

.category-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.category-name { font-weight: 600; display: block; margin-bottom: 0.25rem; }
.category-count { font-size: 0.8rem; color: var(--text-muted); }

/* ==========================================
   PRODUCTS GRID
   ========================================== */
.products-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    gap: 1.5rem; 
}

.product-card { 
    background: var(--white); 
    border-radius: var(--radius); 
    overflow: hidden; 
    border: 1px solid var(--border); 
    transition: box-shadow 0.2s; 
    position: relative; 
}

.product-card:hover { box-shadow: var(--shadow); }

.card-image-wrapper { 
    position: relative; 
    aspect-ratio: 4/3; 
    overflow: hidden; 
    display: block; 
}

.card-image-wrapper img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    transition: transform 0.3s; 
}

.product-card:hover .card-image-wrapper img { transform: scale(1.05); }

.btn-fav { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    background: rgba(255,255,255,0.9); 
    border: none; 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    cursor: pointer; 
    font-size: 1.2rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s; 
}

.btn-fav:hover, .btn-fav.favorited { 
    background: var(--danger); 
    color: var(--white); 
}

.card-status-badge { 
    position: absolute; 
    top: 10px; 
    left: 10px; 
    background: var(--warning); 
    color: var(--text); 
    padding: 0.25rem 0.75rem; 
    border-radius: 20px; 
    font-size: 0.8rem; 
    font-weight: 700; 
}

.status-reservado .card-status-badge { background: var(--warning); }
.status-vendido .card-status-badge { background: var(--danger); color: var(--white); }
.status-vendido { opacity: 0.7; }

.card-content { padding: 1rem; }

.card-title { 
    font-size: 1rem; 
    margin-bottom: 0.5rem; 
    line-height: 1.4; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}

.card-title a:hover { color: var(--primary); }
.card-price { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; }
.card-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }

/* ==========================================
   STEPS
   ========================================== */
.steps-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 2rem; 
    text-align: center; 
}

.step-card { padding: 1rem; }

.step-number { 
    width: 40px; 
    height: 40px; 
    background: var(--primary); 
    color: var(--white); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 700; 
    font-size: 1.2rem; 
    margin: 0 auto 1rem; 
}

/* ==========================================
   FORMS
   ========================================== */
.form-card { 
    background: var(--white); 
    padding: 2rem; 
    border-radius: var(--radius); 
    border: 1px solid var(--border); 
}

.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label { 
    display: block; 
    font-weight: 600; 
    margin-bottom: 0.5rem; 
    font-size: 0.9rem; 
}

input, select, textarea { 
    width: 100%; 
    padding: 0.75rem; 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    font-size: 1rem; 
    font-family: inherit; 
}

input:focus, select:focus, textarea:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1); 
}

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-group input { width: auto; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

/* ==========================================
   ANUNCIO PAGE
   ========================================== */
.anuncio-layout { 
    display: grid; 
    grid-template-columns: 1.5fr 1fr; 
    gap: 2rem; 
    margin-top: 2rem; 
}

.anuncio-gallery .main-image { 
    border-radius: var(--radius); 
    overflow: hidden; 
    margin-bottom: 1rem; 
    border: 1px solid var(--border); 
}

.thumbnail-list { 
    display: flex; 
    gap: 0.5rem; 
    overflow-x: auto; 
}

.thumbnail-list .thumb { 
    width: 80px; 
    height: 80px; 
    object-fit: cover; 
    border-radius: var(--radius); 
    cursor: pointer; 
    border: 2px solid transparent; 
}

.thumbnail-list .thumb:hover { border-color: var(--primary); }

.anuncio-header h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.anuncio-price { font-size: 2rem; font-weight: 800; color: var(--primary); margin-bottom: 1rem; }
.anuncio-meta { 
    display: flex; 
    gap: 1rem; 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    margin-bottom: 1.5rem; 
    flex-wrap: wrap; 
}

.anuncio-info-box { 
    background: var(--white); 
    padding: 1.5rem; 
    border-radius: var(--radius); 
    border: 1px solid var(--border); 
    margin: 1.5rem 0; 
}

.info-tags { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.tag { background: var(--bg); padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.85rem; font-weight: 600; }
.tag-success { background: #dcfce7; color: #166534; }
.tag-warning { background: #fef3c7; color: #92400e; }

.seller-card { 
    display: flex; 
    gap: 1rem; 
    align-items: center; 
    background: var(--white); 
    padding: 1rem; 
    border-radius: var(--radius); 
    border: 1px solid var(--border); 
    margin-bottom: 1.5rem; 
}

.seller-card img { width: 50px; height: 50px; border-radius: 50%; }

.safety-warning { 
    background: #fef2f2; 
    border: 1px solid #fecaca; 
    color: #991b1b; 
    padding: 1rem; 
    border-radius: var(--radius); 
    font-size: 0.9rem; 
}

/* ==========================================
   SEARCH LAYOUT
   ========================================== */
.search-layout { 
    display: grid; 
    grid-template-columns: 280px 1fr; 
    gap: 2rem; 
    margin-top: 2rem; 
}

.search-sidebar { 
    background: var(--white); 
    padding: 1.5rem; 
    border-radius: var(--radius); 
    border: 1px solid var(--border); 
    height: fit-content; 
}

.results-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 1.5rem; 
}

.results-count { color: var(--text-muted); }

/* ==========================================
   PAGINATION
   ========================================== */
.pagination { 
    display: flex; 
    justify-content: center; 
    gap: 0.5rem; 
    margin-top: 2rem; 
}

.page-link { 
    padding: 0.5rem 1rem; 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    color: var(--text); 
}

.page-link.active { 
    background: var(--primary); 
    color: var(--white); 
    border-color: var(--primary); 
}

.page-link:hover:not(.active) { background: var(--bg); }

/* ==========================================
   MOBILE BOTTOM NAV
   ========================================== */
.mobile-bottom-nav { 
    display: none; 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    background: var(--white); 
    border-top: 1px solid var(--border); 
    z-index: 1000; 
    justify-content: space-around; 
    padding: 0.5rem 0; 
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); 
}

.mobile-bottom-nav .nav-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    font-size: 0.75rem; 
    color: var(--text-muted); 
    gap: 0.25rem; 
}

.mobile-bottom-nav .nav-item span { font-size: 1.25rem; }
.mobile-bottom-nav .nav-item.active { color: var(--primary); }

.mobile-bottom-nav .nav-item.highlight { 
    color: var(--primary); 
    font-weight: 700; 
    transform: translateY(-10px); 
    background: var(--white); 
    border: 2px solid var(--primary); 
    border-radius: 50%; 
    width: 50px; 
    height: 50px; 
    justify-content: center; 
    box-shadow: var(--shadow); 
}

/* ==========================================
   TOAST
   ========================================== */
#toast-container { 
    position: fixed; 
    bottom: 80px; 
    right: 20px; 
    z-index: 2000; 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
}

.toast { 
    background: var(--text); 
    color: var(--white); 
    padding: 1rem 1.5rem; 
    border-radius: var(--radius); 
    box-shadow: var(--shadow); 
    animation: slideIn 0.3s ease; 
}

.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }

@keyframes slideIn { 
    from { transform: translateX(100%); opacity: 0; } 
    to { transform: translateX(0); opacity: 1; } 
}

/* ==========================================
   MODAL
   ========================================== */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 3000; 
    align-items: center; 
    justify-content: center; 
}

.modal.active { display: flex; }

.modal-content { 
    background: var(--white); 
    padding: 2rem; 
    border-radius: var(--radius); 
    width: 90%; 
    max-width: 500px; 
    position: relative; 
}

.close-modal { 
    position: absolute; 
    top: 1rem; 
    right: 1rem; 
    font-size: 1.5rem; 
    cursor: pointer; 
}

/* ==========================================
   FOOTER
   ========================================== */
.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 3rem 0 0;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #334155;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.75rem;
}

.footer-logo span {
    color: var(--primary);
}

.footer-tagline {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.footer-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #94a3b8;
}

.footer-col h4 {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-social {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.footer-social a {
    font-size: 1.5rem;
    text-decoration: none;
    transition: transform 0.2s;
}

.footer-social a:hover {
    transform: scale(1.2);
}

.footer-bottom {
    padding: 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

.footer-city {
    font-weight: 600;
    color: var(--primary);
}

/* ==========================================
   UTILITIES
   ========================================== */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.link-sm {
    font-size: 0.85rem;
    color: var(--primary);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }

    .header-content { 
        flex-wrap: wrap; 
    }

    .search-bar-desktop { 
        display: none; 
    }

    .logo { 
        font-size: 1.25rem; 
    }

    .hero h1 { 
        font-size: 1.75rem; 
    }

    .hero-search { 
        flex-direction: row; 
        gap: 0; 
    }

    .hero-search form {
        display: flex;
        width: 100%;
    }

    .hero-search input { 
        border-radius: var(--radius) 0 0 var(--radius); 
        flex: 1; 
    }

    .hero-search button { 
        border-radius: 0 var(--radius) var(--radius) 0; 
        width: auto; 
    }

    .categories-grid { 
        grid-template-columns: repeat(2, 1fr); 
    }

    .products-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 0.75rem; 
    }

    .product-card .card-title { 
        font-size: 0.9rem; 
        -webkit-line-clamp: 2; 
    }

    .product-card .card-price { 
        font-size: 1.1rem; 
    }

    .product-card .card-meta { 
        font-size: 0.7rem; 
        flex-direction: column; 
        gap: 0.25rem; 
    }

    .anuncio-layout { 
        grid-template-columns: 1fr; 
    }

    .search-layout { 
        grid-template-columns: 1fr; 
    }

    .search-sidebar { 
        display: none; 
    }

    .mobile-bottom-nav { 
        display: flex; 
    }

    .form-row { 
        grid-template-columns: 1fr; 
    }

    .steps-grid { 
        grid-template-columns: 1fr; 
    }

    /* Footer Mobile */
    .site-footer {
        padding: 2rem 0 0;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .footer-col:first-child {
        grid-column: 1 / -1;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .products-grid { 
        grid-template-columns: repeat(3, 1fr); 
    }
    .anuncio-layout { 
        grid-template-columns: 1fr 1fr; 
    }
}

@media (min-width: 1025px) {
    .products-grid { 
        grid-template-columns: repeat(4, 1fr); 
    }
    .hero { 
        padding: 5rem 0; 
    }
    .hero h1 { 
        font-size: 3rem; 
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
.sr-only { 
    position: absolute; 
    width: 1px; 
    height: 1px; 
    padding: 0; 
    margin: -1px; 
    overflow: hidden; 
    clip: rect(0, 0, 0, 0); 
    white-space: nowrap; 
    border-width: 0; 
}

:focus-visible { 
    outline: 2px solid var(--primary); 
    outline-offset: 2px; 
}