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

:root {
    --primary: #1a5f7a;
    --secondary: #f59e0b;
    --dark: #1f2937;
    --light: #f3f4f6;
    --border: #e5e7eb;
    --text: #374151;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #0f4c63 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--primary);
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-btn {
    padding: 10px 12px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    transition: all 0.2s;
    color: var(--text);
}

.category-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.category-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    border-color: var(--primary);
}

/* Main Content Area */
.content {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* Listings View */
#listings-header {
    margin-bottom: 25px;
}

#listings-header h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.count {
    color: #6b7280;
    font-size: 0.95rem;
}

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

/* Listing Card */
.listing-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.listing-card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.listing-image {
    width: 100%;
    height: 200px;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.9rem;
    overflow: hidden;
}

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

.listing-info {
    padding: 15px;
}

.listing-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-meta {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.listing-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.listing-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-tag {
    display: inline-block;
    background: var(--secondary);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Detail View */
.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 20px;
    padding: 8px 0;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--secondary);
}

.listing-detail {
    max-width: 900px;
}

.detail-header {
    margin-bottom: 30px;
}

.detail-title {
    font-size: 2rem;
    color: var(--dark);
    margin-bottom: 15px;
}

.detail-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
}

.detail-meta-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 2px;
}

.detail-meta-value {
    font-weight: 600;
    color: var(--dark);
}

.detail-image {
    width: 100%;
    max-width: 600px;
    border-radius: 8px;
    margin-bottom: 30px;
    background: var(--light);
}

.detail-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.detail-content {
    margin-bottom: 30px;
    line-height: 1.8;
}

.detail-content h3 {
    font-size: 1.3rem;
    margin: 20px 0 10px;
    color: var(--primary);
}

.detail-content p {
    margin-bottom: 15px;
}

.detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 15px 0;
}

.detail-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.contact-btn {
    background: var(--secondary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Footer */
.footer {
    background: var(--dark);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* Loading State */
.loading {
    text-align: center;
    color: #9ca3af;
    padding: 40px 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
    }

    .header h1 {
        font-size: 1.8rem;
    }

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

    .detail-title {
        font-size: 1.5rem;
    }

    .detail-meta {
        flex-direction: column;
        gap: 10px;
    }
}
