/* ============ Timer Stats Card ============ */

.mrt-timer-stats-card {
    padding: 20px;
    background: #ffffff;
    border: none;
    border-radius: 18px;
    width: 100%;
    box-sizing: border-box;
}

.mrt-timer-stats-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Slider knob movement for the timer view toggle (core's rules target its own IDs) */

#mrt_timer_view_recent:checked ~ .mrt-toggle-slider {
    transform: translateX(0);
}

#mrt_timer_view_overview:checked ~ .mrt-toggle-slider {
    transform: translateX(100%);
}

/* ============ Recent/Overview toggle (self-contained copy of core's .mrt-view-toggle) ============ */

.mrt-exercise-type-toggle.mrt-timer-view-toggle {
    position: relative;
    display: inline-flex;
    background: var(--mrt-bg-tertiary, #edf2f7);
    border-radius: 18px;
    padding: 3px;
    border: 1px solid var(--mrt-border-light, #cbd5e0);
    width: 100%;
    height: 44px;
    align-items: center;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    margin-bottom: 12px;
}

.mrt-timer-view-toggle input[type="radio"] {
    display: none;
}

.mrt-timer-view-toggle .mrt-toggle-option {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: var(--mrt-transition-smooth, all 0.4s ease);
    font-weight: var(--mrt-font-weight-bold, 700);
    font-size: 12px;
    color: #64748b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
}

.mrt-timer-view-toggle input[type="radio"]:checked + label {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mrt-timer-view-toggle .mrt-toggle-slider {
    position: absolute;
    height: calc(100% - 6px);
    width: calc(50% - 3px);
    border-radius: 15px;
    transition: var(
        --mrt-transition-bounce,
        all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    );
    background: linear-gradient(
        135deg,
        var(--mrt-primary, #4f33ff) 0%,
        var(--mrt-primary-hover, #a855f7) 100%
    );
    box-shadow: none;
    z-index: 1;
    left: 3px;
}

.mrt-timer-view-toggle .mrt-toggle-option:active {
    transform: scale(0.97);
}

/* ============ View containers ============ */

.mrt-timer-view-overview[hidden] {
    display: none;
}

.mrt-timer-overview-grid[hidden] {
    display: none;
}

.mrt-timer-overview-empty[hidden],
.mrt-timer-overview-unavailable[hidden] {
    display: none;
}

/* ============ Overview: range filter pills ============ */

.mrt-timer-range-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    cursor: grab;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    margin-bottom: 14px;
}

.mrt-timer-range-filters::-webkit-scrollbar {
    display: none;
}

.mrt-timer-range-btn {
    flex: 0 0 auto;
    padding: 8px 15px;
    border: 1px solid #cbd5e0;
    background: #edf2f7;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: #4a5568;
    font-family: inherit;
}

.mrt-timer-range-btn:hover {
    background: var(--mrt-primary, #4f33ff);
    color: #ffffff;
    border-color: var(--mrt-primary, #4f33ff);
}

.mrt-timer-range-btn.active {
    background: var(--mrt-primary, #4f33ff);
    color: #ffffff;
    border-color: var(--mrt-primary, #4f33ff);
}

/* ============ Overview: chart grid ============ */

.mrt-timer-overview-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.mrt-timer-overview-card {
    background: #ffffff;
    border: none;
    border-radius: 18px;
    padding: 16px 16px 20px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mrt-timer-overview-card-title {
    margin: 0 0 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.mrt-timer-overview-chart-wrap {
    position: relative;
    width: 100%;
    height: 230px;
}

/* Counter-rule: survives the Android app's injected div[class*="chart"] height:auto !important */
.mrt-timer-stats-card .mrt-timer-overview-chart-wrap {
    height: 230px !important;
    min-height: 230px !important;
}

.mrt-timer-overview-card canvas {
    width: 100% !important;
    height: 100% !important;
}

.mrt-timer-overview-empty,
.mrt-timer-overview-unavailable {
    text-align: center;
    padding: 24px 12px;
    color: var(--mrt-text-secondary, #718096);
    font-size: 0.85rem;
    background: var(--mrt-bg-secondary, #f7fafc);
    border-radius: 12px;
}

.mrt-timer-recent-empty {
    text-align: center;
    padding: 14px 8px;
    color: var(--mrt-text-secondary, #718096);
    font-size: 0.8125rem;
}

.mrt-timer-stats-header svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #0082fc;
}

.mrt-timer-stats-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.mrt-timer-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: var(--mrt-bg-secondary, #f7fafc);
    border-radius: 12px;
}

.mrt-timer-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mrt-endurance, #ef44d2);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mrt-timer-stat-completed {
    color: var(--mrt-strength, #10b981);
}

.mrt-timer-stat-partial {
    color: var(--mrt-primary, #4f33ff);
}

.mrt-timer-stat-sep {
    font-weight: 400;
    color: var(--mrt-text-secondary, #718096);
    margin: 0 2px;
}

.mrt-timer-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--mrt-text-secondary, #718096);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mrt-timer-stats-most {
    font-size: 0.8125rem;
    color: var(--mrt-text-secondary, #718096);
    text-align: center;
    margin-bottom: 16px;
    padding: 6px 12px;
    background: var(--mrt-bg-secondary, #f7fafc);
    border-radius: 8px;
}

.mrt-timer-stats-recent h4 {
    margin: 0 0 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--mrt-text-primary, #2d3748);
}

.mrt-timer-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.8125rem;
    color: var(--mrt-text-primary, #2d3748);
    border-bottom: 1px solid var(--mrt-border-light, #e2e8f0);
}

.mrt-timer-stats-row:last-child {
    border-bottom: none;
}

.mrt-timer-stats-date {
    flex-shrink: 0;
    color: var(--mrt-text-secondary, #718096);
    font-weight: 500;
    min-width: 48px;
}

.mrt-timer-stats-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mrt-timer-stats-detail {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--mrt-text-secondary, #718096);
}

.mrt-timer-stats-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--mrt-text-secondary, #718096);
    font-size: 0.875rem;
}

/* ============ Mobile ============ */

@media (max-width: 480px) {
    .mrt-timer-stats-card {
        padding: 16px 12px;
    }

    .mrt-timer-stats-grid {
        gap: 10px;
    }

    .mrt-timer-stat {
        padding: 10px 6px;
    }

    .mrt-timer-stats-card .mrt-timer-stat-value {
        font-size: 1.125rem;
    }

    .mrt-timer-stats-card .mrt-timer-stat-label {
        font-size: 0.65rem;
        letter-spacing: 0.02em;
    }
}

/* ============ Dark Mode ============ */

html.maxreptracker-dark-mode-enabled .mrt-timer-stat {
    background: #1e293b;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-stat-value {
    color: var(--mrt-endurance, #ef44d2);
}

html.maxreptracker-dark-mode-enabled .mrt-timer-stat-label,
html.maxreptracker-dark-mode-enabled .mrt-timer-stats-date,
html.maxreptracker-dark-mode-enabled .mrt-timer-stats-detail,
html.maxreptracker-dark-mode-enabled .mrt-timer-stats-empty {
    color: #94a3b8;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-stats-recent h4 {
    color: #e2e8f0;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-stats-row {
    color: #e2e8f0;
    border-bottom-color: #334155;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-stats-most {
    background: #1e293b;
    color: #94a3b8;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-overview-card {
    background: #1e293b;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-overview-card-title {
    color: #94a3b8;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-range-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--maxreptracker-dark-border) !important;
    color: var(--maxreptracker-dark-text) !important;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-range-btn:hover,
html.maxreptracker-dark-mode-enabled .mrt-timer-range-btn.active {
    background: #4f33ff !important;
    border-color: #4f33ff !important;
    color: white !important;
}

html.maxreptracker-dark-mode-enabled .mrt-timer-overview-empty,
html.maxreptracker-dark-mode-enabled .mrt-timer-overview-unavailable {
    background: #1e293b;
    color: #94a3b8;
}
