/* ======================================= */
/* Coach Comparison Page                   */
/* Dense card grid + pill filters          */
/* ======================================= */

.cc-page {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1rem 1.25rem 6rem;
    min-height: calc(100vh - 120px);
}

/* --- Header --- */
.cc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.cc-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.cc-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 0.75rem;
}

.cc-search-wrap {
    position: relative;
}

.cc-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.cc-search {
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 220px;
    transition: border-color 0.2s, width 0.2s;
}

.cc-search:focus {
    outline: none;
    border-color: var(--accent-primary);
    width: 280px;
}

/* --- Filter Bars --- */
.cc-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.92));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    position: sticky;
    z-index: 50;
}

.cc-filter-bar--top {
    top: 64px;
    z-index: 60;
}

.cc-filter-bar--filters {
    top: 120px;
    z-index: 55;
    flex-wrap: wrap;
}

.cc-filter-section {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cc-filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* --- KPI Summary Row --- */
.cc-kpi-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.cc-kpi-row::-webkit-scrollbar { display: none; }

.cc-kpi {
    flex: 1;
    min-width: 100px;
    padding: 0.625rem 0.75rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    text-align: center;
}

.cc-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
}

.cc-kpi-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* --- Card Grid --- */
.cc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 10px;
}

/* --- Loading State --- */
.cc-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Coach Card --- */
.cc-card {
    background: var(--bg-card, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--card-accent, var(--border-color));
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.25s ease;
    position: relative;
    animation: cc-fadein 0.3s ease-out both;
    animation-delay: var(--cc-delay, 0ms);
}

.cc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.cc-card.cc-selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.cc-card.cc-hidden {
    display: none;
}

@keyframes cc-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card: Select checkbox */
.cc-card-select {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: transparent;
    transition: all 0.15s ease;
    z-index: 2;
}

.cc-card-select:hover {
    border-color: var(--accent-primary);
}

.cc-card.cc-selected .cc-card-select {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Card: Identity */
.cc-card-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cc-card-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.cc-card-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.cc-card-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.cc-card-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Card: Philosophy tags */
.cc-card-tags {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.cc-card-tag {
    font-size: 0.55rem;
    padding: 1px 5px;
    border-radius: 999px;
    border: 1px solid;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card: Metrics */
.cc-card-metrics {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cc-metric {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cc-metric-label {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 52px;
    flex-shrink: 0;
}

.cc-metric-bar-track {
    flex: 1;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.cc-metric-bar {
    height: 100%;
    border-radius: 2px;
    background: var(--accent-primary);
    transition: width 0.4s ease;
}

.cc-metric-bar--negative {
    background: #ef4444;
}

.cc-metric-bar--warning {
    background: #f59e0b;
}

.cc-metric-value {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    min-width: 32px;
    text-align: right;
}

/* --- Shortlist Tray --- */
.cc-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    animation: cc-tray-slide 0.3s ease;
}

@keyframes cc-tray-slide {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.cc-tray-coaches {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
}

.cc-tray-coaches::-webkit-scrollbar { display: none; }

.cc-tray-coach {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    background: var(--bg-secondary);
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cc-tray-coach img,
.cc-tray-coach .cc-tray-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.cc-tray-avatar {
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: var(--text-muted);
}

.cc-tray-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.cc-tray-remove {
    font-size: 0.6rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}

.cc-tray-remove:hover {
    color: #ef4444;
}

.cc-tray-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.cc-tray-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cc-tray-btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cc-tray-btn--compare {
    background: var(--accent-primary);
    color: white;
}

.cc-tray-btn--compare:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cc-tray-btn--compare:not(:disabled):hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.cc-tray-btn--clear {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.cc-tray-btn--clear:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* --- Compare Modal --- */
.cc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cc-modal {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.cc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.cc-modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.cc-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
}

.cc-modal-close:hover { color: var(--text-primary); }

.cc-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

/* Modal: Comparison table */
.cc-compare-table {
    width: 100%;
    border-collapse: collapse;
}

.cc-compare-table th {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.cc-compare-table th:first-child {
    text-align: left;
    width: 100px;
}

.cc-compare-table td {
    padding: 0.4rem 0.75rem;
    text-align: center;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid var(--border-color);
}

.cc-compare-table td:first-child {
    text-align: left;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.cc-compare-best {
    color: var(--accent-primary);
    font-weight: 700;
}

/* --- Dark Mode --- */
[data-theme="dark"] .cc-filter-bar {
    background: rgba(30, 30, 30, 0.92);
}

[data-theme="dark"] .cc-kpi {
    background: rgba(30, 30, 30, 0.85);
}

[data-theme="dark"] .cc-card {
    background: rgba(30, 30, 30, 0.7);
}

[data-theme="dark"] .cc-tray {
    background: rgba(30, 30, 30, 0.95);
}

[data-theme="dark"] .cc-modal {
    background: var(--bg-primary, #1a1a2e);
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .cc-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

@media (max-width: 768px) {
    .cc-page {
        padding: 0.75rem 0.75rem 6rem;
    }

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

    .cc-search { width: 100%; }
    .cc-search:focus { width: 100%; }

    .cc-filter-bar--filters {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .cc-filter-divider { display: none; }

    .cc-grid {
        grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
        gap: 8px;
    }

    .cc-kpi-row { gap: 0.5rem; }
    .cc-kpi { min-width: 80px; padding: 0.5rem; }
    .cc-kpi-value { font-size: 1rem; }
}

@media (max-width: 480px) {
    .cc-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .cc-card { padding: 8px 10px; }
    .cc-card-name { font-size: 0.75rem; max-width: 90px; }
    .cc-card-avatar, .cc-card-avatar-placeholder { width: 28px; height: 28px; }
    .cc-metric-label { width: 40px; font-size: 0.55rem; }
    .cc-metric-value { font-size: 0.65rem; min-width: 28px; }

    .cc-tray {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }
}
