/* ==========================================================================
   MaxRepTracker – User Benchmark Page
   Page-level layout, controls, grid, and states.
   Shared component styles come from:
     - form-components.css  → .mrt-exercise-type-toggle
     - filter-pills.css     → .mrt-filter-pill
     - training-zone.css    → .mrt-benchmark-card
   ========================================================================== */

/* ── Page Wrapper ── */
.mrt-benchmark-page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px 12px 100px;
}

/* ── Controls Header ── */
.mrt-benchmark-controls {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--mrt-bg, #ffffff);
    padding: 12px 0 8px;
    margin-bottom: 16px;
    transition: background 0.3s ease;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-controls {
    background: var(--mrt-bg-dark, #0f0f0f);
}

/* ── Toggle Row ──
   Reuses .mrt-exercise-type-toggle from form-components.css.
   Only page-level positioning + slider ID bindings here. */
.mrt-benchmark-toggle-row {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.mrt-benchmark-toggle-row .mrt-exercise-type-toggle {
    width: 100%;
    margin-bottom: 0; /* Override form-components default */
}

/* Slider position bound to benchmark-specific radio IDs */
#benchmark_type_weighted:checked ~ .mrt-toggle-slider {
    transform: translateX(0);
}

#benchmark_type_calisthenics:checked ~ .mrt-toggle-slider {
    transform: translateX(100%);
}

/* Toggle count badges */
.mrt-toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    line-height: 1;
    vertical-align: middle;
}

input[type="radio"]:checked + .mrt-toggle-option .mrt-toggle-count {
    background: rgba(255, 255, 255, 0.25);
}

html.maxreptracker-dark-mode-enabled .mrt-toggle-count {
    background: rgba(255, 255, 255, 0.12);
}

html.maxreptracker-dark-mode-enabled
    input[type="radio"]:checked
    + .mrt-toggle-option
    .mrt-toggle-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Search Box ──
   Similar pattern to result-form-search.css (#mrt-exercise-search-input)
   but always-visible (not expandable like filters-controls.css). */
.mrt-benchmark-search-wrapper {
    margin-bottom: 10px;
}

.mrt-benchmark-search-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.mrt-benchmark-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mrt-text-secondary, #999);
    pointer-events: none;
    transition: color 0.2s ease;
}

.mrt-benchmark-search-box {
    width: 100%;
    padding: 12px 42px 12px 48px !important;
    border: 1px solid var(--mrt-border-input, #e2e8f0) !important;
    border-radius: 18px !important;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--mrt-bg-input, #f8f9fa);
    color: var(--mrt-text-primary, inherit);
    outline: none;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        background 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.mrt-benchmark-search-box:focus {
    border-color: var(--mrt-primary, #6c63ff);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
    outline: none;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-search-box {
    background: var(--mrt-bg-input, rgba(255, 255, 255, 0.06));
    border-color: var(--mrt-border-input, rgba(255, 255, 255, 0.1));
    color: var(--mrt-text-primary, #e0e0e0);
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-search-box:focus {
    border-color: var(--mrt-primary, #6c63ff);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.mrt-benchmark-search-box::placeholder {
    color: var(--mrt-text-muted, #aaa);
    font-weight: 400;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-search-box::placeholder {
    color: var(--mrt-text-muted, #555);
}

.mrt-benchmark-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: var(--mrt-text-secondary, #666);
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mrt-benchmark-search-clear:hover {
    background: rgba(0, 0, 0, 0.14);
    color: var(--mrt-text-primary, #333);
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-search-clear {
    background: rgba(255, 255, 255, 0.1);
    color: #999;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-search-clear:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ccc;
}

/* ── Filter Pills Container ──
   Pill styles come from filter-pills.css (.mrt-filter-pill).
   We only define the scrollable container layout here. */
.mrt-benchmark-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.mrt-benchmark-filters::-webkit-scrollbar {
    display: none;
}

/* ── Cards Grid ── */
.mrt-benchmark-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.mrt-benchmark-card-wrapper {
    animation: mrtBenchmarkFadeIn 0.3s ease forwards;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mrt-benchmark-card-wrapper:active {
    transform: scale(0.98);
}

/* Cards should fill grid cell */
.mrt-benchmark-card-wrapper .mrt-benchmark-card {
    height: 100%;
}

@keyframes mrtBenchmarkFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Desktop 2-column grid */
@media (min-width: 640px) {
    .mrt-benchmark-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Empty State ── */
.mrt-benchmark-empty {
    display: flex;
    justify-content: center;
    padding: 48px 24px;
}

.mrt-benchmark-empty-content {
    text-align: center;
    color: #999;
}

.mrt-benchmark-empty-content svg {
    color: #ccc;
    margin-bottom: 16px;
}

.mrt-benchmark-empty-content h6 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #666;
    margin: 0 0 6px;
}

.mrt-benchmark-empty-content p {
    font-size: 0.88rem;
    margin: 0;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-empty-content {
    color: #666;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-empty-content svg {
    color: #444;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-empty-content h6 {
    color: #888;
}

/* ── No Data State ── */
.mrt-benchmark-no-data {
    display: flex;
    justify-content: center;
    padding: 60px 24px;
}

.mrt-benchmark-no-data-content {
    text-align: center;
    max-width: 320px;
}

.mrt-benchmark-no-data-content h6 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: #444;
}

.mrt-benchmark-no-data-content p {
    font-size: 0.9rem;
    margin: 0 0 20px;
    color: #888;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-no-data-content h6 {
    color: #ccc;
}

html.maxreptracker-dark-mode-enabled .mrt-benchmark-no-data-content p {
    color: #777;
}

.mrt-benchmark-cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    border-radius: 14px;
    background: var(--mrt-primary, #6c63ff);
    color: #fff !important;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(108, 99, 255, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.mrt-benchmark-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.mrt-benchmark-cta-btn:active {
    transform: scale(0.97);
}
