:root {
    /* MRT Color Palette */
    --mrt-primary: #4f33ff;
    --mrt-primary-hover: #3b1fe0;
    --mrt-secondary: #6c757d;
    --mrt-success: #28a745;
    --mrt-danger: #dc3545;
    --mrt-bg: #ffffff;
    --mrt-text: #333333;

    /* Extended Color System */
    --mrt-text-primary: #2d3748;
    --mrt-text-secondary: #718096;
    --mrt-text-muted: #a0aec0;
    --mrt-border: #cbd5e0;
    --mrt-border-light: #e2e8f0;
    --mrt-bg-secondary: #f7fafc;
    --mrt-bg-tertiary: #edf2f7;
    --mrt-bg-warm: #faf9f6;

    /* Status Colors */
    --mrt-strength: #10b981;
    --mrt-hypertrophy: #3b82f6;
    --mrt-endurance: #ef44d2;
    --mrt-reps-color: #3182ce;
    --mrt-weight-color: #dd6b20;

    /* Shadows & Radii */
    --mrt-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --mrt-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --mrt-shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
    --mrt-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --mrt-shadow-primary: 0 4px 12px rgba(79, 51, 255, 0.3);
    --mrt-radius: 18px;
    --mrt-radius-sm: 8px;
    --mrt-radius-full: 100px;

    /* Spacing System */
    --mrt-spacing-xs: 4px;
    --mrt-spacing-sm: 8px;
    --mrt-spacing-md: 12px;
    --mrt-spacing-lg: 16px;
    --mrt-spacing-xl: 20px;
    --mrt-spacing-2xl: 25px;

    /* Typography */
    --mrt-font-size-xs: 0.75rem;
    --mrt-font-size-sm: 0.875rem;
    --mrt-font-size-base: 1rem;
    --mrt-font-size-lg: 1.1rem;
    --mrt-font-weight-normal: 400;
    --mrt-font-weight-medium: 500;
    --mrt-font-weight-semibold: 600;
    --mrt-font-weight-bold: 700;
    --mrt-line-height-tight: 1.2;

    /* Fluid Typography (clamp for responsive scaling) */
    --mrt-fluid-sm: clamp(0.8rem, 0.9vw + 0.6rem, 0.875rem);
    --mrt-fluid-base: clamp(0.9rem, 1vw + 0.7rem, 1rem);
    --mrt-fluid-lg: clamp(1rem, 1.2vw + 0.8rem, 1.25rem);

    /* Transitions & Animations */
    --mrt-transition: all 0.3s ease;
    --mrt-transition-fast: all 0.2s ease;
    --mrt-transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --mrt-transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --mrt-transform-lift: translateY(-1px);
    --mrt-transform-lift-lg: translateY(-2px);
    --mrt-scale-active: scale(0.96);
    --mrt-gpu-accelerated: translateZ(0);
    --mrt-will-change-transform: will-change transform;

    /* Dark Mode Variables */
    --mrt-dark-bg: rgba(15, 23, 42, 0.4);
    --mrt-dark-border: rgba(255, 255, 255, 0.1);
    --mrt-dark-text: #cbd5e0;
}

/* Global MRT Tap Highlight Reset */
[class^="mrt-"],
[class*=" mrt-"] {
    -webkit-tap-highlight-color: transparent;
}

/* GPU Acceleration for Interactive Elements */
.mrt-existing-exercise-btn,
.mrt-exercise-selection-btn,
.mrt-musclegroup-btn,
.mrt-save-btn,
.mrt-cancel-btn,
.mrt-secondary-btn,
.mrt-toggle-option,
.mrt-colored-category-btn {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Standard Loading Spinner */
.mrt-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--mrt-primary);
    animation: mrt-spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes mrt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Button Loading State */
.mrt-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.mrt-btn-loading .mrt-button-text {
    visibility: hidden;
}

.mrt-btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: mrt-spin 0.6s linear infinite;
}

/* ====================================
   SKELETON LOADING STATES
   ==================================== */

.mrt-skeleton-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: mrt-skeleton-shimmer 1.5s infinite;
    border-radius: var(--mrt-radius);
    z-index: 5;
}

@keyframes mrt-skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Shimmer Loading Effect (Alternative Animation) */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Dark Mode Skeleton Support */
html.maxreptracker-dark-mode-enabled .mrt-skeleton-placeholder,
body.dark-mode .mrt-skeleton-placeholder {
    background: #2d2d2d;
    background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
    background-size: 200% 100%;
}

/* Helper Class for Copy to Clipboard */
.mrt-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    font-size: 18px;
    color: var(--mrt-secondary);
    transition: var(--mrt-transition);
}

.mrt-copy-btn:hover {
    color: var(--mrt-primary);
}

/* Home Page Vertical Centering Fix - Improves layout on tall mobile/tablet screens */
.home .site-main .entry-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Ensure it takes up enough height to center, accounting for header and footer */
    min-height: calc(100vh - 160px);
}

/* On the home page, we want the content to be centered, so we hide the fixed spacer */
.home .entry-content .wp-block-spacer {
    display: none;
}

@media (max-width: 768px) {
    .home .site-main .entry-content {
        min-height: calc(
            100vh - 120px
        ); /* Adjust for smaller mobile header/footer */
    }
}

/* ====================================
   HISTORY TOOLBAR (Modern Mobile Style)
   ==================================== */

.mrt-history-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #ffffff;
    border-bottom: 1px solid #edf2f7;
    margin-bottom: 15px;
    border-radius: var(--mrt-radius, 18px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    gap: 10px;
}

.mrt-toolbar-left,
.mrt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mrt-toolbar-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

.mrt-toolbar-btn:hover {
    background-color: #edf2f7;
    color: var(--mrt-primary, #4299e1);
    transform: translateY(-1px);
}

.mrt-toolbar-btn:active {
    transform: scale(0.95);
    background-color: #e2e8f0;
}

.mrt-toolbar-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

/* Date Search Wrapper & Popover */
.mrt-toolbar-date-search-wrapper {
    position: relative;
}

.mrt-date-filter-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    width: auto;
    white-space: nowrap;
}

.mrt-date-filter-popover.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mrt-date-input,
.mrt-date-select {
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9rem;
    color: #2d3748;
    outline: none;
    background: #f7fafc;
    font-family: inherit;
    width: auto;
}

.mrt-date-input:focus,
.mrt-date-select:focus {
    border-color: var(--mrt-primary, #4299e1);
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.2);
}

#mrt-history-date-clear {
    background: #edf2f7;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    transition: all 0.2s;
    padding: 0;
}

#mrt-history-date-clear:hover {
    background: #fed7d7;
    color: #e53e3e;
}

/* Sorting Active State */
.mrt-toolbar-btn.sorted-asc {
    color: var(--mrt-primary, #4299e1);
    background-color: rgba(66, 153, 225, 0.1);
}
.mrt-toolbar-btn.sorted-asc svg {
    transform: rotate(180deg);
}

/* Dark Mode Adjustments - Support both html class and body class per coding standards */
html.maxreptracker-dark-mode-enabled .mrt-history-toolbar,
body.dark-mode .mrt-history-toolbar {
    background: var(--maxreptracker-dark-bg, #1a1a1a) !important;
    border-bottom-color: var(--maxreptracker-dark-border, #333333) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

html.maxreptracker-dark-mode-enabled .mrt-toolbar-btn,
body.dark-mode .mrt-toolbar-btn {
    color: var(--maxreptracker-dark-text, #ffffff) !important;
}

html.maxreptracker-dark-mode-enabled .mrt-toolbar-btn:hover,
body.dark-mode .mrt-toolbar-btn:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #63b3ed !important;
}

html.maxreptracker-dark-mode-enabled .mrt-date-filter-popover,
body.dark-mode .mrt-date-filter-popover {
    background: var(--maxreptracker-dark-bg, #1a1a1a) !important;
    border-color: var(--maxreptracker-dark-border, #333333) !important;
}

html.maxreptracker-dark-mode-enabled .mrt-date-input,
html.maxreptracker-dark-mode-enabled .mrt-date-select,
body.dark-mode .mrt-date-input,
body.dark-mode .mrt-date-select {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: var(--maxreptracker-dark-text, #ffffff) !important;
    color-scheme: dark;
}

html.maxreptracker-dark-mode-enabled .mrt-date-select option,
body.dark-mode .mrt-date-select option {
    background-color: var(--maxreptracker-dark-bg, #1a1a1a);
    color: var(--maxreptracker-dark-text, #ffffff);
}

html.maxreptracker-dark-mode-enabled #mrt-history-date-clear,
body.dark-mode #mrt-history-date-clear {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #cbd5e0 !important;
}

html.maxreptracker-dark-mode-enabled #mrt-history-date-clear:hover,
body.dark-mode #mrt-history-date-clear:hover {
    background: #9b2c2c !important;
    color: #fc8181 !important;
}

/* Mobile Tweaks */
@media (max-width: 480px) {
    .mrt-history-toolbar {
        padding: 8px 12px;
    }
    .mrt-toolbar-btn {
        padding: 6px;
    }
    .mrt-toolbar-left,
    .mrt-toolbar-right {
        gap: 8px;
    }
}
/* ====================================
   EXERCISE NAME DISPLAY (Ported from Result Form)
   ==================================== */

.mrt-exercise-name-display {
    background: #ffe60003;
    font-family: "Merriweather", "Georgia", serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    border: none;
    padding: 25px 20px;
    border-radius: var(--mrt-radius, 18px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    margin-bottom: 20px;
    margin-top: 15px;
    transition: all 0.3s ease;
    border-left: 4px solid #a0aec0 !important;
    border-right: 4px solid #a0aec0 !important;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Phase-specific border colors for display div */
.mrt-exercise-name-display.phase-strength {
    border-left: 4px solid var(--mrt-strength, #10b981) !important;
    border-right: 4px solid var(--mrt-strength, #10b981) !important;
}

.mrt-exercise-name-display.phase-hypertrophy {
    border-left: 4px solid var(--mrt-hypertrophy, #3b82f6) !important;
    border-right: 4px solid var(--mrt-hypertrophy, #3b82f6) !important;
}

.mrt-exercise-name-display.phase-endurance {
    border-left: 4px solid var(--mrt-endurance, #ef44d2) !important;
    border-right: 4px solid var(--mrt-endurance, #ef44d2) !important;
}

/* ==========================================================================
   MRT Icon Utility Classes - Lucide-style SVG icons
   ========================================================================== */

/**
 * Base icon class
 * Usage: <span class="mrt-icon"><svg>...</svg></span>
 */
.mrt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
}

.mrt-icon svg {
    width: 1em;
    height: 1em;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Icon Size Variants */
.mrt-icon-xs svg {
    width: 12px;
    height: 12px;
}
.mrt-icon-sm svg {
    width: 14px;
    height: 14px;
}
.mrt-icon-md svg {
    width: 20px;
    height: 20px;
}
.mrt-icon-lg svg {
    width: 24px;
    height: 24px;
}
.mrt-icon-xl svg {
    width: 32px;
    height: 32px;
}

/* Fixed size icons (non-responsive) */
.mrt-icon-14 {
    width: 14px;
    height: 14px;
}
.mrt-icon-16 {
    width: 16px;
    height: 16px;
}
.mrt-icon-20 {
    width: 20px;
    height: 20px;
}
.mrt-icon-24 {
    width: 24px;
    height: 24px;
}

/**
 * Icon with text wrapper
 * Usage: <span class="mrt-icon-text"><svg>...</svg> Text</span>
 */
.mrt-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.mrt-icon-text svg {
    flex-shrink: 0;
}

/* Icon spacing variants */
.mrt-icon-text-sm {
    gap: 0.125rem;
}
.mrt-icon-text-md {
    gap: 0.375rem;
}
.mrt-icon-text-lg {
    gap: 0.5rem;
}

/* Icon color variants */
.mrt-icon-success {
    color: var(--mrt-success, #28a745);
}
.mrt-icon-danger {
    color: var(--mrt-danger, #dc3545);
}
.mrt-icon-warning {
    color: #f59e0b;
}
.mrt-icon-primary {
    color: var(--mrt-primary, #4f33ff);
}
.mrt-icon-muted {
    color: var(--mrt-text-muted, #a0aec0);
}

/* Icon in button context */
.mrt-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.mrt-btn-icon svg {
    flex-shrink: 0;
}

/* Notice icon styling */
.mrt-notice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(79, 51, 255, 0.1);
    color: var(--mrt-primary, #4f33ff);
    flex-shrink: 0;
}

.mrt-notice-icon svg {
    width: 18px;
    height: 18px;
}

/* Success icon in popup/modal context */
.mrt-success-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.mrt-success-icon svg {
    width: 28px;
    height: 28px;
}

/* Delete modal warning icon */
.mrt-delete-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
}

.mrt-delete-modal-icon svg {
    width: 28px;
    height: 28px;
}

/* Footer action icons (Edit/Delete links) */
.mrt-footer-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.mrt-footer-action svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Dark mode icon adjustments */
html.maxreptracker-dark-mode-enabled .mrt-notice-icon,
body.dark-mode .mrt-notice-icon {
    background: rgba(79, 51, 255, 0.2);
}

html.maxreptracker-dark-mode-enabled .mrt-delete-modal-icon,
body.dark-mode .mrt-delete-modal-icon {
    background: rgba(220, 38, 38, 0.2);
}
