:root {
    --primary-color: #2E7D32;
    --accent-color: #002F34; /* OLX-like dark accent */
    --btn-text-color: #ffffff;
    --text-main: #002F34; /* Dark, almost black */
    --text-secondary: #7F9799;
    --bg-body: #ffffff; /* Changed to white to remove grey side bars */
    --bg-card: #ffffff;
    --bg-gradient: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%); /* Default gradient */
    --border-color: #E5E7EB;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px; /* Standard for cards */
    --radius-lg: 24px; /* Buttons/Pills */
    
    --header-height: 80px;
    --category-bar-height: 60px;
    --tabs-height: 50px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
    background: var(--bg-gradient); /* Use gradient */
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-container {
    width: 80%;
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent; /* Changed to transparent to show body gradient */
    /* Removed box-shadow for seamless look */
}

/* --- Industry Tabs (Super Category Switcher) --- */
.industry-tabs-bar {
    height: 100%;
    background: transparent;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0; /* Remove padding as it's in header now */
    flex: 1; /* Take available space */
}

.industry-tab {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px; /* Smaller padding */
    min-width: auto; /* Remove fixed width */
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: #F9FAFB; /* Light background */
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.industry-tab i {
    font-size: 16px;
    margin-bottom: 0;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.industry-tab span {
    font-size: 14px;
    font-weight: 600;
}

.industry-tab:hover {
    background: #F3F4F6;
    color: var(--text-main);
}

.industry-tab.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.industry-tab.active i {
    transform: scale(1.0);
    color: #ffffff;
}

.industry-tab::after {
    display: none; 
}

/* --- Header --- */
.main-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: #ffffff;
    box-shadow: var(--shadow-md);
    z-index: 50;
    flex-shrink: 0;
    border-radius: 0 0 24px 24px; /* Rounded bottom corners only */
    margin: 0; /* Remove margin to stick to top */
    border-bottom: none;
    width: 100%;
}

.brand-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
    margin-right: 24px;
}

.brand-logo i {
    color: var(--primary-color);
    font-size: 28px;
}

/* Removed .header-search styles as it's moved */

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-left: 24px;
}

.nav-btn {
    text-decoration: none;
    background: #ffffff;
    color: var(--text-main);
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid var(--text-main);
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--text-main);
    color: #ffffff;
}

.mobile-menu-btn {
    display: none;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
}

/* --- Map Search Container --- */
.map-search-container {
    margin-bottom: 12px;
    width: 100%;
}

.map-search-container form {
    display: flex;
    align-items: center;
    height: 44px; /* Slightly smaller */
    background: #ffffff;
    border-radius: 12px;
    padding: 4px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.map-search-container form:focus-within {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.map-search-container i.fa-magnifying-glass {
    padding: 0 12px;
    color: var(--text-secondary);
    font-size: 16px;
}

.map-search-container input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-main);
    height: 100%;
}

.map-search-container input:focus {
    outline: none;
}

.map-search-container button {
    height: 100%;
    padding: 0 16px;
    border: none;
    background: var(--primary-color); /* Green button */
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.map-search-container button:hover {
    background: #1b5e20; /* Darker green */
}

/* --- Category bar --- */
.category-bar {
    height: auto;
    min-height: var(--category-bar-height);
    padding: 12px 32px; /* Increased padding */
    display: flex;
    align-items: center;
    justify-content: center; /* Center categories */
    gap: 12px;
    border-bottom: none; /* Removed border */
    background: transparent; /* Transparent to show gradient */
}

.categories-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-container::-webkit-scrollbar {
    display: none;
}

.category-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    border: 1px solid #E5E7EB;
    border-radius: 999px; /* Pill shape */
    transition: all 0.2s;
    background: white;
    min-width: auto; /* Reset min-width */
}

.category-pill:hover {
    border-color: var(--text-secondary);
    color: var(--text-color);
}

.category-pill.active {
    background: rgba(46, 125, 50, 0.1); /* Subtle background tint */
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Dynamic tint based on primary color would require JS or specific classes, 
   but for now we rely on the border/text color which is CSS variable driven */
.category-pill.active {
    background: transparent; /* Keep it clean */
    background-color: var(--bg-body);
}

.category-pill i {
    font-size: 14px;
    margin-bottom: 0; /* Reset margin */
}

.category-pill span {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.search-feedback {
    display: none;
}

/* --- Main layout --- */
.main-container {
    display: flex;
    flex: 1;
    /* Removed fixed height calc to let flexbox handle remaining space */
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: transparent; /* Transparent to show body gradient */
}

.listings-column {
    width: 50%; /* 50% width */
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 24px;
    background: transparent; /* Fully transparent to show body gradient */
    border-right: none; /* Remove border for cleaner look */
    /* Modern Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.listings-column::-webkit-scrollbar {
    width: 6px;
}

.listings-column::-webkit-scrollbar-track {
    background: transparent;
}

.listings-column::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 20px;
}

.listings-column::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

.map-column {
    flex: 1; /* Takes the remaining 50% */
    height: calc(100% - 36px); /* 100% - (16px top + 20px bottom) */
    min-height: 0;
    position: relative;
    background: transparent;
    margin: 16px 16px 20px 16px; /* 20px bottom margin */
    display: flex;
    flex-direction: column;
    gap: 12px; /* Space between map and footer */
}

.map-card {
    flex: 1;
    background: #f0f0f0; /* Lighter background */
    overflow: hidden;
    border-radius: 24px; /* Rounded corners for map container */
    box-shadow: var(--shadow-md); /* Add shadow to map */
    position: relative;
    display: flex;
    flex-direction: column;
}

#map {
    width: 100%;
    flex: 1;
    z-index: 1;
    background: #f0f0f0;
    /* border-radius handled by container overflow:hidden */
}

/* --- Footer --- */
.main-footer {
    height: 40px;
    background: var(--accent-color);
    border-top: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #ffffff;
    flex-shrink: 0;
    z-index: 10;
    border-radius: 12px; /* Separate box look */
    box-shadow: var(--shadow-sm);
}

.footer-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #ffffff;
}

/* --- Featured Listing Card (Legacy - Removed) --- */
/* Styles removed as featured listing is now a regular card with .featured class */

/* --- Listings --- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.listings-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.view-toggle {
    display: flex;
    background: #F2F4F5;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.view-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.view-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.5);
}

.view-btn.active {
    background: #ffffff;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.listings-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Columns */
    gap: 16px;
    padding-bottom: 40px;
}

/* List View Styles */
.listings-grid.list-view {
    grid-template-columns: 1fr; /* Single column */
    gap: 8px; /* Reduced gap */
}

.listings-grid.list-view .card {
    flex-direction: row;
    height: auto;
    min-height: 60px; /* Reduced from 75px (-20%) */
    align-items: stretch;
}

.listings-grid.list-view .card-image {
    width: 84px; /* Reduced from 105px (-20%) */
    height: auto;
    min-height: auto;
}

.listings-grid.list-view .card-content {
    flex-direction: row;
    align-items: center;
    padding: 8px 12px; /* Reduced padding */
    gap: 12px; /* Reduced gap */
}

.listings-grid.list-view .card-content > div:first-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Fix truncation */
}

.listings-grid.list-view .card-header {
    margin-bottom: 4px;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.listings-grid.list-view .card-title {
    margin-bottom: 0;
    font-size: 1.1rem;
}

.listings-grid.list-view .card-category {
    margin-bottom: 0;
}

.listings-grid.list-view .card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.listings-grid.list-view .card-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    min-width: 120px;
}

.listings-grid.list-view .card-location {
    font-size: 0.85rem;
}

.listings-grid.list-view .card-price {
    font-size: 1.1rem;
}

@media (max-width: 600px) {
    .listings-grid.list-view .card-image {
        width: 80px;
    }
    
    .listings-grid.list-view .card-content {
        padding: 12px;
        gap: 12px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .listings-grid.list-view .card-footer {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
    }
}

.empty-state {
    grid-column: 1 / -1;
    padding: 64px 24px;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--text-secondary);
}

/* --- High-End Card Design --- */
.card {
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smoother transition */
    display: flex;
    flex-direction: column; /* Vertical card for grid */
    background: rgba(255, 255, 255, 0.6); /* Glassmorphism card */
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4); /* Subtle border */
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); /* Very subtle base shadow */
    height: auto; /* Auto height */
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08); /* Modern soft shadow on hover */
    border-color: transparent;
}

.card-image {
    width: 100%; /* Full width image */
    height: 96px; /* Reduced from 120px (-20%) */
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.card-content {
    padding: 10px; /* Reduced from 12px */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    line-height: 1.3;
}

.card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

.card-rating i {
    color: #FFD700; /* Gold star */
    font-size: 12px;
}

.card-category {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    background: #F2F4F5;
    padding: 4px 8px;
    border-radius: 4px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    margin-bottom: 12px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.card-location {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-price {
    font-weight: 700;
    color: var(--text-main);
    font-size: 14px;
}

/* --- Detail view --- */
.detail-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
    overflow-y: auto;
    display: none;
}

.detail-view.active {
    display: block;
}

.close-detail-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-main);
    transition: transform 0.2s;
}

.close-detail-btn:hover {
    transform: scale(1.1);
}

.detail-header-image {
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
}

.detail-body {
    max-width: 1200px;
    margin: -60px auto 0; /* Overlap image */
    padding: 0 24px 40px;
    display: flex;
    gap: 40px;
    position: relative;
}

.detail-main-info {
    flex: 2;
    background: white;
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.detail-sidebar {
    flex: 1;
    margin-top: 60px; /* Align with content */
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 15px;
    margin-bottom: 32px;
    color: var(--text-secondary);
}

.detail-section {
    margin: 40px 0;
}

.detail-section h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.services-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.services-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    font-weight: 500;
}

.services-list li::before {
    content: '\f00c';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--primary-color);
}

.contact-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.btn-primary {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    margin-top: 16px;
}

.btn-primary:hover {
    background: #000000;
}

.full-width {
    width: 100%;
}

.mini-map {
    width: 100%;
    height: 240px;
    border-radius: var(--radius-md);
    background: #eee;
}

/* --- Map popups & markers --- */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    width: 280px !important;
}

.popup-card {
    display: flex;
    flex-direction: column;
}

.popup-image {
    height: 140px;
    background-size: cover;
    background-position: center;
}

.popup-info {
    padding: 16px;
}

.popup-info h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.popup-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background: var(--text-main);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.custom-marker {
    background: white;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.custom-marker:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

.custom-marker i {
    color: white;
    font-size: 18px;
}

.marker-solar { background: linear-gradient(135deg,#f59e0b,#f97316); }
.marker-heat-pumps { background: linear-gradient(135deg,#ef4444,#dc2626); }
.marker-ev-chargers { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.marker-hvac { background: linear-gradient(135deg,#10b981,#059669); }
.marker-audits { background: linear-gradient(135deg,#8b5cf6,#7c3aed); }
.marker-other { background: linear-gradient(135deg,#6b7280,#4b5563); }

/* --- Mobile Toggle --- */
.mobile-toggle {
    display: none; /* Hidden by default on desktop */
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .app-container {
        width: 100%;
    }
    
    .listings-column {
        width: 50%;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 16px;
        height: auto;
        flex-wrap: wrap;
        gap: 16px;
    }

    .brand-logo {
        font-size: 20px;
        margin-right: auto;
    }

    .header-search {
        order: 3;
        width: 100%;
        max-width: none;
    }

    .header-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
        margin-left: 16px;
    }

    .category-bar {
        padding: 0 16px;
    }

    .search-feedback {
        padding: 6px 16px;
    }

    .main-container {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }

    .listings-column {
        width: 100%;
        padding: 16px;
        padding-bottom: 80px;
    }

    .map-column {
        width: 100%;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        margin: 0;
        border-radius: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        background: white;
        z-index: 100;
    }

    .map-column.active {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: block;
        position: fixed;
        bottom: 24px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        box-shadow: var(--shadow-lg);
    }
    
    .mobile-toggle button {
        padding: 12px 24px;
        border-radius: 999px;
        font-size: 14px;
        font-weight: 700;
        background: var(--text-main);
        color: white;
        border: none;
        display: flex;
        align-items: center;
        gap: 8px;
        width: auto;
        box-shadow: var(--shadow-lg);
    }

    .detail-body {
        flex-direction: column;
        padding: 16px;
    }

    .detail-header-image {
        height: 260px;
    }
}

@media (max-width: 600px) {
    .main-footer {
        height: auto;
        padding: 12px 0;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .footer-links {
        gap: 16px;
    }
}