body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f4f7f6; /* Light, clean background */
    color: #333333; /* Dark grey for primary text */
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Ensure main content doesn't hide behind fixed navbar */
main {
    padding-top: 20px;
}

/* Mobile-first responsive container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px;
}

@media (min-width: 768px) {
    .container {
        padding: 20px;
    }
}



.workout-header {
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.workout-date {
    color: #666;
    font-style: italic;
}

.exercise-section {
    margin-bottom: 40px;
}

.exercise-card {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sets-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.sets-table th, .sets-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.sets-table th {
    background-color: #f2f2f2;
}

.add-set-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #45a049;
}

/* Preserve Bootstrap navbar toggler appearance */
.navbar-toggler {
    background-color: transparent;
    color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.25rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.navbar-toggler:hover,
.navbar-toggler:active,
.navbar-toggler:not(.collapsed) {
    background-color: transparent;
    color: inherit;
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: none;
}

.navbar-toggler:focus,
.navbar-toggler:focus-visible {
    outline: none;
    box-shadow: none;
}

.delete-set-btn {
    background-color: #f44336;
}

.delete-set-btn:hover {
    background-color: #d32f2f;
}

.edit-set-btn {
    background-color: #2196F3;
}

.edit-set-btn:hover {
    background-color: #0b7dda;
}

.add-exercise-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

select, input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.home-container {
    padding-top: 0; /* Reset from previous */
    padding-bottom: 0; /* Reset from previous */
}

.home-header {
    text-align: center;
    padding: 80px 20px 60px; /* More padding for a hero feel */
    background-color: #ffffff; /* White background for the header section */
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 40px; /* Space before features */
}

.home-header h1 {
    font-size: 3.2rem; /* Adjusted font size */
    color: #007bff; /* Primary accent blue */
    margin-bottom: 20px;
    font-weight: 600;
}

.home-header p {
    font-size: 1.25rem;
    color: #555555; /* Softer grey for tagline */
    margin-bottom: 30px;
}

.features {
    display: grid; /* Using grid for more control */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
    gap: 30px;
    padding: 0 20px; /* Padding for the features section */
    margin: 40px auto;
}

.feature-card {
    background-color: #ffffff; /* White card background */
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Softer, modern shadow */
    text-align: left; /* Align text to left for a more standard card layout */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex; /* Flex for icon and text alignment */
    flex-direction: column; /* Stack icon and text vertically */
    align-items: center; /* Center items for a polished look */
    text-align: center; /* Center text */
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.feature-icon {
    font-size: 2.5rem; /* Slightly smaller, more refined icon size */
    color: #007bff; /* Primary accent blue for icons */
    margin-bottom: 15px;
    background-color: #e7f3ff; /* Light blue background for icon */
    border-radius: 50%; /* Circular background */
    padding: 15px;
    display: inline-flex; /* To center icon content if it's an SVG or font icon */
    align-items: center;
    justify-content: center;
    width: 60px; /* Fixed width for circle */
    height: 60px; /* Fixed height for circle */
}

.feature-card h2 {
    color: #333333; /* Dark grey for heading */
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.feature-card p {
    color: #666666; /* Medium grey for card text */
    font-size: 0.95rem;
    line-height: 1.5;
}

.cta-section {
    text-align: center;
    padding: 40px 20px; /* Padding for the section */
    margin: 20px 0 40px 0;
}

.button-primary, .cta-button {
    display: inline-block;
    background-color: #28a745; /* Green for primary CTA */
    color: white;
    padding: 12px 30px;
    border-radius: 8px; /* Slightly less rounded */
    text-decoration: none;
    font-weight: 500; /* Medium weight */
    font-size: 1.1rem;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: none; /* Remove default border */
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-primary:hover, .cta-button:hover {
    background-color: #218838; /* Darker green on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* General button styles for other links if needed */
.button-secondary {
    display: inline-block;
    background-color: #007bff; /* Primary blue */
    color: white;
    padding: 10px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.button-secondary:hover {
    background-color: #0056b3; /* Darker blue on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Legacy nav styles removed - now using Bootstrap navbar */

/* Footer Styles */
footer {
    background-color: #ffffff; /* White background for footer */
    color: #555555; /* Softer grey text */
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 40px; /* Space above the footer */
    font-size: 0.9rem;
}

/* Exercise List Styles */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.exercise-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.exercise-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.exercise-card-editable {
    position: relative;
    cursor: pointer;
    border: 2px solid #007bff;
}

.exercise-card-editable:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,123,255,0.2);
    background-color: #f0f8ff;
}

.exercise-card-editable::after {
    content: '\270E';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2rem;
    color: #007bff;
    opacity: 0.7;
}

.exercise-card-editable:hover::after {
    opacity: 1;
}

.category-section {
    margin-bottom: 2rem;
}

.search-box {
    margin-bottom: 2rem;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1rem;
}

/* SIU Modal Styles */
.siu-modal {
    display: none; /* Hidden by default, shown by JS */
    position: fixed; /* Stay in place */
    z-index: 1050; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity for backdrop */
    align-items: center; /* Vertical center (if using flex for display) */
    justify-content: center; /* Horizontal center (if using flex for display) */
}

.siu-modal-content {
    background-color: #fefefe;
    margin: auto; /* Handles centering for non-flex display, good fallback */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px; /* Max width */
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
}

.siu-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1; /* ensure it aligns well */
    padding: 0 5px; /* A bit of padding for easier clicking */
}

.siu-modal-close:hover,
.siu-modal-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Clear floats for modal header/content if close button is floated */
.siu-modal-content::after {
    content: "";
    clear: both;
    display: table;
}

/* Styles for form elements within the modal */
.siu-modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.75rem;
    text-align: left;
}

.siu-modal-content .form-group {
    margin-bottom: 1rem;
}

.siu-modal-content .form-group label {
    display: block;
    margin-bottom: .5rem;
    font-weight: bold;
    color: #333;
}

.siu-modal-content .form-control {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    box-sizing: border-box;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.siu-modal-content .form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 .2rem rgba(0,123,255,.25);
}

.siu-modal-content textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.siu-modal-content select.form-control:not([multiple]) {
    height: calc(1.5em + 1rem + 2px); /* Matches input height */
}

.siu-modal-content select[multiple].form-control {
    min-height: 100px;
    height: auto;
}

.siu-modal-content .form-text {
    display: block;
    margin-top: .25rem;
    font-size: .875em;
    color: #6c757d;
}

/* Modal Action Buttons */
.siu-modal-content form .btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: .5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    margin-top: 10px;
    margin-right: 10px;
}

.siu-modal-content form .btn:last-of-type {
    margin-right: 0;
}

.siu-modal-content form .btn-primary {
    color: #fff;
    background-color: #4CAF50; /* Green to match existing button style */
    border-color: #4CAF50;
}

.siu-modal-content form .btn-primary:hover {
    background-color: #45a049;
    border-color: #3e8e41;
}

.siu-modal-content form .btn-primary:focus {
    box-shadow: 0 0 0 .2rem rgba(76,175,80,.5);
}

.siu-modal-content form .btn-secondary {
    color: #fff;
    background-color: #6c757d; /* Standard secondary gray */
    border-color: #6c757d;
}

.siu-modal-content form .btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.siu-modal-content form .btn-secondary:focus {
    box-shadow: 0 0 0 .2rem rgba(108,117,125,.5);
}

/* Styles for Routine Form Exercise Cards */
.exercise-routine-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 18px;
    background-color: #ffffff;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}
.exercise-routine-card .card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
}
.exercise-routine-card .card-header h5 {
    margin: 0;
}

/* Drag and Drop Styles */
.exercise-routine-card.dragging {
    background: #f0f0f0;
    border: 1px dashed #ccc;
}

.dragging-clone {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.drag-source-hidden {
    visibility: hidden;
}

/* Mobile touch dragging improvements */
.dragging-clone {
    cursor: grabbing;
    transform-origin: center;
}

/* Improve touch targets for mobile drag */
@media (max-width: 768px) {
    .exercise-routine-card[draggable="true"],
    .workout-exercise-card[draggable="true"],
    .routine-chip[draggable="true"] {
        touch-action: none; /* Prevent scrolling during drag */
        user-select: none; /* Prevent text selection during drag */
        -webkit-user-select: none;
        cursor: grab;
    }

    .exercise-routine-card[draggable="true"]:active,
    .workout-exercise-card[draggable="true"]:active,
    .routine-chip[draggable="true"]:active {
        cursor: grabbing;
    }
}

.drop-placeholder {
    background-color: #e0e0e0;
    border: 2px dashed #aaa;
    margin: 10px 0;
    height: 50px;
}

/* Program Form - Weekly Planner */
.weekly-planner {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    background-color: #f0f3f5;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #d8e1e8;
}

.day-column {
    background-color: #ffffff;
    border-radius: 6px;
    padding: 10px;
    min-height: 150px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.day-header {
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
    color: #333;
}

.routines-for-day-container {
    min-height: 100px; /* Ensure drop area is available even when empty */
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.routines-for-day-container.drag-over {
    background-color: #e8f4f8;
    border: 2px dashed #4a90e2;
    border-radius: 4px;
}

.routine-chip {
    display: flex;
    justify-content: space-between;
    cursor: move;
    align-items: center;
    background-color: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 15px; /* Pill shape */
    font-size: 0.85rem;
    font-weight: 500;
    cursor: grab;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.routine-chip:active {
    cursor: grabbing;
}

.routine-chip .btn-close {
    filter: brightness(0) invert(1); /* Make it white */
    margin-left: 8px;
    opacity: 0.7;
}
.routine-chip .btn-close:hover {
    opacity: 1;
}

.add-routine-to-day-select {
    width: 100%;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile-first approach - styles for mobile and up */

/* Touch-friendly buttons and form elements */
button, .btn, input[type="submit"], input[type="button"], .btn-close {
    min-height: 44px; /* Apple's recommended touch target size */
    min-width: 44px;
    touch-action: manipulation; /* Disable double-tap zoom */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1); /* Subtle tap feedback */
}

/* Larger touch targets for small buttons on mobile */
@media (max-width: 767px) {
    .btn-sm {
        min-height: 40px;
        padding: 10px 15px;
    }

    .btn-close {
        min-height: 40px;
        min-width: 40px;
    }
}

/* Mobile-friendly form elements */
input, select, textarea {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

.sets-table {
    min-width: 600px; /* Ensure table doesn't get too cramped */
}

/* Smooth scrolling for mobile */
html {
    scroll-behavior: smooth;
}

/* Better scroll bars on mobile */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile navigation adjustments */
.navbar-brand {
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    padding: 0.75rem 1rem;
}

/* Responsive workout cards */
.workout-card, .exercise-card {
    margin-bottom: 15px;
    padding: 15px;
}

/* Responsive home page */
.home-header h1 {
    font-size: 2.5rem;
}

.features {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 15px;
}

/* Responsive buttons groups */
.btn-group-vertical .btn {
    margin-bottom: 0.5rem;
}

/* Modal improvements for mobile */
.siu-modal-content {
    width: 95%;
    max-width: 500px;
    margin: 10px auto;
    max-height: 90vh;
    overflow-y: auto;
}

/* Form improvements */
.form-row {
    flex-direction: column;
    gap: 15px;
}

/* Responsive grid layouts */
.exercise-grid {
    grid-template-columns: 1fr;
    gap: 15px;
}

/* ============================================
   TABLET STYLES (768px and up)
   ============================================ */
@media (min-width: 768px) {
    /* Container adjustments */
    main {
        padding-top: 30px;
    }

    /* Home page improvements */
    .home-header h1 {
        font-size: 3rem;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        padding: 0 20px;
    }

    /* Exercise grid for tablets */
    .exercise-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Form improvements */
    .form-row {
        flex-direction: row;
        gap: 15px;
        align-items: center;
    }

    /* Modal improvements */
    .siu-modal-content {
        width: 80%;
        margin: 50px auto;
    }

    /* Weekly planner for tablets */
    .weekly-planner {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Button groups back to horizontal on tablets */
    .btn-group {
        flex-direction: row;
        width: auto;
    }

    .btn-group .btn {
        margin-bottom: 0;
    }
}

/* ============================================
   DESKTOP STYLES (992px and up)
   ============================================ */
@media (min-width: 992px) {
    /* Home page desktop styles */
    .home-header h1 {
        font-size: 3.2rem;
    }

    .features {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }

    /* Exercise grid for desktop */
    .exercise-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    /* Form improvements */
    .form-row {
        gap: 20px;
    }

    /* Weekly planner for desktop - full 7-day grid */
    .weekly-planner {
        grid-template-columns: repeat(7, 1fr);
    }
}

/* ============================================
   SPECIFIC MOBILE FIXES
   ============================================ */

/* Fix for workout detail buttons on mobile */
@media (max-width: 767px) {
    .workout-header .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .workout-header .d-flex > div {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Program list mobile improvements */
    .program-list .d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Routine form mobile improvements */
    .exercise-routine-card {
        padding: 15px;
        margin-bottom: 20px;
    }

    .set-row {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        padding: 15px;
    }

    .set-row .form-control {
        margin-bottom: 10px;
    }

    /* AI Chat mobile improvements */
    #chat-messages {
        height: 300px !important;
        padding: 15px !important;
    }

    /* Make chat responsive to screen height */
    #chat-messages {
        max-height: 50vh;
        min-height: 250px;
    }

    .message {
        margin-bottom: 10px !important;
    }

    /* Weekly planner mobile adjustments */
    .weekly-planner {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .day-column {
        min-height: auto;
        padding: 15px;
    }

    /* Make weekly planner more touch-friendly */
    .routine-chip {
        padding: 10px 15px;
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .add-routine-to-day-select {
        padding: 10px;
        font-size: 16px;
    }

    /* Table responsive improvements */
    .table-responsive table {
        font-size: 0.875rem;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 8px;
        white-space: nowrap;
    }

    /* Button improvements for mobile */
    .btn-sm {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    /* Performance feedback buttons */
    .btn-group-sm .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-height: 40px;
    }

    /* Stack performance feedback buttons vertically on very small screens */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 5px;
    }

    .btn-group .btn:last-child {
        margin-bottom: 0;
    }

    /* Hide some text on mobile to save space */
    .d-none.d-sm-inline {
        display: none !important;
    }
}

/* ============================================
   UTILITY CLASSES FOR MOBILE
   ============================================ */

/* Mobile-only display utilities */
.mobile-only {
    display: block;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
}

/* Desktop-only display utilities */
.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .desktop-only {
        display: block;
    }
}

/* Mobile stacking utility */
.mobile-stack {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .mobile-stack {
        flex-direction: row;
        align-items: center;
    }
}

/* Touch-friendly spacing */
.touch-friendly {
    padding: 15px;
    margin: 10px 0;
}

/* Responsive text sizes */
.responsive-text {
    font-size: 1rem;
}

@media (min-width: 768px) {
    .responsive-text {
        font-size: 1.125rem;
    }
}

/* ============================================
   MOBILE WORKOUT VIEW (SET FOCUSED)
   ============================================ */


@media (min-width: 992px) {
    .responsive-text {
        font-size: 1.25rem;
    }
}

/* ============================================
   TIMER STYLES - MOBILE FIRST RESPONSIVE
   ============================================ */

/* Timer section base styles */
.timer-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Desktop alignment for Warmup and Done columns in sets table */
.sets-container th.set-header-warmup,
.sets-container th.set-header-done,
.sets-container td.set-warmup,
.sets-container td.set-done {
    text-align: center;
    vertical-align: middle;
}

/* Mobile workout set helpers */
.mobile-set-progress {
    height: 6px;
    background-color: #f1f3f5;
    border-radius: 999px;
    overflow: hidden;
}

.mobile-set-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffbf75 0%, #ff9933 100%);
    transition: width 0.3s ease;
}


.set-row.current-set-row {
    background-color: var(--bs-warning) !important;
}

.set-row.set-completed {
    opacity: 0.6;
}

.set-row.current-set-row > td,
.set-row.current-set-row > th {
    background-color: var(--bs-warning) !important;
}

.set-row.set-completed.current-set-row {
    opacity: 0.8;
}

/* Timer display styles */
.timer-display {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 12px;
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Timer display active state */
.timer-display.active {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #333;
}

/* Timer display paused state */
.timer-display.paused {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #333;
}

/* Timer controls button group */
.timer-controls {
    display: flex;
    gap: 0;
}

/* Timer button base styles */
.timer-controls .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 36px;
    padding: 6px 8px;
    font-size: 0.875rem;
    border-radius: 0;
    transition: all 0.2s ease;
}

/* First and last button border radius */
.timer-controls .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.timer-controls .btn:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Timer button text spacing */
.timer-controls .btn span {
    margin-left: 4px;
}

/* Timer button states */
.timer-start-btn.active {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.timer-pause-btn.active {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.timer-stop-btn.active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* Mobile-first: Hide text labels on small screens */
@media (max-width: 576px) {
    .timer-display {
        font-size: 1rem;
        padding: 5px 8px;
        min-width: 50px;
    }

    .timer-controls .btn {
        min-width: 32px;
        min-height: 32px;
        padding: 4px 6px;
        font-size: 0.75rem;
    }

    /* Ensure text is hidden on mobile */
    .timer-controls .d-none.d-sm-inline {
        display: none !important;
    }
}

/* Tablet styles (768px and up) */
@media (min-width: 768px) {
    .timer-section {
        gap: 12px;
    }

    .timer-display {
        font-size: 1.2rem;
        padding: 8px 14px;
        min-width: 70px;
    }

    .timer-controls .btn {
        min-height: 40px;
        min-width: 40px;
        padding: 8px 10px;
        font-size: 0.875rem;
    }

    /* Show text labels on tablet and up */
    .timer-controls .d-none.d-sm-inline {
        display: inline !important;
    }
}

/* Desktop styles (992px and up) */
@media (min-width: 992px) {
    .timer-display {
        font-size: 1.3rem;
        padding: 10px 16px;
        min-width: 80px;
    }

    .timer-controls .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .timer-controls .btn span {
        margin-left: 6px;
    }
}

/* ============================================
   EXERCISE TIMER OVERRIDES STYLES
   ============================================ */

/* Exercise timer overrides list styles */
.exercise-timer-overrides-list {
    min-height: 120px;
}

.timer-override-item {
    padding: 12px 0;
    transition: background-color 0.2s ease;
}

.timer-override-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
    margin: 0 -8px;
    padding: 12px 8px;
}

.timer-override-item:last-child {
    border-bottom: none !important;
}

.override-info .fw-semibold {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 4px;
}

.override-info .text-muted {
    color: #6c757d !important;
    font-size: 0.875rem;
    line-height: 1.4;
}

.override-info .text-muted i {
    width: 16px;
    text-align: center;
    opacity: 0.7;
}

.override-actions .btn {
    transition: all 0.2s ease;
    opacity: 0.7;
}

.timer-override-item:hover .override-actions .btn {
    opacity: 1;
}

.override-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Exercise search select styles */
#override_exercise_search {
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#override_exercise_search:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#override_exercise_search.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Timer duration input styles */
#override_timer_seconds {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.95rem;
    text-align: center;
}

#override_timer_seconds:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Add override button styles */
.btn[data-function*="addExerciseTimerOverride"] {
    background-color: #198754;
    border-color: #198754;
    transition: all 0.2s ease;
}

.btn[data-function*="addExerciseTimerOverride"]:hover {
    background-color: #157347;
    border-color: #146c43;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* No overrides message styles */
#no-overrides-message {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 32px 16px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
}

#no-overrides-message i {
    opacity: 0.5;
    font-size: 1.1rem;
}

/* Card styles for override sections */
.card-header.bg-light {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6;
}

.card-header h6 {
    color: #495057;
    font-weight: 600;
    margin: 0;
}

.card-header h6 i {
    color: #6c757d;
    margin-right: 8px;
}

/* Mobile responsive styles */
@media (max-width: 767px) {
    .timer-override-item {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
        padding: 16px 0;
    }

    .override-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .override-info .fw-semibold {
        font-size: 0.95rem;
    }

    .override-info .text-muted {
        font-size: 0.8rem;
    }

    /* Stack form fields on mobile */
    .row > .col-md-6,
    .row > .col-md-4,
    .row > .col-md-2 {
        margin-bottom: 15px;
    }

    /* Make search select larger on mobile */
    #override_exercise_search {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 14px;
    }

    #override_timer_seconds {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 14px;
    }
}

/* Focus states for accessibility */
.timer-override-item:focus-within {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Animation for adding/removing items */
.timer-override-item {
    animation: fadeInUp 0.3s ease;
}

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

/* Loading state styles */
.btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile adjustments for workout set inputs */
@media (max-width: 575.98px) {
    .sets-container .set-reps-input {
        min-width: 40px;
    }

    .sets-container .set-weight-input {
        min-width: 50px;
    }

    .sets-container table {
        table-layout: fixed;
        width: 100%;
    }

    .sets-container table th,
    .sets-container table td {
        padding: 6px 4px;
    }

    .sets-container table th {
        font-size: 0.78rem;
        white-space: normal;
        line-height: 1.15;
    }

    .sets-container .form-control-sm {
        padding: 4px 6px;
        font-size: 0.9rem;
    }

    .sets-container th.set-header-reps,
    .sets-container td.set-reps {
        width: 22%;
    }

    .sets-container th.set-header-weight,
    .sets-container td.set-weight {
        width: 24%;
    }

    .sets-container th.set-header-warmup,
    .sets-container td.set-warmup {
        width: 21%;
        text-align: center;
    }

    .sets-container th.set-header-done,
    .sets-container td.set-done {
        width: 18%;
        text-align: center;
    }

    .sets-container th.set-header-actions,
    .sets-container td.set-actions {
        width: 15%;
        text-align: center;
    }
}

/* Routine mobile navigation */
.exercise-navigation-bottom {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 8px 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
  z-index: 2;
}
.exercise-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
}
.exercise-indicators .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfd4da;
}
.exercise-indicators .indicator.active {
  background: #0d6efd;
}
@media (min-width: 768px) {
  #routine-exercise-mobile-nav {
    display: none !important;
  }
}@media (max-width: 767px) {
  /* Keep workout header actions inline next to title on mobile */
  .workout-header .workout-header-row {
    flex-direction: row !important;
    align-items: center !important;
  }
  .workout-header .workout-actions-group {
    display: inline-flex !important;
    flex-direction: row !important;
    width: auto !important;
    gap: 6px;
  }
  .workout-header .workout-actions-group .btn {
    margin-bottom: 0 !important;
  }
}
