* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

:root {
    --primary: #1877f2;
    --primary-dark: #0d65d8;
    --background: #f5f6f8;
    --white: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --green: #22c55e;
    --danger: #dc2626;
}

body {
    background: var(--background);
    color: var(--text);
    padding-bottom: 0;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

button {
    cursor: pointer;
}


/* =====================================
   HEADER
===================================== */

.header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: auto;

    min-height: 72px;

    display: flex;
    align-items: center;
    gap: 25px;

    padding: 10px 25px;
}


/* LOGO */

.logo {
    color: var(--primary);
    font-size: 25px;
    font-weight: 800;
    text-decoration: none;
}

.logo span {
    color: #111827;
}


/* SEARCH */

.search {
    position: relative;
    flex: 1;
    max-width: 650px;
}

.search span {
    position: absolute;
    left: 16px;
    top: 12px;
}

.search input {
    width: 100%;
    height: 45px;

    border: none;
    outline: none;

    background: #f0f2f5;

    border-radius: 25px;

    padding: 0 20px 0 45px;

    font-size: 14px;
}

.search input:focus {
    box-shadow: 0 0 0 2px #dbeafe;
}


/* HEADER RIGHT */

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.location {
    white-space: nowrap;
    font-size: 13px;
    color: #4b5563;
}

.header-chat,
.favorite-header {
    border: none;
    background: #f0f2f5;

    height: 42px;

    padding: 0 13px;

    border-radius: 8px;

    font-weight: bold;
}

.header-chat {
    color: var(--primary);
}

.favorite-header {
    font-size: 20px;
}

.account-button {
    border: none;
    background: transparent;

    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 40px;
    height: 40px;

    border-radius: 50%;

    display: flex;
    justify-content: center;
    align-items: center;

    background: var(--primary);
    color: white;

    font-weight: bold;
}

#userName {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =====================================
   ACCOUNT MENU
===================================== */

.account-menu {
    position: fixed;

    top: 80px;
    right: 20px;

    width: 230px;

    background: white;

    padding: 10px;

    border-radius: 12px;

    box-shadow: 0 10px 35px rgba(0,0,0,.15);

    display: none;

    z-index: 500;
}

.account-menu.active {
    display: block;
}

.account-menu button {
    width: 100%;

    border: none;
    background: transparent;

    text-align: left;

    padding: 12px;

    border-radius: 7px;
}

.account-menu button:hover {
    background: #f3f4f6;
}

.account-menu .logout {
    color: var(--danger);
}


/* =====================================
   CONTAINER
===================================== */

.container {
    max-width: 1400px;
    margin: auto;
    padding: 30px 25px;
}

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
}


/* =====================================
   SIDEBAR
===================================== */

.sidebar {
    background: white;

    padding: 20px;

    border-radius: 12px;

    height: fit-content;

    position: sticky;
    top: 100px;
}

.sidebar h3 {
    margin-bottom: 15px;
}

.category {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 12px;

    border: none;
    background: transparent;

    padding: 12px;

    border-radius: 8px;

    text-align: left;
}

.category:hover,
.category.active {
    background: #eaf2ff;
    color: var(--primary);
}


/* =====================================
   BANNER
===================================== */

.banner {
    min-height: 220px;

    background:
        linear-gradient(
            110deg,
            #1877f2,
            #1557b0
        );

    border-radius: 16px;

    color: white;

    padding: 35px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 30px;
}

.banner-small {
    font-size: 12px;
    font-weight: bold;
    opacity: .8;
}

.banner h1 {
    max-width: 600px;

    font-size: 35px;

    margin: 8px 0;
}

.banner h1 strong {
    color: #dbeafe;
}

.banner p {
    max-width: 600px;

    color: #e5efff;
}

.banner button {
    border: none;

    background: white;

    color: var(--primary);

    padding: 13px 20px;

    border-radius: 8px;

    font-weight: bold;
}


/* =====================================
   SECTION
===================================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 23px;
}

.section-header p {
    color: var(--muted);
    margin-top: 5px;
    font-size: 13px;
}

.desktop-sell {
    background: var(--primary);
    color: white;

    border: none;

    padding: 12px 18px;

    border-radius: 8px;

    font-weight: bold;
}


/* =====================================
   FILTERS
===================================== */

.filters {
    display: flex;
    gap: 10px;

    overflow-x: auto;

    margin-bottom: 20px;
}

.filters button {
    white-space: nowrap;

    background: white;

    border: 1px solid var(--border);

    border-radius: 20px;

    padding: 9px 15px;

    font-size: 13px;
}

.filters button:hover {
    color: var(--primary);
    border-color: var(--primary);
}


/* =====================================
   PRODUCTS
===================================== */

.products {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 18px;
}

.product {
    background: white;

    border: 1px solid #eee;

    border-radius: 12px;

    overflow: hidden;

    transition: .2s;
}

.product:hover {
    transform: translateY(-3px);

    box-shadow:
        0 8px 25px rgba(0,0,0,.08);
}

.product-image {
    height: 210px;

    position: relative;

    background: #eee;
}

.product-image img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.favorite {
    position: absolute;

    right: 10px;
    top: 10px;

    width: 35px;
    height: 35px;

    border: none;

    border-radius: 50%;

    background: white;

    font-size: 19px;
}

.favorite.liked {
    color: #e11d48;
}

.product-info {
    padding: 15px;
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.product-price {
    font-size: 19px;
    font-weight: bold;

    margin-bottom: 7px;
}

.product-name {
    font-size: 14px;

    margin-bottom: 9px;
}

.product-location {
    color: var(--muted);

    font-size: 12px;
}

.product-seller {
    color: #374151;
    font-size: 12px;
    margin-top: 6px;
}

.whatsapp-card-btn {
    margin-top: 10px;
    width: 100%;
    border: none;
    border-radius: 8px;
    padding: 9px 10px;
    background: #22c55e;
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
}

.whatsapp-card-btn:hover {
    background: #16a34a;
}

.condition {
    display: inline-block;

    padding: 4px 8px;

    background: #ecfdf5;

    color: #059669;

    border-radius: 5px;

    font-size: 10px;
}

.tag-type {
    background: #eff6ff;
    color: #2563eb;
}

.tag-status {
    background: #f0fdf4;
    color: #166534;
}

.tag-status.finalizado {
    background: #fef2f2;
    color: #991b1b;
}

.ad-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.ad-action-btn {
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
}

.ad-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ad-action-btn.danger {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.ad-action-btn.danger:hover {
    border-color: #ef4444;
    color: #991b1b;
}


/* =====================================
   MODAL
===================================== */

.modal {
    position: fixed;

    inset: 0;

    background: rgba(0,0,0,.55);

    display: none;

    align-items: center;
    justify-content: center;

    padding: 20px;

    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 450px;

    max-height: 90vh;

    overflow-y: auto;

    background: white;

    border-radius: 15px;

    padding: 30px;

    position: relative;
}

.close {
    position: absolute;

    top: 12px;
    right: 15px;

    border: none;
    background: transparent;

    font-size: 28px;

    color: #777;
}


/* =====================================
   LOGIN
===================================== */

.modal-logo {
    font-size: 25px;
    font-weight: 800;

    color: var(--primary);

    margin-bottom: 20px;
}

.modal-logo span {
    color: #111827;
}

.modal-box h2 {
    margin-bottom: 7px;
}

.modal-box > p {
    color: var(--muted);

    font-size: 13px;

    margin-bottom: 20px;
}

.required-note {
    font-size: 12px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 12px;
}

.input {
    width: 100%;

    height: 48px;

    border: 1px solid #ddd;

    border-radius: 8px;

    padding: 0 14px;

    margin-bottom: 12px;

    outline: none;

    font-size: 14px;
}

.input:focus {
    border-color: var(--primary);
}

.hidden {
    display: none;
}

.textarea {
    height: 100px;

    padding-top: 12px;

    resize: vertical;
}

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.preview-photo {
    width: 100%;
    height: 82px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.specs-container {
    margin-bottom: 12px;
}

.spec-title {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--muted);
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.spec-input {
    margin-bottom: 0;
}

.primary-button,
.register-button {
    width: 100%;

    height: 48px;

    border: none;

    border-radius: 8px;

    font-weight: bold;
}

.primary-button {
    background: var(--primary);
    color: white;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.register-button {
    background: var(--green);
    color: white;
}

.separator {
    text-align: center;

    color: #999;

    margin: 17px 0;
}

.form-message {
    text-align: center;

    margin-top: 12px;

    font-size: 13px;
}


/* =====================================
   PRODUCT DETAIL
===================================== */

.product-modal {
    max-width: 600px;
}

.detail-image {
    width: 100%;

    height: 300px;

    object-fit: cover;

    border-radius: 10px;

    margin-bottom: 18px;

    cursor: grab;
    touch-action: pan-y;
}

.detail-gallery {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.detail-thumb {
    width: 100%;
    height: 62px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
}

.detail-thumb.active {
    border-color: var(--primary);
}

.detail-category {
    color: var(--primary);

    font-size: 12px;

    font-weight: bold;

    margin-bottom: 8px;
}

.detail-price {
    font-size: 28px;

    font-weight: bold;

    margin: 12px 0;
}

.detail-location {
    color: var(--muted);

    font-size: 13px;

    margin-bottom: 20px;
}

.detail-description {
    line-height: 1.6;

    margin-bottom: 20px;
}

.anuncio-page {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    text-decoration: none;
    color: var(--primary);
    font-weight: bold;
}

.anuncio-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
}

.seller-highlight {
    font-size: 14px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 14px;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1500;
    padding: 20px;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox-img {
    max-width: min(1200px, 95vw);
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    touch-action: pan-y;
}

.image-lightbox-close {
    position: fixed;
    top: 14px;
    right: 18px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 32px;
    line-height: 36px;
    text-align: center;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.34);
}


/* =====================================
   CHAT
===================================== */

.chat-box {
    width: 100%;

    max-width: 900px;

    height: 650px;

    background: white;

    border-radius: 15px;

    overflow: hidden;
}

.chat-header {
    height: 65px;

    background: var(--primary);

    color: white;

    padding: 15px 20px;

    display: flex;

    justify-content: space-between;

    align-items: center;
}

.chat-header strong {
    display: block;
}

.chat-header small {
    opacity: .8;
}

.chat-header button {
    border: none;

    background: transparent;

    color: white;

    font-size: 28px;
}

.chat-body {
    height: calc(100% - 65px);

    display: grid;

    grid-template-columns: 250px 1fr;
}

.chat-list {
    border-right: 1px solid var(--border);

    overflow-y: auto;
}

.chat-contact {
    width: 100%;

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 14px;

    border: none;

    border-bottom: 1px solid #f0f0f0;

    background: white;

    text-align: left;
}

.chat-contact:hover,
.chat-contact.active {
    background: #eff6ff;
}

.chat-avatar {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border-radius: 50%;

    background: var(--primary);

    color: white;

    display: flex;

    justify-content: center;

    align-items: center;

    font-weight: bold;
}

.chat-contact strong,
.chat-contact small {
    display: block;
}

.chat-contact small {
    color: var(--muted);

    font-size: 11px;

    margin-top: 3px;
}

.conversation-area {
    display: flex;

    flex-direction: column;

    min-width: 0;
}

.conversation-messages {
    flex: 1;

    padding: 20px;

    overflow-y: auto;

    background: #f7f8fa;
}

.message {
    max-width: 70%;

    padding: 10px 13px;

    border-radius: 13px;

    margin-bottom: 10px;

    font-size: 14px;

    line-height: 1.4;
}

.message.received {
    background: white;

    margin-right: auto;
}

.message.sent {
    background: var(--primary);

    color: white;

    margin-left: auto;
}

.message-input {
    display: flex;

    gap: 8px;

    padding: 10px;

    border-top: 1px solid var(--border);
}

.message-input input {
    flex: 1;

    height: 42px;

    border: 1px solid #ddd;

    border-radius: 22px;

    padding: 0 15px;

    outline: none;
}

.message-input button {
    width: 42px;

    height: 42px;

    border: none;

    border-radius: 50%;

    background: var(--primary);

    color: white;
}


/* =====================================
   MOBILE NAV
===================================== */

.mobile-nav {
    display: none;
}


/* =====================================
   EMPTY
===================================== */

.empty {
    grid-column: 1 / -1;

    background: white;

    padding: 60px 20px;

    border-radius: 12px;

    text-align: center;

    color: var(--muted);
}


/* =====================================
   TABLET
===================================== */

@media(max-width:1100px) {

    .products {
        grid-template-columns:
            repeat(3, 1fr);
    }

    .location {
        display: none;
    }

}


/* =====================================
   TABLET / MOBILE
===================================== */

@media(max-width:850px) {

    .header-content {
        gap: 12px;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .products {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .banner h1 {
        font-size: 28px;
    }

}


/* =====================================
   CELULAR
===================================== */

@media(max-width:600px) {

    body {
        padding-bottom: 70px;
    }


    /* HEADER */

    .header-content {
        min-height: auto;

        padding: 12px;

        flex-wrap: wrap;
    }

    .logo {
        font-size: 22px;

        width: 100%;
    }

    .search {
        order: 3;

        width: 100%;

        max-width: none;
    }

    .header-right {
        position: absolute;

        right: 10px;

        top: 10px;
    }

    .header-chat span,
    .favorite-header,
    .account-button #userName {
        display: none;
    }

    .header-chat {
        width: 40px;
        padding: 0;
    }


    /* CONTAINER */

    .container {
        padding: 15px 10px;
    }


    /* BANNER */

    .banner {
        min-height: auto;

        padding: 22px;

        margin-bottom: 22px;
    }

    .banner h1 {
        font-size: 23px;
    }

    .banner p {
        font-size: 12px;

        margin-top: 8px;
    }

    .banner button {
        display: none;
    }


    /* HEADER */

    .section-header {
        align-items: flex-start;
    }

    .section-header h2 {
        font-size: 19px;
    }

    .section-header p {
        font-size: 11px;
    }

    .desktop-sell {
        padding: 9px 11px;

        font-size: 11px;
    }


    /* PRODUTOS */

    .products {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 9px;
    }

    .product-image {
        height: 145px;
    }

    .product-info {
        padding: 10px;
    }

    .product-price {
        font-size: 16px;
    }

    .product-name {
        font-size: 12px;

        min-height: 30px;
    }

    .product-location {
        font-size: 10px;
    }

    .condition {
        font-size: 9px;
    }


    /* MOBILE NAV */

    .mobile-nav {
        display: flex;

        position: fixed;

        left: 0;
        right: 0;
        bottom: 0;

        height: 65px;

        background: white;

        border-top: 1px solid var(--border);

        z-index: 900;

        justify-content: space-around;
    }

    .mobile-nav button {
        flex: 1;

        border: none;

        background: transparent;

        color: #6b7280;

        display: flex;

        flex-direction: column;

        justify-content: center;

        align-items: center;

        gap: 3px;
    }

    .mobile-nav button span {
        font-size: 20px;
    }

    .mobile-nav button small {
        font-size: 9px;
    }

    .mobile-nav .sell-mobile {
        color: var(--primary);
    }

    .mobile-nav .sell-mobile span {
        width: 35px;
        height: 35px;

        display: flex;

        justify-content: center;
        align-items: center;

        border-radius: 50%;

        background: var(--primary);

        color: white;

        font-size: 22px;
    }


    /* MODAL */

    .modal {
        padding: 10px;
    }

    .modal-box {
        max-height: 92vh;

        padding: 22px;

        border-radius: 13px;
    }


    /* PRODUTO */

    .detail-image {
        height: 220px;
    }

    .anuncio-layout {
        grid-template-columns: 1fr;
    }

    .photo-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-gallery {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .spec-grid {
        grid-template-columns: 1fr;
    }


    /* CHAT */

    .chat-box {
        height: 100%;

        max-height: 100%;

        border-radius: 0;
    }

    .chat-body {
        grid-template-columns: 1fr;
    }

    .chat-list {
        display: flex;

        overflow-x: auto;

        border-right: none;

        border-bottom: 1px solid var(--border);

        height: 75px;
    }

    .chat-contact {
        min-width: 110px;

        flex-direction: column;

        justify-content: center;

        padding: 7px;
    }

    .chat-contact .chat-avatar {
        width: 32px;
        height: 32px;

        font-size: 12px;
    }

    .chat-contact strong {
        font-size: 11px;
    }

    .chat-contact small {
        display: none;
    }

    .message {
        max-width: 85%;

        font-size: 13px;
    }


    /* ACCOUNT */

    .account-menu {
        top: 65px;

        right: 10px;

        width: 210px;
    }

}