/* BricksNexus Marketplace - Layout & Components */

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

:root {
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --main-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #3b82f6;
    --accent-light: #7dd3fc;
    --success: #22c55e;
    --border: #e2e8f0;
    --sidebar-width: 240px;
    --right-width: 300px;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--main-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.app-shell {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ========== Top Bar ========== */
.top-bar {
    height: 56px;
    background: #0f172a;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.4);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.top-bar-left img {
    height: 28px;
    width: auto;
    display: block;
}

.top-bar-left span {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-button {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: transparent;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.icon-button:hover {
    background: rgba(15, 23, 42, 0.8);
}

/* ========== Left Sidebar - Filters ========== */
.sidebar-left {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.sidebar-left .logo {
    padding: 0 1.25rem 1.25rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-left .logo a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.sidebar-left .logo img {
    height: 32px;
    width: auto;
    display: block;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    margin: 0 0.75rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.filter-btn:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.filter-btn.active {
    background: var(--sidebar-active);
    color: #fff;
}

.filter-btn .icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.filter-btn .icon svg {
    width: 100%;
    height: 100%;
    opacity: 0.9;
}

.filter-btn.active .icon svg {
    opacity: 1;
}

/* ========== Central Area - Feed ========== */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.25rem;
}

.view-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.375rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.view-toggle button.active {
    background: var(--accent);
    color: #fff;
}

.view-toggle button:not(.active):hover {
    background: var(--main-bg);
    color: var(--text-primary);
}

.utility-btns {
    display: flex;
    gap: 0.5rem;
}

.utility-btns button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.utility-btns button:hover {
    background: var(--main-bg);
    border-color: #cbd5e1;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.active-filters .pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

/* Feed */
.feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
}

.feed-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-type {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.08);
    border-bottom: 1px solid var(--border);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--main-bg);
}

.card-body {
    padding: 1rem 1.25rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.badge-verified {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-sponsored {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.rating {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #eab308;
}

.card-details {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-actions button {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.card-actions button:hover {
    background: var(--main-bg);
    border-color: #cbd5e1;
}

.card-actions button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.card-actions button.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Open to Work / Service card (no image variant) */
.feed-card.compact .card-body {
    padding: 1.25rem;
}

.feed-card.compact .card-type {
    border-bottom: none;
}

/* Map view */
.map-view {
    display: none;
    margin-top: 0.5rem;
}

.map-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.map-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.map-card-header strong {
    color: var(--text-primary);
}

.map-legend {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.map-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
}

.map-dot.alt {
    background: #f97316;
}

.map-canvas {
    height: 360px;
    background: linear-gradient(135deg, #dbeafe, #e5e7eb);
    position: relative;
}

.map-canvas iframe {
    border: 0;
    width: 100%;
    height: 100%;
}

.map-pin {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.5);
}

.map-pin.secondary {
    background: #f97316;
    box-shadow: 0 6px 12px rgba(248, 113, 113, 0.4);
}

.map-pin.label {
    padding: 0 0.6rem;
    border-radius: 999px;
    height: 26px;
    font-size: 0.75rem;
}

.map-pin-1 {
    top: 26%;
    left: 32%;
}

.map-pin-2 {
    top: 48%;
    left: 60%;
}

.map-pin-3 {
    bottom: 18%;
    left: 42%;
}

.map-pin-label {
    bottom: 20%;
    right: 10%;
}

.map-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.map-toolbar button {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
}

.map-toolbar button:hover {
    background: var(--main-bg);
}

/* Toggle states */
.main-content.map-mode .feed {
    display: none;
}

.main-content.map-mode .map-view {
    display: block;
}

/* ========== Right Sidebar - Industry Intelligence ========== */
.sidebar-right {
    width: var(--right-width);
    min-width: var(--right-width);
    background: var(--sidebar-bg);
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar-right h2 {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.intel-block {
    margin-bottom: 1.5rem;
}

.intel-block:last-child {
    margin-bottom: 0;
}

.intel-block h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.75rem;
}

.intel-list {
    list-style: none;
}

.intel-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.intel-list li:last-child {
    border-bottom: none;
}

.trend-up {
    color: #22c55e;
    font-weight: 500;
}

.trend-down {
    color: #ef4444;
    font-weight: 500;
}

.news-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.news-item:last-child {
    border-bottom: none;
}

.news-item a {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

.news-item a:hover {
    color: var(--accent-light);
}

.news-item .date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

.events-list .news-item {
    padding: 0.6rem 0;
}

/* Placeholder when no image */
.card-image-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar-left {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 1rem;
        gap: 0.5rem;
    }

    .sidebar-left .logo {
        width: 100%;
        text-align: center;
        margin-bottom: 0;
        padding-bottom: 0.75rem;
    }

    .filter-btn {
        margin: 0;
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }

    .main-content {
        padding: 1rem;
    }
}
