* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
}

/* Header */
.header {
    background: linear-gradient(135deg, #4a9d9c, #5cb3b1);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.logo h2 {
    font-size: 1.8rem;
    font-weight: bold;
}

.search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-container button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #ecd41e;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.search-container button:hover {
    background: #ecd41e;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: #ecd41e;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: #ecd41e;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: white;
    color: #4a9d9c;
}

/* Navigation */
.nav {
    background: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    padding: 0 2rem;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover,
.nav-btn.active {
    background: #4a9d9c;
    color: white;
}

/* Main Content */
.main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filters select {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    outline: none;
    cursor: pointer;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.post-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.post-image {
    width: 100%;
    height: 200px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.post-type-badge.troca {
    background: #4a9d9c;
}

.post-type-badge.venda {
    background: #ecd41e;
}

.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 1.2rem;
}

.favorite-btn:hover {
    background: white;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #ecd41e;
}

.post-content {
    padding: 1.5rem;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.post-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ecd41e;
    margin-bottom: 0.5rem;
}

.post-location {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.post-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-chat,
.btn-contact {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-chat {
    background: #4a9d9c;
    color: white;
}

.btn-chat:hover {
    background: #3a8b8a;
}

.btn-contact {
    background: #f0f0f0;
    color: #333;
}

.btn-contact:hover {
    background: #e0e0e0;
}

/* Create Post Form */
.create-post-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.create-post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.btn-back {
    background: transparent;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #f0f0f0;
}

.create-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #4a9d9c;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.image-upload {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.preview-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-create {
    background: #ecd41e;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 1rem;
}

.btn-create:hover {
    background: #ecd41e;
    transform: translateY(-2px);
}

/* Post Detail */
.post-detail-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.post-detail-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
}

.post-detail-content {
    padding: 2rem;
}

.post-detail-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.post-detail-info {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.post-detail-main h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #333;
}

.post-detail-main p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.post-detail-sidebar {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
}

/* Profile Page */
.profile-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.profile-info {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: center;
}

.profile-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-details h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.profile-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a9d9c;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.user-posts h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.user-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Favorites Page */
.favorites-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.favorites-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* Chat Page */
.chat-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    align-self: flex-end;
    background: #4a9d9c;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 15px 15px 0 15px;
    max-width: 70%;
    word-break: break-word;
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}

.chat-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
}

.chat-form button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: #4a9d9c;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-form button:hover {
    background: #3a8b8a;
}

/* Rating stars */
.rating {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.rating .star {
    width: 20px;
    height: 20px;
    display: inline-block;
    background: transparent;
    cursor: pointer;
    color: #ddd;
    font-size: 20px;
    line-height: 20px;
    transition: color 0.15s;
}

.rating .star.filled {
    color: #ffd166;
    /* gold-ish */
}

.rating.small .star {
    width: 16px;
    height: 16px;
    font-size: 16px
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .search-container {
        max-width: 100%;
        margin: 0;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .main {
        padding: 0 1rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .post-detail-info {
        grid-template-columns: 1fr;
    }

    .profile-info {
        flex-direction: column;
        text-align: center;
    }

    .user-posts-grid {
        grid-template-columns: 1fr;
    }

    .favorites-grid {
        grid-template-columns: 1fr;
    }

    .chat-container {
        width: 100%;
        height: auto;
        padding: 1rem;
    }
}

@media (max-width: 480px) {

    .create-post-container,
    .post-detail-container,
    .profile-container,
    .favorites-container {
        margin: 1rem;
        padding: 1rem;
    }

    .post-card {
        margin: 0 0.5rem;
    }
}