/* css/workout.css */

/* --- Layout --- */
.exercise-group {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--divider-color);
}

body.dark-theme .exercise-group {
    border-bottom-color: var(--divider-color);
}

.exercise-group:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
}

.exercise-group-title {
    font-size: 1.8rem;
    text-transform: uppercase;
    color: var(--text-color);
    text-align: left; 
    border-left: 5px solid var(--link-color);
    padding-left: 10px;
}

body.dark-theme .exercise-group-title {
     border-left-color: var(--link-color);
}

.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: 2rem 1.5rem; 
}

.exercise-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default; 
}

body.dark-theme .exercise-card {
     box-shadow: 0 2px 5px rgba(255,255,255,0.05);
}

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

body.dark-theme .exercise-card:hover {
    box-shadow: 0 4px 10px rgba(255,255,255,0.1);
}

.exercise-card h4 {
    font-size: 1.1rem;
    margin-top: 10px;
    margin-bottom: 0;
    font-weight: 600;
    color: var(--text-color);
}

/* --- Video Container --- */
.exercise-video-container {
    width: 150px;
    height: 150px;
    margin-bottom: 10px;
    background-color: var(--section-alt-bg);
    overflow: hidden;
    position: relative;
    border-radius: 4px;
    border: 1px solid var(--card-border);
}

.exercise-video-container video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #e9ecef;
}

body.dark-theme .exercise-video-container video {
    background-color: #343a40;
}


/* --- Weekly Planner Styles --- */
#planner-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 1rem;
    padding: 1rem 0; 
}

.planner-day-column {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: .375rem; 
}

.planner-day-header {
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
    padding: 0.75rem 1.25rem; 
    background-color: var(--section-alt-bg); 
    border-bottom: 1px solid var(--card-border);
    color: var(--text-color);
}

body.dark-theme .planner-day-header {
    background-color: var(--bs-gray-dark, #343a40); 
    border-bottom: 1px solid var(--bs-border-color-translucent, rgba(255,255,255,0.15));
}


.planner-exercise-list {
    padding: 0; 
}
.planner-exercise-list .list-group-item {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem; 
    background-color: transparent; 
    border-top: 1px solid var(--card-border); 
}
.planner-exercise-list .list-group-item:first-child {
    border-top: none;
}


.planner-exercise-item .planner-time-input {
    width: 90px; 
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
}
.planner-exercise-item .planner-remove-btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    line-height: 1;
}

.planner-empty-day {
    font-style: italic;
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0.75rem !important;
}
.add-to-planner-btn, .add-group-to-planner-btn { 
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
}

.planner-video-thumb {
    width: 40px; 
    height: 40px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--card-border);
    border-radius: 3px;
    transition: transform 0.2s ease;
}
.planner-video-thumb:hover {
    transform: scale(1.1);
}
.planner-video-icon { 
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--link-color);
    transition: color 0.2s ease;
}
.planner-video-icon:hover {
    color: var(--link-hover-color);
}
.planner-exercise-item .d-flex.align-items-center > div:first-child {
    flex-grow: 1; 
    margin-right: 0.5rem; 
}

/* --- START: CSS for the HEADER dumbbell-divider-container --- */
.dumbbell-divider-container {
    width: 180px; /* Larger width for header dumbbell */
    height: 70px; /* Larger height */
    position: relative;
    margin: 2rem auto; /* Adjusted margin for header */
    perspective: 1000px;
    transform-style: preserve-3d;
    animation: spin-header-dumbbell 12s infinite linear; /* New animation name */
}

.dumbbell-divider-container .dumbbell-part {
    position: absolute;
    transform-style: preserve-3d;
    left: 50%;
    top: 50%;
}

.dumbbell-divider-container .dumbbell-part .face {
    position: absolute;
    background-color: var(--text-color); /* Darker for header */
    border: 1px solid var(--bg-color); /* Contrasting border */
    opacity: 0.95;
    backface-visibility: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    left: 50%;
    top: 50%;
}

/* Header Handle: Length 80px, Thickness_Y 15px, Thickness_Z 15px */
.dumbbell-divider-container .dumbbell-part.handle {
    width: 80px;  
    height: 15px; 
    transform: translate(-50%, -50%); 
}
.dumbbell-divider-container .dumbbell-part.handle .face.front  { 
    width: 80px; height: 15px; margin-left: -40px; margin-top: -7.5px; transform: translateZ(7.5px); 
}
.dumbbell-divider-container .dumbbell-part.handle .face.back   { 
    width: 80px; height: 15px; margin-left: -40px; margin-top: -7.5px; transform: rotateY(180deg) translateZ(7.5px);
}
.dumbbell-divider-container .dumbbell-part.handle .face.left   { 
    width: 15px; height: 15px; margin-left: -7.5px; margin-top: -7.5px; transform: rotateY(-90deg) translateZ(40px); 
}
.dumbbell-divider-container .dumbbell-part.handle .face.right  { 
    width: 15px; height: 15px; margin-left: -7.5px; margin-top: -7.5px; transform: rotateY(90deg) translateZ(40px);
}
.dumbbell-divider-container .dumbbell-part.handle .face.top    { 
    width: 80px; height: 15px; margin-left: -40px; margin-top: -7.5px; transform: rotateX(90deg) translateZ(7.5px); 
}
.dumbbell-divider-container .dumbbell-part.handle .face.bottom { 
    width: 80px; height: 15px; margin-left: -40px; margin-top: -7.5px; transform: rotateX(-90deg) translateZ(7.5px);
}

/* Header Weights: Visual Width 40px, Visual Height 40px, Depth 20px */
.dumbbell-divider-container .dumbbell-part.weight-1,
.dumbbell-divider-container .dumbbell-part.weight-2 {
    width: 40px; 
    height: 40px;
}

.dumbbell-divider-container .dumbbell-part.weight-1 {
    transform: translate(-50%, -50%) translateX(calc(-80px / 2 - 20px / 2)); 
}
.dumbbell-divider-container .dumbbell-part.weight-2 {
    transform: translate(-50%, -50%) translateX(calc(80px / 2 + 20px / 2));  
}

.dumbbell-divider-container .dumbbell-part.weight-1 .face,
.dumbbell-divider-container .dumbbell-part.weight-2 .face {
    background-color: var(--link-color); /* Primary color for weights */
}

.dumbbell-divider-container .dumbbell-part.weight-1 .face.front,
.dumbbell-divider-container .dumbbell-part.weight-2 .face.front {
    width: 40px; height: 40px; margin-left: -20px; margin-top: -20px; transform: translateZ(10px); 
}
.dumbbell-divider-container .dumbbell-part.weight-1 .face.back,
.dumbbell-divider-container .dumbbell-part.weight-2 .face.back {
    width: 40px; height: 40px; margin-left: -20px; margin-top: -20px; transform: rotateY(180deg) translateZ(10px);
}

.dumbbell-divider-container .dumbbell-part.weight-1 .face.left,
.dumbbell-divider-container .dumbbell-part.weight-2 .face.left {
    width: 20px; height: 40px; margin-left: -10px; margin-top: -20px; transform: rotateY(-90deg) translateZ(20px); 
}
.dumbbell-divider-container .dumbbell-part.weight-1 .face.right,
.dumbbell-divider-container .dumbbell-part.weight-2 .face.right {
    width: 20px; height: 40px; margin-left: -10px; margin-top: -20px; transform: rotateY(90deg) translateZ(20px);
}

.dumbbell-divider-container .dumbbell-part.weight-1 .face.top,
.dumbbell-divider-container .dumbbell-part.weight-2 .face.top {
    width: 40px; height: 20px; margin-left: -20px; margin-top: -10px; transform: rotateX(90deg) translateZ(20px); 
}
.dumbbell-divider-container .dumbbell-part.weight-1 .face.bottom,
.dumbbell-divider-container .dumbbell-part.weight-2 .face.bottom {
    width: 40px; height: 20px; margin-left: -20px; margin-top: -10px; transform: rotateX(-90deg) translateZ(20px);
}

@keyframes spin-header-dumbbell {
    from { transform: rotateX(-15deg) rotateY(0deg) rotateZ(-5deg); }
    to   { transform: rotateX(-15deg) rotateY(360deg) rotateZ(-5deg); }
}

body.dark-theme .dumbbell-divider-container .dumbbell-part .face {
    background-color: var(--divider-light-color);
    border: 1px solid var(--divider-color);
}
body.dark-theme .dumbbell-divider-container .dumbbell-part.weight-1 .face,
body.dark-theme .dumbbell-divider-container .dumbbell-part.weight-2 .face {
    background-color: var(--link-hover-color); 
}
/* --- END: CSS for the HEADER dumbbell-divider-container --- */


/* Spinning Dumbbell Animation for Workout Page (Below Planner Title) */
.spinning-dumbbell-container-workoutpage {
    width: 120px; 
    height: 50px; 
    position: relative;
    margin: 2.5rem auto;
    perspective: 800px;
    transform-style: preserve-3d;
    animation: spin-workout-page-dumbbell 10s infinite linear;
}

.spinning-dumbbell-part-wp {
    position: absolute;
    transform-style: preserve-3d;
    left: 50%;
    top: 50%;
}

.spinning-dumbbell-part-wp .face {
    position: absolute;
    background-color: var(--divider-color);
    border: 1px solid var(--divider-light-color);
    opacity: 0.9;
    backface-visibility: hidden;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    left: 50%;
    top: 50%;
}

/* Handle: Length 60px, Thickness_Y 10px, Thickness_Z 10px */
.spinning-dumbbell-part-wp.spinning-handle-wp {
    width: 60px;  
    height: 10px; 
    transform: translate(-50%, -50%); 
}
.spinning-dumbbell-part-wp.spinning-handle-wp .face.front  { 
    width: 60px; height: 10px; margin-left: -30px; margin-top: -5px; transform: translateZ(5px); 
}
.spinning-dumbbell-part-wp.spinning-handle-wp .face.back   { 
    width: 60px; height: 10px; margin-left: -30px; margin-top: -5px; transform: rotateY(180deg) translateZ(5px);
}
.spinning-dumbbell-part-wp.spinning-handle-wp .face.left   { 
    width: 10px; height: 10px; margin-left: -5px; margin-top: -5px; transform: rotateY(-90deg) translateZ(30px); 
}
.spinning-dumbbell-part-wp.spinning-handle-wp .face.right  { 
    width: 10px; height: 10px; margin-left: -5px; margin-top: -5px; transform: rotateY(90deg) translateZ(30px);
}
.spinning-dumbbell-part-wp.spinning-handle-wp .face.top    { 
    width: 60px; height: 10px; margin-left: -30px; margin-top: -5px; transform: rotateX(90deg) translateZ(5px); 
}
.spinning-dumbbell-part-wp.spinning-handle-wp .face.bottom { 
    width: 60px; height: 10px; margin-left: -30px; margin-top: -5px; transform: rotateX(-90deg) translateZ(5px);
}

/* Weights: Visual Width 30px, Visual Height 30px, Depth 12px */
.spinning-dumbbell-part-wp.spinning-weight-1-wp,
.spinning-dumbbell-part-wp.spinning-weight-2-wp {
    width: 30px; 
    height: 30px;
}

.spinning-dumbbell-part-wp.spinning-weight-1-wp {
    transform: translate(-50%, -50%) translateX(calc(-60px / 2 - 12px / 2)); 
}
.spinning-dumbbell-part-wp.spinning-weight-2-wp {
    transform: translate(-50%, -50%) translateX(calc(60px / 2 + 12px / 2));  
}

.spinning-dumbbell-part-wp.spinning-weight-1-wp .face,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face {
    background-color: var(--link-color); 
}

.spinning-dumbbell-part-wp.spinning-weight-1-wp .face.front,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face.front {
    width: 30px; height: 30px; margin-left: -15px; margin-top: -15px; transform: translateZ(6px); 
}
.spinning-dumbbell-part-wp.spinning-weight-1-wp .face.back,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face.back {
    width: 30px; height: 30px; margin-left: -15px; margin-top: -15px; transform: rotateY(180deg) translateZ(6px);
}

.spinning-dumbbell-part-wp.spinning-weight-1-wp .face.left,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face.left {
    width: 12px; height: 30px; margin-left: -6px; margin-top: -15px; transform: rotateY(-90deg) translateZ(15px); 
}
.spinning-dumbbell-part-wp.spinning-weight-1-wp .face.right,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face.right {
    width: 12px; height: 30px; margin-left: -6px; margin-top: -15px; transform: rotateY(90deg) translateZ(15px);
}

.spinning-dumbbell-part-wp.spinning-weight-1-wp .face.top,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face.top {
    width: 30px; height: 12px; margin-left: -15px; margin-top: -6px; transform: rotateX(90deg) translateZ(15px); 
}
.spinning-dumbbell-part-wp.spinning-weight-1-wp .face.bottom,
.spinning-dumbbell-part-wp.spinning-weight-2-wp .face.bottom {
    width: 30px; height: 12px; margin-left: -15px; margin-top: -6px; transform: rotateX(-90deg) translateZ(15px);
}

@keyframes spin-workout-page-dumbbell {
    from { transform: rotateX(10deg) rotateY(0deg); }
    to   { transform: rotateX(10deg) rotateY(360deg); }
}

body.dark-theme .spinning-dumbbell-part-wp .face {
    background-color: var(--divider-light-color);
    border: 1px solid var(--divider-color);
}
body.dark-theme .spinning-dumbbell-part-wp.spinning-weight-1-wp .face,
body.dark-theme .spinning-dumbbell-part-wp.spinning-weight-2-wp .face {
    background-color: var(--link-hover-color); 
}


/* Styles for Video Preview Modal Enhancements */
.video-modal-controls-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--card-border);
}

body.dark-theme .video-modal-controls-container {
    border-top-color: var(--card-border);
}

.video-modal-control-group {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.video-modal-control-group label {
    font-weight: 500;
    margin-right: 0.5rem;
    margin-bottom: 0; /* Align with Bootstrap form-label */
    min-width: 80px; /* Ensure labels align nicely */
}

.video-modal-control-group input[type="number"],
.video-modal-control-group select,
.video-modal-control-group .btn {
    font-size: 0.9rem;
    padding: 0.375rem 0.75rem;
}

.video-modal-control-group input[type="number"] {
    width: 70px;
    text-align: center;
}

#video-modal-reps-target {
    max-width: 80px;
}

#video-modal-speed-select {
    min-width: 100px;
}

#video-modal-current-reps {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--link-color);
    min-width: 50px; /* Space for "10 / 10" */
    text-align: right;
}
body.dark-theme #video-modal-current-reps {
    color: var(--link-hover-color);
}

.video-modal-buttons .btn {
    margin-right: 0.5rem;
}
.video-modal-buttons .btn:last-child {
    margin-right: 0;
}

#video-modal-status {
    font-style: italic;
    color: var(--secondary-text-color);
    margin-top: 0.5rem;
    font-size: 0.9em;
    min-height: 1.2em; /* Prevent layout shift */
}

.video-modal-buttons > div {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping to new line */
    align-items: center; /* Align items vertically */
    gap: 0.25rem; /* Smaller gap for tighter packing if needed */
}

.video-modal-buttons .btn {
    white-space: nowrap; /* Prevent text inside buttons from wrapping */
    flex-shrink: 0; /* Prevent buttons from shrinking too much */
    padding-left: 0.5rem; /* Adjust padding for smaller screens if needed */
    padding-right: 0.5rem;
    font-size: 0.85rem; /* Slightly smaller font for buttons on mobile */
}

@media (max-width: 400px) { /* Even more aggressive for very small screens */
    .video-modal-buttons .btn {
        font-size: 0.75rem;
        padding-left: 0.3rem;
        padding-right: 0.3rem;
    }
     .video-modal-buttons .btn i {
        margin-right: 0.15rem !important; /* Reduce icon margin */
    }
}