/* Market page */

.mkt-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mkt-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
    flex-shrink: 0;
}

.mkt-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mkt-header h2 { margin: 0; font-size: 1.25rem; font-weight: 600; }

.mkt-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.mkt-filters select, .mkt-filters input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    outline: none;
}

.mkt-filters input { width: 200px; }

/* Stats bar */
.mkt-stats {
    display: flex;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    flex-shrink: 0;
}

.mkt-stat-card {
    text-align: center;
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.mkt-stat-card.mkt-stat-good { border-color: #86efac; background: #f0fdf4; }
.mkt-stat-card.mkt-stat-opportunity { border-color: #fbbf24; background: #fffbeb; }

.mkt-stat-value { font-size: 1.3em; font-weight: 700; color: var(--text-primary); }
.mkt-stat-label { font-size: 0.7em; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }

/* Table */
.mkt-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.mkt-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.85em;
}

.mkt-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-main);
    z-index: 1;
}

.mkt-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.mkt-sortable { cursor: pointer; user-select: none; }
.mkt-sortable:hover { color: var(--accent); }
.mkt-sort-arrow { font-size: 0.7em; }

.mkt-row:hover { background: #f9fafb; }

/* Badges */
.mkt-badge {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 500;
    vertical-align: middle;
}

.mkt-badge-matched { background: #dcfce7; color: #166534; }
.mkt-badge-lead { background: #e0e7ff; color: #3730a3; }

.mkt-contact-cell { font-size: 0.8em; }
.mkt-contact-text { color: var(--accent); text-decoration: none; }
.mkt-contact-text:hover { text-decoration: underline; }
.mkt-contact-phone { color: var(--text-secondary); }
.mkt-gym-link { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.mkt-gym-link:hover { text-decoration: underline; }

/* Pagination */
/* View toggle tabs */
.mkt-view-toggle {
    display: flex;
    gap: 0;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
    flex-shrink: 0;
}

.mkt-tab {
    padding: 8px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.mkt-tab:hover { color: var(--text-primary); }

.mkt-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Map */
.mkt-map-container {
    flex: 1;
    overflow: hidden;
}

.mkt-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.mkt-marker { background: none; border: none; }

.mkt-popup {
    font-size: 0.85em;
    line-height: 1.5;
    min-width: 180px;
}

.mkt-popup strong {
    font-size: 1em;
}

/* Opportunity score badges */
.mkt-score {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85em;
}

.mkt-score-high { background: #dcfce7; color: #166534; }
.mkt-score-medium { background: #fef3c7; color: #92400e; }
.mkt-score-low { background: #f3f4f6; color: #6b7280; }

.mkt-score-wrap {
    position: relative;
    display: inline-block;
    cursor: help;
}

.mkt-score-tip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 400;
    white-space: pre;
    line-height: 1.6;
    z-index: 100;
    pointer-events: none;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mkt-score-wrap:hover .mkt-score-tip {
    display: block;
}

/* Chain cards */
.mkt-chain-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.mkt-chain-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mkt-chain-locations {
    padding-left: 8px;
}

.mkt-chain-loc {
    padding: 4px 0;
    font-size: 0.85em;
    color: var(--text-secondary);
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mkt-chain-loc:last-child { border-bottom: none; }

/* Chain parent/child rows */
.mkt-chain-parent { background: #f9fafb; font-weight: 500; }
.mkt-chain-parent:hover { background: #f3f4f6; }
.mkt-chain-child { background: #fff; }
.mkt-chain-child td:nth-child(2) { padding-left: 24px; }
.mkt-expand-btn { cursor: pointer; font-size: 0.7em; color: var(--text-secondary); }

.mkt-check-cell { width: 30px; text-align: center; }
.mkt-actions { display: flex; gap: 4px; }

.mkt-pagination {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    justify-content: center;
}
