/* Workout Builder
 * Active workout page UI: builder layout, exercise list, set rows, FABs,
 * timer, effort rating, weighted calisthenics, cardio inputs, editable mode.
 */
/* Enhanced Cardio Input Styling */
.set-input.cardio-duration,
.set-input.cardio-distance {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(16, 185, 129, 0.05));
    border: 1.5px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.set-input.cardio-duration:focus,
.set-input.cardio-distance:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
}

.unit-label.cardio-units {
    background: linear-gradient(135deg, #3b82f6, #10b981);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.conversion-helper {
    display: block;
    margin-top: 4px;
    color: #10b981;
    font-size: 0.7rem;
    font-weight: 500;
    font-style: italic;
}

/* Cardio Set Row Enhancements */
.set-row:has(.cardio-duration, .cardio-distance) {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.02), rgba(16, 185, 129, 0.02));
    border-left: 3px solid #10b981;
}

/* Mobile Cardio Optimizations */
@media (max-width: 768px) {
    .set-input.cardio-duration,
    .set-input.cardio-distance {
        min-width: 0;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .unit-label.cardio-units {
        padding: 2px 4px;
        font-size: 0.7rem;
    }
    
    .conversion-helper {
        font-size: 0.65rem;
        margin-top: 2px;
    }
    
    /* Hide unit labels outside input boxes on mobile workout page */
    #workout .unit-label,
    #workout .unit-label.cardio-units,
    .workout-container .unit-label,
    .workout-container .unit-label.cardio-units,
    .sets-container .unit-label,
    .sets-container .unit-label.cardio-units,
    .set-row .unit-label,
    .set-row .unit-label.cardio-units {
        display: none !important;
    }
    
    /* Keep conversion helper visible as it provides useful pace info */
    .conversion-helper {
        display: block !important;
    }
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 7.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--transition);
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .fab {
        bottom: 5rem;
        right: 1rem;
        width: 3.5rem;
        height: 3.5rem;
    }
}

/* Clear Workout Button - Floating */
.clear-workout-btn {
    position: fixed;
    bottom: 6rem;
    left: 1.5rem;
    width: auto;
    height: 3rem;
    min-width: 3rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    border-radius: 2rem;
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
}

.clear-workout-btn:hover {
    background: linear-gradient(135deg, #c82333, #b21e2f);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(220, 53, 69, 0.4);
}

.clear-workout-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .clear-workout-btn {
        top: 50%;
        bottom: auto;
        left: 1rem;
        transform: translateY(calc(-50% - 2rem));
        width: 3rem;
        height: 3rem;
        min-width: 3rem;
        padding: 0;
        border-radius: 50%;
        font-size: 1rem;
        justify-content: center;
    }

    .clear-workout-btn:hover {
        transform: translateY(calc(-50% - 2rem)) scale(1.05);
    }

    .clear-workout-btn:active {
        transform: translateY(calc(-50% - 2rem));
    }

    .clear-workout-btn span {
        display: none;
    }
}

/* Floating Save Button */
.floating-save-btn {
    position: fixed;
    bottom: 7.5rem;
    left: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-save-btn span {
    display: none;
}

.floating-save-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.5);
}

.floating-save-btn:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .floating-save-btn {
        bottom: 5rem;
        left: 1rem;
        width: 3.5rem;
        height: 3.5rem;
    }
}

/* Editable Workout Styling */
.exercise-detail.editable {
    background: rgba(99, 102, 241, 0.05);
    border: 2px dashed rgba(99, 102, 241, 0.2);
}

.set-detail.editable {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}


.btn-outline {
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: white;
}

.btn-outline:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.add-set {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem;
}

.remove-set {
    width: 2rem;
    height: 2rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .workout-actions {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
        margin-left: 0;
        margin-top: auto;
        align-self: flex-end;
    }
}


.workout-exercise-selector {
    position: relative;
}

.workout-exercise-selector .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

#addExerciseSearch {
    padding-left: 2.5rem !important;
    scroll-margin-top: 0;
    scroll-behavior: auto;
}

/* Prevent scroll jump on mobile when focusing search */
@media (max-width: 768px) {
    #addExerciseSearch {
        scroll-margin: 0;
        scroll-padding: 0;
    }
    
    .workout-exercise-selector {
        scroll-behavior: auto;
    }
    
    .workout-exercise-selector.expanded {
        scroll-behavior: auto;
    }
    
    /* Prevent unwanted scrolling when container expands */
    .workout-exercise-selector.collapsed {
        will-change: max-height;
    }
    
    .workout-exercise-selector.expanded {
        will-change: auto;
    }
}

/* Removed duplicate .search-dropdown rule */

/* Responsive workout page styles */
.workout-start-options {
    margin-bottom: 2rem;
}

#custom-tab.tab-content {
    padding: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.workout-exercise-selector {
    position: relative;
    margin-bottom: 1rem;
}

.workout-exercise-selector #addExerciseSearch {
    width: 100%;
    min-height: 44px;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.workout-exercise-selector #addExerciseSearch:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Removed duplicate .search-dropdown rule */

.search-dropdown.show {
    display: block;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .workout-exercise-selector {
        margin-bottom: 2rem;
        padding: 0;
        min-height: 60vh;
        height: auto;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        position: relative;
        width: 100%;
        max-width: 100%;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .workout-exercise-selector #addExerciseSearch {
        min-height: 48px;
        font-size: 16px; /* Prevent iOS zoom */
        padding: 1rem 1rem 1rem 3rem;
        margin-bottom: 0.25rem;
        flex-shrink: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .workout-exercise-selector .search-icon {
        position: absolute;
        left: 1.5rem;
        top: 1.5rem;
        transform: translateY(50%);
        z-index: 10;
        color: var(--text-secondary);
        font-size: 1.2rem;
        pointer-events: none;
    }
    
    /* Make containers much larger to show search bar + dropdown */
    .start-options-content {
        overflow-x: hidden;
        overflow-y: visible;
        height: auto;
        max-height: none;
        min-height: 80vh;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* Mobile workout templates - collapsible section */
    .workout-templates-section {
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .templates-header.collapsible-header {
        padding: 0.875rem 1rem;
        min-height: 44px;
    }

    .templates-header-content h3 {
        font-size: 1.1rem;
    }

    .templates-header-content p {
        font-size: 0.8rem;
    }

    .collapse-toggle-btn {
        width: 40px;
        height: 40px;
    }

    .templates-collapsible-content {
        padding: 0 0.5rem 1rem 0.5rem;
    }

    .workout-templates-section.collapsed .templates-collapsible-content {
        padding: 0;
    }

    /* Mobile template add dropdown - use fixed positioning for overlay */
    .template-add-dropdown .dropdown-menu {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        bottom: auto;
        min-width: auto;
        width: calc(100% - 2rem);
        max-width: 300px;
        border-radius: 12px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    }

    .template-add-dropdown .dropdown-item {
        min-height: 48px;
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .template-actions-header .btn {
        min-height: 44px;
    }

    .workout-exercise-selector {
        margin-bottom: 1rem;
    }
    
    /* Exercise selector mobile responsive behavior */
    .workout-exercise-selector {
        transition: all 0.3s ease;
    }
    
    .workout-exercise-selector.collapsed {
        max-height: 70px !important;
        min-height: auto !important;
        height: auto !important;
        overflow: hidden;
        padding: 0.25rem;
    }
    
    .workout-exercise-selector.collapsed.empty {
        max-height: 58px !important;
        min-height: auto !important;
        height: auto !important;
        padding: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    .workout-exercise-selector.collapsed.empty #addExerciseSearch {
        min-height: 44px;
        padding: 0.75rem;
        font-size: 16px;
        margin-bottom: 0;
    }
    
    .workout-exercise-selector.collapsed.empty .search-icon {
        display: none;
    }
    
    .workout-exercise-selector.collapsed .exercise-selector-header {
        display: none;
    }
    
    .workout-exercise-selector.expanded {
        max-height: none;
        overflow: visible;
    }
    
    .workout-exercise-selector.expanded .exercise-selector-header {
        display: block;
        animation: fadeInDown 0.3s ease;
    }

    .exercise-selector-header h3,
    .exercise-selector-header p {
        padding-left: 1.25rem;
    }

    .exercise-selector-header {
        margin-bottom: 0.15rem !important;
    }

    .exercise-selector-header h3 {
        margin-bottom: 0 !important;
    }

    /* Ensure search container remains visible when collapsed */
    .workout-exercise-selector.collapsed .workout-exercise-selector {
        display: block;
        margin-bottom: 0;
    }
    
    @keyframes fadeInDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Mobile dropdown scroll behavior for keyboard hiding */
    /* Removed duplicate .search-dropdown rule */
    
    /* Visual feedback when scrolling to hide keyboard */
    .search-dropdown.scrolling {
        background: var(--card-background);
    }
    
    /* Prevent text selection during scroll */
    .search-dropdown.scrolling * {
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    /* Removed duplicate .search-dropdown rule */
    
    /* Prevent dropdown from disappearing during interaction */
    .search-dropdown:hover,
    .search-dropdown:focus-within,
    .search-dropdown.scrolling {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Removed duplicate .search-dropdown rule */
    
    /* Prevent body scroll when dropdown is active */
    body.dropdown-active {
        position: fixed;
        width: 100%;
    }
}

/* Ensure desktop behavior is unaffected */
@media (min-width: 769px) {
    .workout-exercise-selector.collapsed,
    .workout-exercise-selector.expanded {
        max-height: none;
        overflow: visible;
    }
    
    .workout-exercise-selector.collapsed .exercise-selector-header {
        display: block;
    }
    
    .templates-header h3,
    .exercise-selector-header h3 {
        font-size: 1.2rem;
    }

    .templates-header p,
    .exercise-selector-header p {
        font-size: 0.8rem;
    }

    /* Wider workout container on mobile */
    .workout-start-options {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    
    #custom-tab.tab-content {
        overflow-y: visible;
        height: auto;
        max-height: none;
        min-height: 80vh;
        padding: 0.25rem;
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
    }
    
    .workout-exercise-selector {
        overflow-y: visible;
        height: auto;
        min-height: 70vh;
        width: 100%;
    }
    
    /* Fix cut-off units in workout exercises */
    .sets-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem;
        width: 100%;
        overflow-x: auto;
    }
    
    .set-item {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        min-width: 110px;
        text-align: center;
        white-space: nowrap;
        overflow: visible;
    }
    
    .set-input {
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: 0.75rem 0.5rem;
        font-size: 16px;
        text-align: center;
        box-sizing: border-box;
        min-height: 44px;
    }
}

/* Floating Scroll Navigation */

/* Removed conflicting dropdown positioning rule */
    
    .dropdown-item {
        padding: 1.25rem 1rem !important;
        min-height: 70px !important;
        display: flex !important;
        align-items: center !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    
    /* Fix tab buttons being cut off on mobile */
    .start-options-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .start-option-tabs {
        width: 100%;
        justify-content: center;
        padding: 6px;
        gap: 8px;
    }
    
    .start-option-tabs .tab-btn {
        padding: 12px 20px;
        font-size: 14px;
        font-weight: 600;
        min-width: 120px;
        justify-content: center;
        white-space: nowrap;
        flex: 1;
        max-width: 150px;
    }
    
    .start-option-tabs .tab-btn i {
        font-size: 16px;
    }
    
    /* Workout page responsive fixes */
    .workout-header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .workout-date-container,
    /* Timer container styles removed */ .removed-timer-container {
        width: 100%;
        text-align: center;
    }
    
    .workout-builder {
        padding: 1rem;
    }
    
    .workout-controls {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .workout-action-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .workout-controls .btn {
        width: 100%;
        padding: 1rem;
        font-size: 16px;
        min-height: 48px;
    }

}

/* Desktop styles */
@media (min-width: 769px) {
    .workout-exercise-selector {
        max-width: 600px;
    }
    
    /* Consolidated search dropdown rule */
    .search-dropdown {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-background);
        border: 1px solid var(--border-color);
        border-radius: 0 0 var(--border-radius) var(--border-radius);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        max-height: 60vh;
        overflow-y: auto;
        z-index: 9999;
        margin-top: 2px;
        /* Optimal mobile touch scrolling */
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        overscroll-behavior: contain;
        touch-action: manipulation;
    }
}

.dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dropdown-item:last-child {
    border-bottom: none;
}
/* Only enable hover effects on devices that can actually hover (desktop) */
@media (hover: hover) and (pointer: fine) {
    .dropdown-item:hover {
        background: rgba(99, 102, 241, 0.1);
    }
}

/* Disable hover effects on touch devices to enable proper scrolling */
@media (hover: none) and (pointer: coarse) {
    .dropdown-item:hover {
        background: transparent;
    }
    
    /* Optimize dropdown items for touch scrolling */
    .dropdown-item {
        /* Prevent text selection during scrolling */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        /* Optimize touch target size */
        min-height: 48px;
        /* Enable fast taps while allowing scrolling */
        touch-action: manipulation;
        /* Disable touch callout on iOS */
        -webkit-touch-callout: none;
    }
    
    /* Removed duplicate - mobile scrolling already defined in main .search-dropdown rule */
}

.dropdown-item .item-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #e2e8f0;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    white-space: nowrap;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

/* Workout Exercise Styling */
.add-set-btn {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px dashed var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.exercise-bottom-actions .add-set-btn {
    width: auto;
    flex: 1;
    margin-top: 0;
}

.add-set-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* Modern Workout Builder */
.workout-builder {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.workout-exercise-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    padding: 1.5rem;
    background: rgba(248, 250, 252, 0.8);
    border-radius: var(--border-radius);
    border: 1px solid rgba(99, 102, 241, 0.1);
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

/* Desktop collapsed state */
.workout-exercise-selector.collapsed {
    max-height: 80px;
    min-height: auto;
    height: auto;
    overflow: hidden;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.workout-exercise-selector.collapsed.empty {
    max-height: 70px;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.workout-exercise-selector.collapsed .exercise-selector-header {
    display: none;
}

.workout-exercise-selector.collapsed.empty .search-icon {
    display: none;
}

.workout-exercise-selector.expanded {
    max-height: none;
    overflow: visible;
    padding: 1.5rem;
}

.workout-exercise-selector.expanded .exercise-selector-header {
    display: block;
    animation: fadeInDown 0.3s ease;
}

.exercise-selector select {
    flex: 1;
    max-width: 400px;
}
}

.form-select {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: white;
    font-size: 1rem;
    transition: var(--transition);
    min-height: 48px;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Ensure dropdown options have proper contrast */
.form-select option {
    background: white;
    color: #333;
}

/* Timer styles removed - simplified workout tracking */

.workout-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.workout-action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.workout-controls .btn-outline-danger {
    background: transparent;
    border: 2px solid #dc3545;
    color: #dc3545;
    transition: all 0.3s ease;
}

.workout-controls .btn-outline-danger:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Exercise Library Link */
.exercise-library-link {
    text-align: center;
    margin-top: 1rem;
    padding: 0.5rem 0;
}

.exercise-library-link .btn {
    width: 100%;
    padding: 0.75rem;
    font-weight: 600;
}

/* Back to Workout Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    background: none;
    border: none;
    color: var(--primary-color, #6366f1);
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 500;
}

.back-btn:hover {
    opacity: 0.8;
}

/* Fixed Floating Workout Timer */
.workout-timer-fab {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1002;
    display: none;
}

.workout-timer-fab.visible {
    display: block;
}

@media (max-width: 768px) {
    .workout-timer-fab {
        top: 4.5rem;
        right: 1rem;
    }
}

.timer-fab-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary, linear-gradient(135deg, #667eea, #764ba2));
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

.timer-fab-icon:active {
    transform: scale(0.92);
}

.timer-running {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-primary, linear-gradient(135deg, #667eea, #764ba2));
    border-radius: 50px;
    padding: 0.35rem 0.5rem 0.35rem 0.75rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.timer-running .timer-display {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.timer-running-controls {
    display: flex;
    gap: 0.25rem;
}

.timer-ctrl-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.timer-ctrl-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

.workout-exercise {
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slideUp 0.3s ease;
}

.workout-exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.workout-exercise-header h4 {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workout-exercise h4 {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.exercise-reorder-btns {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.exercise-reorder-btns .reorder-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--border-radius);
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 0.8rem;
}

.exercise-reorder-btns .reorder-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-color);
}

.exercise-reorder-btns .reorder-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.workout-exercise.exercise-reordering {
    position: relative;
    z-index: 2;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    will-change: transform;
}

.remove-exercise {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.remove-exercise:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

.sets-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.set-row {
    display: grid;
    grid-template-columns: auto 1fr 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.set-row:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.set-number {
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
    font-size: 0.9rem;
}

.set-input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.9);
    min-height: 48px;
    width: 100%;
}

.set-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
    transform: scale(1.02);
}

/* Weighted calisthenics styles */
.set-input.bodyweight-weight {
    max-width: 100px;
    padding: 0.5rem;
    min-height: 40px;
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-text-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.btn-remove-weight {
    color: var(--danger-color, #ef4444);
    font-size: 1.1rem;
    padding: 0.1rem 0.4rem;
    line-height: 1;
}

/* Effort Rating Styles */
.effort-rating-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.effort-rating-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 70px;
    margin: 0;
}

.effort-rating-slider {
    flex: 1;
    min-width: 120px;
    height: 8px;
    background: linear-gradient(to right, #10b981 0%, #f59e0b 50%, #ef4444 100%);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.effort-rating-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.effort-rating-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.effort-rating-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.effort-rating-value {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* Effort Rating Display in Workout Details */
.effort-rating-display {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Inline Effort Rating for Edit Mode */
.effort-rating-container.inline {
    flex-direction: row;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0 0.5rem;
    gap: 0.25rem;
}

.effort-rating-slider.inline {
    width: 100px;
    height: 6px;
    margin: 0;
}

.effort-rating-container.inline .effort-rating-value {
    font-size: 0.8rem;
    min-width: 15px;
}

/* Exercise-level effort rating */
.effort-rating-container.exercise-effort {
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.08);
    border-left: 3px solid var(--primary-color);
}

.add-set-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.add-set-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Exercise bottom action bar (delete, trends, add set) */
.exercise-bottom-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.exercise-bottom-actions .remove-exercise,
.exercise-bottom-actions .trend-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--border-radius);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trend-btn-small.disabled,
.trend-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.exercise-bottom-actions .add-set-btn {
    flex: 1;
    margin-top: 0;
}

/* Workout Timer */
/* Timer container styles removed */ .removed-timer-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Workout Date Controls */
.workout-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.workout-date-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 50px;
}

/* Removed label styles - no longer needed */

.date-input {
    flex: 1;
    min-width: 0;
}

.workout-date-container .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    max-width: 80px;
}

.workout-edit-controls {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.edit-controls-section h4 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.edit-controls-section .form-group {
    margin-bottom: 1rem;
}

.edit-controls-section .form-group:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    /* Enhanced Workout Header Mobile Layout */
    .workout-header-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .workout-date-container {
        padding: 1rem 1.2rem;
        min-height: 60px;
    }
    
    /* Removed mobile label styles - no longer needed */
    
    .date-input {
        min-width: 150px;
        flex: 2;
        padding: 0.875rem 1rem;
        border: 2px solid var(--border-color);
        border-radius: var(--border-radius);
        background: white;
        font-size: 1.1rem;
        transition: var(--transition);
        min-height: 50px;
        font-weight: 500;
    }
    
    .date-input:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }
    
    .workout-date-container .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: var(--border-radius);
        min-height: 44px;
        white-space: nowrap;
        flex: 0 0 auto;
        max-width: 80px;
    }
    
}

/* FAB Enhancement */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 4rem;
    height: 4rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
    transition: var(--transition);
    z-index: 500;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.fab:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.5);
}
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.set-row {
    animation: scaleIn 0.2s ease;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Interactive feedback */
.btn:active {
    transform: scale(0.98);
}

.set-input:focus {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus-visible,
.nav-btn:focus-visible,
.set-input:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-secondary: #333;
    }
}

