* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start; /* Allow columns to have different heights */
    min-height: 600px;
}

/* Left Column - Workout Builder */
.workout-column {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-width: 420px;
    height: auto; /* Use natural content height to keep buttons visible */
    display: flex;
    flex-direction: column;
}

.workout-column h2 {
    color: #4a5568;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
}

.drop-zone {
    min-height: 0;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    min-width: 370px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.drop-zone.drag-over {
    border-color: #0b7fd2;
    background-color: #f7fafc;
}

.placeholder {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    margin: 0;
    padding: 40px 20px;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    background: #f9fafb;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.workout-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: auto;
    padding-top: 20px;
    flex-shrink: 0;
}

.workout-controls .btn {
    flex: 1;
    min-width: 120px;
}

/* Audio Controls */
.audio-controls {
    margin-top: 15px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.audio-toggle {
    margin-bottom: 10px;
}

.audio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4a5568;
}

.audio-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.audio-icon {
    font-size: 1.2rem;
}

.audio-volume {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.audio-volume label {
    font-size: 0.85rem;
    color: #64748b;
    min-width: 50px;
}

.audio-volume input[type="range"] {
    flex: 1;
    min-width: 100px;
    max-width: 150px;
}

.audio-test-buttons {
    display: flex;
    gap: 5px;
}

.audio-test-buttons .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    min-width: auto;
}

.audio-controls.disabled .audio-volume {
    opacity: 0.5;
    pointer-events: none;
}

/* Right Column - Exercise Library */
.exercise-column {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 100%;
    min-width: 380px; /* Match custom exercise cards minimum width */
    overflow: hidden;
    height: 100%; /* Match workout column height */
    display: flex;
    flex-direction: column;
}

.exercise-column h2 {
    color: #4a5568;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
}

/* Category Header */
.category-header {
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Force scrollbar to always show on mobile */
    -webkit-overflow-scrolling: touch;
}

.category-list::-webkit-scrollbar {
    height: 4px;
}

.category-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.category-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.category-btn {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
    min-width: fit-content;
    flex-shrink: 0;
}

.category-btn:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.category-btn.active {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(11, 127, 210, 0.3);
}

.exercise-list {
    overflow-y: auto; /* Show scrollbar when needed */
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 15px;
    background: #f9f9f9;
    transition: all 0.3s ease;
    min-height: 300px; /* Minimum height to ensure space for exercises */
    /* Height will be set dynamically by JavaScript */
}

.exercise-list::-webkit-scrollbar {
    width: 8px;
}

.exercise-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.exercise-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.exercise-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Exercise Library Tabs */
.exercise-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #718096;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.tab-button:hover {
    color: #0b7fd2;
    background: rgba(11, 127, 210, 0.05);
}

.tab-button.active {
    color: #0b7fd2;
    border-bottom-color: #0b7fd2;
    background: rgba(11, 127, 210, 0.1);
}

/* Custom Exercises Tab - Special styling only when active */
#custom-tab.active {
    background: rgba(11, 127, 210, 0.15); /* Slightly darker blue when active */
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    flex: 1; /* Take remaining vertical space */
    overflow: hidden; /* Prevent content from overflowing */
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

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

/* Custom Exercise Builder Placeholder */
.custom-exercise-builder {
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    border: 2px dashed #cbd5e0;
}

.tab-placeholder {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 15px;
}

.tab-description {
    color: #718096;
    margin-bottom: 20px;
    font-size: 1rem;
}

.feature-list {
    text-align: left;
    max-width: 300px;
    margin: 0 auto;
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.6;
}

.feature-list li {
    margin-bottom: 8px;
}

/* Exercise Blocks */
.exercise-block {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-height: 70px;
}

.exercise-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.exercise-block:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.exercise-block.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.exercise-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    width: 80px;
}

.exercise-icon svg {
    width: 100%;
    height: 100%;
    max-width: 80px;
    max-height: 60px;
    color: white;
    filter: drop-shadow(1px 1px 3px rgba(0,0,0,0.4));
}

.exercise-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.exercise-name {
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.3;
    color: white;
}

.exercise-name-input {
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.3;
    color: #2d3748;
    background: white;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    padding: 6px 10px;
    width: 100%;
    max-width: 200px;
    cursor: text;
    user-select: text;
}

.exercise-name-input:focus {
    outline: none;
    border-color: #0b7fd2;
    box-shadow: 0 0 0 3px rgba(11, 127, 210, 0.1);
    background: #f8fafc;
}

.exercise-duration {
    background: rgba(255,255,255,0.25);
    color: white;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 500;
    width: fit-content;
}

/* Workout Items */
.workout-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    display: block;
    transition: all 0.3s ease;
    color: #091a37;
    min-width: 370px;
}

.workout-item:hover {
    border-color: #0b7fd2;
}

.workout-item.active {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    border-color: #0b7fd2;
}

.workout-item .exercise-name {
    color: #091a37;
    font-weight: 600;
    font-size: 1.1rem;
}

.workout-item .exercise-duration {
    color: #091a37;
    background: rgba(9, 26, 55, 0.1);
    font-size: 0.85rem;
    font-weight: 500;
}

.workout-item.active .exercise-name {
    color: white;
}

.workout-item.active .exercise-duration {
    color: white;
    background: rgba(255,255,255,0.25);
}

.exercise-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.tracking-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.tracking-btn {
    width: 80px;
    padding: 6px 8px;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    background: white;
    color: #4a5568;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tracking-btn:hover {
    border-color: #0b7fd2;
    background: #f7fafc;
}

.tracking-btn.active {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    border-color: #0b7fd2;
    box-shadow: 0 2px 8px rgba(11, 127, 210, 0.3);
}

.tracking-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #4a5568;
    flex-shrink: 0;
}

.unit {
    font-weight: 500;
    color: #718096;
}

.duration-input, .reps-input {
    width: 70px;
    height: 60px;
    padding: 8px 10px;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    background: white;
    color: #2d3748;
}

.duration-input:focus, .reps-input:focus {
    outline: none;
    border-color: #0b7fd2;
    box-shadow: 0 0 0 3px rgba(11, 127, 210, 0.1);
}

/* Custom Exercise Cards */
.custom-exercise-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    min-width: 380px; /* Prevent content overflow to adjacent areas */
}

/* Custom Exercise Card (the "Custom Exercise" button) - matches custom exercises in workout */
.custom-exercise-card:first-child {
    background: rgba(11, 127, 210, 0.1); /* Same light blue as custom exercises in workout */
    border-color: #0b7fd2;
}

.custom-exercise-card:hover {
    border-color: #0b7fd2;
    box-shadow: 0 4px 12px rgba(11, 127, 210, 0.15);
    transform: translateY(-2px);
}

.pause-rest-card {
    border-color: #68d391;
    background: linear-gradient(135deg, #f0fff4 0%, #fafffe 100%);
}

.pause-rest-card:hover {
    border-color: #48bb78;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.2);
}

.coming-soon-card {
    border-color: #fbd38d;
    background: linear-gradient(135deg, #fffbf0 0%, #fffffe 100%);
    opacity: 0.8;
}

.custom-exercise-card h4 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
}

.exercise-description {
    margin: 0 0 16px 0;
    color: #718096;
    font-size: 0.9rem;
}

.custom-input-group {
    margin-bottom: 16px;
}

.custom-input-group label {
    display: block;
    margin-bottom: 6px;
    color: #4a5568;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: left; /* Ensure all labels are left-aligned for uniformity */
}

.add-pause-btn {
    background: linear-gradient(135deg, #48bb78 0%, #68d391 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.add-pause-btn:hover {
    background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(72, 187, 120, 0.3);
}

/* Pause Exercise Styling in Workout */
.workout-item.pause-exercise {
    background: linear-gradient(135deg, #f0fff4 0%, #fafffe 100%);
    border-left: 4px solid #48bb78;
}

/* Custom Exercise Styling in Workout */
.workout-item.custom-exercise {
    background: rgba(11, 127, 210, 0.1); /* Same light blue as active tab */
    border-left: 4px solid #0b7fd2;
}

.pause-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pause-name {
    color: #2f855a;
    font-weight: 600;
    font-size: 1rem;
}

.pause-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pause-controls .tracking-value {
    margin: 0;
}

/* Combined Exercise Styling */
.combined-exercise-card {
    border-color: #9f7aea;
    background: linear-gradient(135deg, #faf5ff 0%, #fffffe 100%);
}

.combined-exercise-card:hover {
    border-color: #805ad5;
    box-shadow: 0 4px 12px rgba(128, 90, 213, 0.2);
}

.combined-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row.quarter-layout {
    grid-template-columns: 1fr 3fr;
}

.half-width {
    margin-bottom: 0;
}

.quarter-width {
    margin-bottom: 0;
}

.three-quarter-width {
    margin-bottom: 0;
}

/* Mobile responsive: stack quarter-layout vertically on small screens */
@media (max-width: 768px) {
    .form-row.quarter-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .quarter-width,
    .three-quarter-width {
        width: 100%;
    }
    
    /* Allow cards to be smaller on mobile */
    .custom-exercise-card {
        min-width: 280px;
    }
}

.text-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #9f7aea;
    box-shadow: 0 0 0 3px rgba(159, 122, 234, 0.1);
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-unit .duration-input {
    flex: 1;
    min-width: 60px;
}

.input-with-unit .unit {
    color: #718096;
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 35px;
}

.exercise-preview {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    font-size: 0.9rem;
    color: #4a5568;
}

.exercise-preview strong {
    color: #2d3748;
}

.add-combined-btn {
    background: linear-gradient(135deg, #9f7aea 0%, #b794f6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.add-combined-btn:hover {
    background: linear-gradient(135deg, #805ad5 0%, #9f7aea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(159, 122, 234, 0.3);
}

/* Combined Exercise Styling in Workout */
.workout-item.combined-exercise {
    background: linear-gradient(135deg, #faf5ff 0%, #fffffe 100%);
    border-left: 4px solid #9f7aea;
}

.combined-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.combined-name {
    color: #6b46c1;
    font-weight: 600;
    font-size: 1rem;
}

.combined-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cycle-info {
    color: #6b46c1;
    font-size: 0.85rem;
    font-weight: 500;
}

.total-time {
    color: #9ca3af;
    font-size: 0.8rem;
    font-style: italic;
}

/* Group Header Styling */
.group-header {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    border: 2px solid #9f7aea;
    border-radius: 8px;
    margin: 12px 0 4px 0;
    padding: 12px;
    position: relative;
    cursor: move;
    cursor: grab;
    transition: all 0.2s ease;
    min-width: 370px;
}

.group-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 56, 235, 0.2);
}

.group-header:active {
    cursor: grabbing;
}

.group-header-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
}

/* Group content area - takes up remaining space */
.group-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    flex: 1 !important;
    order: 2 !important;
    justify-content: space-between !important;
}

/* Group title section - left column with two lines */
.group-title-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.group-title-line {
    font-weight: 600;
    color: #6b46c1;
    font-size: 0.95rem;
    line-height: 1.2;
}

/* Group controls section - right column with buttons */
.group-controls-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Group header row - title only */
.group-header-row {
    display: flex;
    align-items: center;
}

/* Group controls row - toggle and remove buttons */
.group-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-title {
    font-weight: 600;
    color: #6b46c1;
    font-size: 0.95rem;
}

.group-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-toggle-btn {
    background: transparent;
    border: 1px solid #9f7aea;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: #6b46c1;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.group-toggle-btn:hover {
    background: #9f7aea;
    color: white;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.group-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.group-remove-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.group-remove-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
}

.group-move-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
    order: 1 !important;
}

.group-move-btn {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    min-height: 36px;
    text-align: center;
}

.group-move-btn:hover {
    background: linear-gradient(135deg, #553c9a 0%, #4c1d95 100%);
    transform: translateY(-1px);
}

/* Grouped Exercise Styling */
.grouped-exercise {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-left: 4px solid #9f7aea;
    margin: 2px 0;
    position: relative;
}

.grouped-exercise::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #9f7aea, #b794f6);
}

.grouped-exercise.collapsed {
    display: none;
}

/* Make grouped pause exercises more distinguishable */
.grouped-exercise.pause-exercise {
    background: linear-gradient(135deg, #f0fff4 0%, #e6ffed 100%);
    border-left: 4px solid #48bb78;
}

.grouped-exercise.pause-exercise::before {
    background: linear-gradient(to bottom, #48bb78, #68d391);
}

/* Add position indicators for grouped exercises */
.grouped-exercise .exercise-name::after {
    content: attr(data-position);
    font-size: 0.7rem;
    color: #6b7280;
    margin-left: 8px;
    opacity: 0.7;
}

/* Exercise Move Controls - removed old conflicting rule */

.move-btn {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    min-height: 36px;
    text-align: center;
}

.move-btn:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateY(-1px);
}

/* Update exercise info layout to accommodate new structure */
.exercise-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
}

.pause-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
}

/* Move controls styling - larger and on the left */
.exercise-move-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
    order: 1 !important;
}

/* Exercise content area - takes up remaining space */
.exercise-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    flex: 1 !important;
    order: 2 !important;
}

/* Exercise header - name only */
.exercise-header {
    display: flex;
    align-items: center;
}

/* Exercise controls row - all controls on one line */
.exercise-controls-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Adjust exercise controls for horizontal layout */
.exercise-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* Drag and Drop Styling */
.workout-item[draggable="true"] {
    cursor: move;
}

.workout-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.workout-item.drag-over-top {
    border-top: 3px solid #0b7fd2;
    margin-top: 3px;
}

.workout-item.drag-over-bottom {
    border-bottom: 3px solid #0b7fd2;
    margin-bottom: 3px;
}

/* Group Drop Zones */
.group-drop-zone {
    height: 25px;
    margin: 5px 0;
    border: 2px dashed #7c3aed;
    border-radius: 5px;
    transition: all 0.2s ease;
    background: rgba(123, 56, 235, 0.15);
    position: relative;
    cursor: pointer;
    min-height: 25px;
    min-width: 370px;
}

.group-drop-zone:before {
    content: '↓ Drag exercises here to reorder ↓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: #7c3aed;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.group-drop-zone.drag-over-bottom,
.group-drop-zone.drag-over-top {
    border-color: #7c3aed;
    background: rgba(123, 56, 235, 0.2);
    height: 30px;
}

.group-drop-zone.drag-over-bottom:before,
.group-drop-zone.drag-over-top:before {
    opacity: 1;
}

.group-header.dragging {
    opacity: 0.6;
    transform: rotate(1deg);
    box-shadow: 0 5px 15px rgba(123, 56, 235, 0.3);
}

/* Force spinners to always be visible and larger */
.duration-input::-webkit-outer-spin-button,
.duration-input::-webkit-inner-spin-button,
.reps-input::-webkit-outer-spin-button,
.reps-input::-webkit-inner-spin-button {
    opacity: 1 !important;
    height: 40px;
    width: 20px;
    cursor: pointer;
}

.workout-item.active .tracking-btn {
    background: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.5);
    color: #4a5568;
}

.workout-item.active .tracking-btn.active {
    background: rgba(255,255,255,1);
    border-color: rgba(255,255,255,0.8);
    color: #0b7fd2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.workout-item.active .duration-input, 
.workout-item.active .reps-input {
    background: rgba(255,255,255,0.95);
    border-color: rgba(255,255,255,0.6);
    color: #2d3748;
}

.workout-item.active .tracking-value {
    color: rgba(255,255,255,0.9);
}

.workout-item.active .unit {
    color: rgba(255,255,255,0.8);
}

.remove-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.remove-btn:hover {
    background: #c53030;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(11, 127, 210, 0.4);
}

.btn-primary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
    transform: translateY(-2px);
}

/* Timer Display */
.timer-display {
    background: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.timer-display.hidden {
    display: none;
}

.timer-content {
    position: relative;
    padding-top: 80px; /* Reserve space for previous exercise */
}

.timer-content h3 {
    color: #4a5568;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

#timer {
    font-size: 4rem;
    font-weight: bold;
    color: white;
    text-shadow: 4px 0 0 black, -4px 0 0 black, 0 4px 0 black, 0 -4px 0 black, 3px 3px 0 black, -3px -3px 0 black, 3px -3px 0 black,  -3px 3px 0 black;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.timer-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Timer Audio Controls - Compact version for timer screen */
.timer-audio-controls {
    margin-top: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.audio-controls-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.audio-toggle-compact {
    display: flex;
    align-items: center;
}

.audio-label-compact {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.audio-label-compact input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.audio-volume-compact {
    display: flex;
    align-items: center;
}

.audio-volume-compact input[type="range"] {
    width: 120px;
}

/* Hide main sections when timer is active */
body.timer-active .audio-controls-section,
body.timer-active .workout-library-section-container {
    display: none;
}

/* Exercise Display Layout */
.exercise-display {
    margin: 15px 0;
    padding: 20px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.exercise-display .exercise-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.exercise-display .exercise-status {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Current Exercise - Prominent in center */
.current-exercise {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(11, 127, 210, 0.3);
    position: relative;
    z-index: 2;
}

.current-exercise .exercise-name {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.current-exercise .timer {
    font-size: 4rem;
    font-weight: bold;
    color: white;
    text-shadow: 6px 6px 0 black, -6px -6px 0 black, 6px -6px 0 black, -6px 6px 0 black;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
}

.current-exercise .exercise-status {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Previous Exercise - Positioned absolutely to prevent layout jumps */
.previous-exercise {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scale(0.85);
    background: #f7fafc;
    color: #2d3748;
    opacity: 0.9;
    width: calc(100% - 40px);
    z-index: 0;
}

.previous-exercise .exercise-name {
    font-size: 1.2rem;
    color: #4a5568;
}

.previous-exercise .exercise-status {
    font-size: 0.8rem;
    color: #2d3748;
}

/* Next Exercise - Smaller and subtle, overlapping current */
.next-exercise {
    background: #f7fafc;
    color: #2d3748;
    opacity: 0.9;
    transform: scale(0.85);
    border: 2px solid #e2e8f0;
    margin-top: -20px;
    position: relative;
    z-index: 3;
}

.next-exercise .exercise-name {
    font-size: 1.2rem;
    color: #4a5568;
}

.next-exercise .exercise-status {
    font-size: 0.8rem;
    color: #2d3748;
}

/* Responsive Design */
/* Audio Controls Section Container */
.audio-controls-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Workout Library Section Container */
.workout-library-section-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .main-content {
        display: flex;
        flex-direction: column;
        gap: 20px;
        min-height: auto;
    }
    
    .workout-column {
        order: 1;
        padding: 20px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        height: auto;
    }
    
    .exercise-column {
        order: 2; /* Exercise library comes right after workout controls */
        padding: 15px;
        height: auto;
        width: 100%;
        max-width: 100%;
        min-width: 280px; /* Match mobile minimum width for cards */
        box-sizing: border-box;
    }
    
    .audio-controls-section {
        order: 3; /* Audio controls after exercise library */
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .workout-library-section-container {
        order: 4; /* Saved workouts at the bottom */
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure all content inside columns respects the container width */
    .workout-column *,
    .exercise-column * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .logo {
        max-width: 250px;
        margin-bottom: 8px;
    }
    
    .category-list {
        gap: 6px;
        padding: 8px 3px;
    }
    
    .category-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
        border-radius: 14px;
    }
    
    .exercise-list {
        max-height: 250px;
    }
    
    .drop-zone {
        min-height: 250px;
    }
    
    #timer {
        font-size: 3rem;
    }
    
    .timer-controls {
        flex-wrap: wrap;
    }
    
    .workout-controls {
        flex-direction: column;
    }

    .audio-controls {
        margin-top: 10px;
        padding: 10px;
    }

    .audio-volume {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .audio-test-buttons {
        justify-content: center;
    }
    
    .exercise-block {
        padding: 14px 16px;
        margin-bottom: 10px;
        gap: 12px;
        min-height: 60px;
    }
    
    .exercise-icon {
        height: 50px;
        width: 70px;
    }
    
    .exercise-icon svg {
        max-width: 70px;
        max-height: 50px;
    }
    
    .exercise-name {
        font-size: 1rem;
    }
    
    .exercise-duration {
        font-size: 0.8rem;
        padding: 3px 8px;
    }
    
    .workout-item .exercise-name {
        color: #091a37;
        font-size: 1rem;
    }
    
    .workout-item .exercise-duration {
        color: #091a37;
        font-size: 0.8rem;
        padding: 3px 8px;
    }
    
    .workout-item.active .exercise-name {
        color: white;
    }
    
    .workout-item.active .exercise-duration {
        color: white;
    }
    
    .exercise-controls {
        gap: 10px;
        margin-top: 6px;
    }
    
    .tracking-buttons {
        gap: 6px;
    }
    
    .tracking-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
        letter-spacing: 0.3px;
    }
    
    .tracking-value {
        font-size: 0.85rem;
        gap: 6px;
    }
    
    .duration-input, .reps-input {
        width: 90px;
        height: 50px;
        padding: 12px 8px;
        font-size: 1.6rem;
    }
    
    /* Mobile spinner styling */
    .duration-input::-webkit-outer-spin-button,
    .duration-input::-webkit-inner-spin-button,
    .reps-input::-webkit-outer-spin-button,
    .reps-input::-webkit-inner-spin-button {
        height: 35px;
        width: 18px;
    }
}

/* Animation for adding items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.workout-item {
    animation: slideIn 0.3s ease;
}



/* ==================== AUTHENTICATION STYLES ==================== */

/* Header with logo and auth */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 2px solid #e2e8f0;
}

.logo-container {
    flex: 0 0 auto;
}

.logo {
    height: 60px;
    width: auto;
}

.auth-section {
    flex: 0 0 auto;
    text-align: right;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-info {
    display: flex;
    gap: 15px;
    align-items: center;
    color: #4a5568;
    font-weight: 500;
}

.guest-message {
    margin-top: 5px;
    color: #718096;
    font-size: 0.9rem;
}

/* Authentication Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 15px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5rem;
}

.close-modal {
    font-size: 28px;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #4a5568;
}

.auth-form {
    padding: 20px 30px 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: #0b7fd2;
    box-shadow: 0 0 0 3px rgba(11, 127, 210, 0.1);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #718096;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.form-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Responsive design for auth */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .auth-section {
        text-align: center;
    }
    
    .auth-buttons {
        justify-content: center;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .auth-form {
        padding: 15px 20px 25px;
    }
    
    .modal-header {
        padding: 20px 20px 10px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ==================== WORKOUT LIBRARY STYLES ==================== */

.workout-library-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.library-header h3 {
    margin: 0;
    color: #4a5568;
    font-size: 1.2rem;
}

.btn-outline {
    background: transparent;
    color: #0b7fd2;
    border: 2px solid #0b7fd2;
}

.btn-outline:hover {
    background: #0b7fd2;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    margin-right: 10px;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(34, 197, 94, 0.4);
}

.workout-status {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    text-align: center;
}

.workout-status.guest {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.workout-status.premium {
    background: #f3e8ff;
    color: #7c3aed;
    border: 1px solid #a855f7;
}

.workout-status.limit-reached {
    background: #fecaca;
    color: #dc2626;
    border: 1px solid #f87171;
}

.saved-workout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.saved-workout-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Disabled workout items for expired subscriptions */
.saved-workout-item.workout-disabled {
    opacity: 0.5;
    background: #f3f4f6;
    border-color: #d1d5db;
    cursor: not-allowed;
}

.saved-workout-item.workout-disabled:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.saved-workout-item.workout-disabled .workout-name {
    color: #9ca3af !important;
}

.saved-workout-item.workout-disabled .workout-details {
    color: #9ca3af !important;
}

.saved-workout-item.workout-disabled .premium-required {
    color: #dc2626;
    font-weight: 500;
}

.saved-workout-item.workout-disabled .load-workout-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
}

.saved-workout-item.workout-disabled .load-workout-btn:disabled:hover {
    background: #e5e7eb;
    color: #9ca3af;
    border-color: #d1d5db;
}

.saved-workout-item.workout-disabled .delete-workout-btn:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
}

.saved-workout-item.workout-disabled .delete-workout-btn:disabled:hover {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #d1d5db;
}

.workout-info h4 {
    margin: 0 0 5px 0;
    color: #2d3748;
    font-size: 1rem;
}

.workout-details {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
}

.workout-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.no-workouts {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 20px;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.auth-buttons .btn {
    min-width: 100px;
}

/* Upgrade Modal Styles */
.upgrade-content {
    text-align: center;
    padding: 20px 0;
}

.upgrade-benefits {
    margin-bottom: 25px;
}

.upgrade-benefits h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.upgrade-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.upgrade-benefits li {
    padding: 8px 0;
    color: #4a5568;
    font-size: 0.95rem;
}

.upgrade-pricing {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.price-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
}

.price {
    font-size: 2.5rem;
    font-weight: bold;
}

.period {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Loaded Workout Header Styles */
.loaded-workout-header {
    background: linear-gradient(135deg, #0b7fd2 0%, #1a8ae6 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(11, 127, 210, 0.3);
}

.loaded-workout-name {
    margin: 0 0 5px 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.loaded-workout-info {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .saved-workout-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .workout-actions {
        justify-content: space-between;
    }
    
    .library-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .workout-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .workout-controls .btn {
        width: 100%;
        min-width: 120px;
    }
    
    .loaded-workout-header {
        padding: 12px 15px;
    }
    
    .loaded-workout-name {
        font-size: 1.1rem;
    }
}