/* Market Insights */
.mld-v3-market-insights {
    margin-bottom: 2rem;
}

.mld-v3-insight-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.mld-v3-insight-card {
    background: var(--bmn-card);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--bmn-border);
}

.insight-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bmn-text);
    margin-bottom: 0.5rem;
}

.insight-label {
    font-size: 0.875rem;
    color: var(--bmn-text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Timeline Styles */
.mld-v3-timeline {
    position: relative;
    padding-left: 40px;
}

.mld-v3-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bmn-card);
}

.mld-v3-timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -25px;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bmn-action);
    color: var(--bmn-text-inverse);
    font-size: 14px;
    box-shadow: var(--bmn-shadow-sm);
}

.timeline-content {
    background: var(--bmn-raised);
    border: 1px solid var(--bmn-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--bmn-shadow-sm);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.timeline-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.timeline-date {
    font-size: 0.875rem;
    color: var(--bmn-text-3);
}

.timeline-price {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.price-change {
    margin-left: 1rem;
    font-size: 1rem;
}

.price-change.negative {
    color: var(--bmn-error);
}

.price-change.positive {
    color: var(--bmn-success);
}

.price-per-sqft {
    display: block;
    font-size: 0.875rem;
    color: var(--bmn-text-3);
    font-weight: normal;
    margin-top: 0.25rem;
}

.timeline-details {
    color: var(--bmn-text-3);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.timeline-agent-info {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--bmn-text-2);
}

.timeline-agent-info span {
    display: inline-block;
    margin-right: 1rem;
}

.timeline-market-time {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--bmn-text-3);
    font-style: italic;
}

/* Table Styles */
.mld-v3-history-table-section {
    margin-top: 2rem;
}

.mld-v3-collapse-toggle {
    background: none;
    border: none;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.mld-v3-collapsible {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mld-v3-collapsible.collapsed {
    max-height: 0;
}

.mld-v3-history-table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: collapse;
}

.mld-v3-history-table th,
.mld-v3-history-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--bmn-border);
}

.mld-v3-history-table th {
    background: var(--bmn-card);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.details-cell {
    font-size: 0.875rem;
    color: var(--bmn-text-3);
}

/* View Listing Links */
.timeline-view-link {
    margin-top: 0.5rem;
}

.view-listing-link {
    display: inline-block;
    background: var(--bmn-action);
    font-size: 0.875rem;
    color: var(--bmn-text-inverse);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--bmn-action);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.view-listing-link:hover {
    background-color: var(--bmn-action);
    color: var(--bmn-text-inverse);
    text-decoration: none;
}

/* Transaction Grouping */
.transaction-header {
    margin: 2rem 0 1rem 0;
    padding: 1rem;
    background: var(--bmn-card);
    border-left: 4px solid var(--bmn-border);
    border-radius: 4px;
}

.transaction-header h5 {
    margin: 0 0 0.5rem 0;
    color: var(--bmn-text);
    font-size: 1.125rem;
}

.transaction-summary {
    font-size: 0.875rem;
    color: var(--bmn-text-3);
}

.mld-v3-timeline-item.previous-transaction {
    margin-left: 20px;
}

.mld-v3-timeline-item.current-active .timeline-content {
    background-color: var(--bmn-info-tint);
    border-color: var(--bmn-border-strong);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mld-v3-timeline {
        padding-left: 30px;
    }

    .timeline-marker {
        left: -15px;
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .mld-v3-timeline::before {
        left: 12px;
    }

    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .mld-v3-history-table {
        font-size: 0.875rem;
    }

    .mld-v3-history-table th,
    .mld-v3-history-table td {
        padding: 0.5rem;
    }
}

/* Visual cohesion system v1 (family 4): the collapse toggle sits on the card surface with ordinary text; the
   listing link is an action fill with the inverse label in every state. */
.mld-v3-collapse-toggle {
    background: var(--bmn-card);
    color: var(--bmn-text);
    border: 1px solid var(--bmn-border);
}

.mld-v3-collapse-toggle:hover {
    background: var(--bmn-raised);
    border-color: var(--bmn-border-strong);
}

.timeline-view-link a,
.timeline-view-link a:hover,
.view-listing-link,
.view-listing-link:hover {
    color: var(--bmn-text-inverse);
}
