* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #ffffff;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overscroll-behavior: none; /* Prevent pull-to-refresh */
    -webkit-overflow-scrolling: touch;
}

/* Animated background gradients */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(0, 255, 255, 0.3), transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 0, 102, 0.2), transparent 50%),
                radial-gradient(circle at 40% 20%, rgba(255, 204, 0, 0.2), transparent 50%);
    z-index: -1;
    animation: rotate 20s linear infinite;
}

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

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
}

.header h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    margin-bottom: 20px;
}

.header-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.header-btn {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-decoration: none;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.5);
    color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.main-content {
    flex: 1;
    padding: 0 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.quick-add-section {
    margin-bottom: 30px;
}

.quick-add-button {
    width: 100%;
    background: rgba(52, 199, 89, 0.2);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(52, 199, 89, 0.5);
    border-radius: 24px;
    padding: 20px;
    color: #34c759;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.quick-add-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #34c759, transparent);
    animation: slide 3s infinite;
}

@keyframes slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.quick-add-button:hover {
    background: rgba(52, 199, 89, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(52, 199, 89, 0.4);
}

.quick-add-button.hidden {
    display: none;
}

.category-filters {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.category-filter {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.category-filter.active {
    background: rgba(0, 255, 255, 0.2);
    border-color: rgba(0, 255, 255, 0.5);
    color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.category-filter:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

/* Search Section */
.search-section {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 14px 20px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.exercises-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 40px;
}

.exercise-tile {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 25px 15px;
    position: relative;
    height: auto;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    text-align: center;
}

.exercise-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
    animation: slide 3s infinite;
}

.exercise-tile:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    border-color: #00ffff;
    box-shadow: 0 20px 40px rgba(0, 255, 255, 0.3);
}

.exercise-tile.add-new {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
}

.exercise-tile.add-new::before {
    background: linear-gradient(90deg, transparent, #00ffff, transparent);
}

.exercise-tile.add-new:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ffff;
}

.exercise-name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.exercise-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 255, 255, 0.3);
    color: #00ffff;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

.exercise-badge.reps-only {
    background: rgba(52, 199, 89, 0.3);
    color: #34c759;
}

.exercise-badge.timed {
    background: rgba(255, 149, 0, 0.3);
    color: #ff9500;
}

.exercise-badge.run {
    background: rgba(88, 86, 214, 0.3);
    color: #5856d6;
}

.add-icon {
    font-size: 1.5rem;
    color: #00ffff;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    margin-bottom: 4px;
}

.history-section {
    margin-top: 40px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.history-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
}

.workout-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.workout-group:last-child {
    border-bottom: none;
}

.workout-group-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
}

.workout-group-header:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #00ffff;
}

.workout-item {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workout-item:last-child {
    border-bottom: none;
}

.workout-info {
    flex: 1;
}

.workout-exercise {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pr-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    animation: prPulse 2s ease-in-out;
}

.pr-badge.twm {
    background: linear-gradient(135deg, #ff9500, #ffcc00);
}

.pr-badge.run-pr {
    background: linear-gradient(135deg, #5856d6, #6e6ee8);
    color: #fff;
}

@keyframes prPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.workout-details {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.workout-datetime {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

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

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 12px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #00ffff;
    border-color: #00ffff;
}

.action-btn.delete {
    border-color: rgba(255, 0, 102, 0.5);
    color: #ff0066;
}

.action-btn.delete:hover {
    background: rgba(255, 0, 102, 0.2);
    border-color: #ff0066;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.6);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-content {
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    margin: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.modal-btn {
    background: none;
    border: none;
    color: #00ffff;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    color: rgba(0, 255, 255, 0.7);
}

.modal-btn.cancel {
    color: #ff0066;
}

.modal-btn.cancel:hover {
    color: rgba(255, 0, 102, 0.7);
}

.modal-body {
    padding: 20px;
}

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

.input-label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 12px;
}

.toggle-option {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.toggle-option.active {
    background: rgba(0, 255, 255, 0.3);
    color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.sets-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
}

.sets-counter button {
    background: rgba(0, 255, 255, 0.3);
    border: none;
    border-radius: 8px;
    color: #00ffff;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sets-counter button:hover {
    background: rgba(0, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.sets-counter span {
    font-size: 1.1rem;
    font-weight: 600;
}

.plate-calculator {
    display: none;
}

.plate-calculator.active {
    display: block;
}

.bar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-switch {
    position: relative;
    width: 51px;
    height: 31px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 31px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: rgba(52, 199, 89, 0.5);
}

.toggle-switch-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active .toggle-switch-handle {
    transform: translateX(20px);
}

.plate-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.plate-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.plate-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #00ffff;
}

.plate-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #00ffff;
    color: #000;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.total-weight {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-bottom: 12px;
}

.total-weight-label {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 4px;
}

.total-weight-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #00ffff;
}

.clear-plates-button {
    width: 100%;
    background: rgba(255, 0, 102, 0.2);
    border: 1px solid rgba(255, 0, 102, 0.5);
    border-radius: 10px;
    color: #ff0066;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-plates-button:hover {
    background: rgba(255, 0, 102, 0.3);
    box-shadow: 0 0 15px rgba(255, 0, 102, 0.3);
}

.save-button {
    width: 100%;
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 12px;
    color: #00ffff;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.save-button:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
}

.warmup-suggestion {
    font-size: 0.9rem;
    color: rgba(255, 204, 0, 0.8);
    margin-top: 10px;
    text-align: center;
    padding: 8px;
    background: rgba(255, 204, 0, 0.1);
    border-radius: 8px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
}

.chart {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

.stats-grid {
    display: grid;
    gap: 16px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
}

.stat-exercise {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
}

.stat-exercise:hover {
    color: #00ffff;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: #ffd700;
}

.stat-value.twm {
    color: #ff9500;
}

.stat-value.run-stat {
    color: #5856d6;
}

/* Calendar Styles */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.calendar-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #00ffff;
    padding: 8px 16px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ffff;
}

.calendar-month {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-color.upper-body {
    background: rgba(0, 255, 255, 0.5);
}

.legend-color.lower-body {
    background: rgba(255, 149, 0, 0.5);
}

.legend-color.cardio {
    background: rgba(88, 86, 214, 0.5);
}

.legend-color.mixed {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.5), rgba(255, 149, 0, 0.5), rgba(88, 86, 214, 0.5));
}

.calendar-grid {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 16px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day.today {
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.calendar-day.has-workout {
    border-width: 2px;
}

.calendar-day.has-workout.upper {
    border-color: rgba(0, 255, 255, 0.8);
    background: rgba(0, 255, 255, 0.1);
}

.calendar-day.has-workout.lower {
    border-color: rgba(255, 149, 0, 0.8);
    background: rgba(255, 149, 0, 0.1);
}

.calendar-day.has-workout.cardio {
    border-color: rgba(88, 86, 214, 0.8);
    background: rgba(88, 86, 214, 0.1);
}

.calendar-day.has-workout.mixed {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
}

.calendar-day-number {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.calendar-day.has-workout .calendar-day-number {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
}

.calendar-day-dot {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    margin-top: 2px;
}

/* Workout Plans Styles */
.plans-container {
    display: grid;
    gap: 20px;
}

.plan-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.plan-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 255, 0.2);
}

.plan-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.plan-info {
    flex: 1;
}

.plan-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 8px;
}

.plan-summary {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 4px;
}

.plan-last-used {
    font-size: 0.85rem;
    color: rgba(0, 255, 255, 0.7);
    margin-top: 4px;
}

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

.plan-action-btn {
    background: rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 12px;
    color: #00ffff;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.plan-action-btn.start {
    background: rgba(52, 199, 89, 0.2);
    border-color: rgba(52, 199, 89, 0.5);
    color: #34c759;
}

.plan-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 255, 0.3);
}

.plan-action-btn.start:hover {
    background: rgba(52, 199, 89, 0.3);
    box-shadow: 0 8px 20px rgba(52, 199, 89, 0.3);
}

.plan-exercises {
    padding: 16px 20px;
}

.plan-exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.plan-exercise-item:last-child {
    border-bottom: none;
}

.plan-exercise-name {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.plan-exercise-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
}

.plan-exercise-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    padding-left: 0;
    opacity: 0.8;
}

.plan-footer {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.plan-footer-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 16px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.plan-footer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #00ffff;
    border-color: #00ffff;
}

.plan-footer-btn.delete {
    border-color: rgba(255, 0, 102, 0.5);
    color: #ff0066;
}

.plan-footer-btn.delete:hover {
    background: rgba(255, 0, 102, 0.2);
    border-color: #ff0066;
}

.plan-builder-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    min-height: 100px;
}

.plan-builder-item {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-builder-item:last-child {
    border-bottom: none;
}

.plan-builder-info {
    flex: 1;
}

.plan-builder-name {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}

.plan-builder-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

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

.plan-builder-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 12px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.plan-builder-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #00ffff;
    border-color: #00ffff;
}

.plan-builder-btn.delete {
    border-color: rgba(255, 0, 102, 0.5);
    color: #ff0066;
}

.plan-builder-btn.delete:hover {
    background: rgba(255, 0, 102, 0.2);
    border-color: #ff0066;
}

.add-exercise-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 10px;
    color: #00ffff;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-exercise-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.modal-content-large {
    max-width: 800px;
    margin: 20px auto;
}

.active-workout-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.active-workout-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.95);
}

.active-workout-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.active-workout-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.active-workout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #00ffff;
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.active-workout-btn.finish {
    background: rgba(52, 199, 89, 0.2);
    border-color: rgba(52, 199, 89, 0.5);
    color: #34c759;
}

.active-workout-btn.finish:hover {
    background: rgba(52, 199, 89, 0.3);
    border-color: #34c759;
    box-shadow: 0 0 15px rgba(52, 199, 89, 0.3);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #34c759);
    border-radius: 8px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.active-exercise-group {
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

.active-exercise-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.active-exercise-delete {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(255, 0, 102, 0.2);
    border: 1px solid rgba(255, 0, 102, 0.5);
    border-radius: 8px;
    padding: 6px 12px;
    color: #ff0066;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 36px;
}

.active-exercise-delete:hover {
    background: rgba(255, 0, 102, 0.3);
    border-color: #ff0066;
}

.active-add-set-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 8px;
    padding: 6px 14px;
    color: #00ffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 8px;
    display: inline-block;
    min-height: 36px;
}

.active-add-set-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.active-delete-set-btn {
    background: rgba(255, 0, 102, 0.2);
    border: 1px solid rgba(255, 0, 102, 0.5);
    border-radius: 6px;
    color: #ff0066;
    cursor: pointer;
    margin-left: 10px;
    padding: 2px 8px;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.active-delete-set-btn:hover {
    background: rgba(255, 0, 102, 0.3);
    border-color: #ff0066;
}

.active-add-exercise-section {
    margin: 20px 0;
    text-align: center;
}

.add-exercise-to-active-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 14px;
    padding: 16px 32px;
    color: #00ffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    display: inline-block;
    min-height: 50px;
}

.add-exercise-to-active-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.4);
}

.active-exercise-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
    padding-right: 80px;
}

.active-exercise-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    margin-top: 6px;
    padding-right: 80px;
}

.active-exercise-progress {
    font-size: 0.95rem;
    color: rgba(0, 255, 255, 0.8);
    font-weight: 600;
    margin-top: 8px;
}

.active-sets-container {
    padding: 12px;
}

.active-set-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.active-set-item:last-child {
    margin-bottom: 0;
}

.active-set-item.completed {
    background: rgba(52, 199, 89, 0.1);
    border-color: rgba(52, 199, 89, 0.3);
}

.active-set-item.editing {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.3);
}

.active-set-info {
    flex: 1;
}

.active-set-number {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}

.active-set-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.active-set-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.active-set-input {
    width: 85px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    color: white;
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 44px; /* iOS recommended touch target */
}

.active-set-input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
}

.active-set-unit {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.active-set-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.active-set-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 10px;
    color: #00ffff;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 90px;
    min-height: 44px; /* iOS recommended touch target */
    display: flex;
    align-items: center;
    justify-content: center;
}

.active-set-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.4);
}

.active-set-btn.adjust {
    background: rgba(255, 149, 0, 0.2);
    border-color: rgba(255, 149, 0, 0.5);
    color: #ff9500;
    min-width: 80px;
}

.active-set-btn.adjust:hover {
    background: rgba(255, 149, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.4);
}

.active-set-btn.adjust.active {
    background: rgba(255, 149, 0, 0.4);
    border-color: rgba(255, 149, 0, 0.7);
}

.active-set-btn.complete {
    min-width: 100px;
}

.active-set-btn.completed {
    background: rgba(52, 199, 89, 0.3);
    border-color: rgba(52, 199, 89, 0.6);
    color: #34c759;
}

.active-set-btn.completed:hover {
    background: rgba(52, 199, 89, 0.4);
    box-shadow: 0 4px 15px rgba(52, 199, 89, 0.4);
}

.active-workout-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
}

.workout-footer-btn {
    flex: 1;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.workout-footer-btn.cancel {
    background: rgba(255, 0, 102, 0.2);
    border: 1px solid rgba(255, 0, 102, 0.5);
    color: #ff0066;
}

.workout-footer-btn.cancel:hover {
    background: rgba(255, 0, 102, 0.3);
    box-shadow: 0 4px 15px rgba(255, 0, 102, 0.3);
}

.workout-footer-btn.finish {
    background: rgba(52, 199, 89, 0.2);
    border: 1px solid rgba(52, 199, 89, 0.5);
    color: #34c759;
}

.workout-footer-btn.finish:hover {
    background: rgba(52, 199, 89, 0.3);
    box-shadow: 0 4px 15px rgba(52, 199, 89, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }
    
    .exercises-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .exercise-tile {
        padding: 20px 12px;
        min-height: 70px;
    }
    
    .exercise-name {
        font-size: 0.9rem;
    }
    
    .modal {
        overscroll-behavior: contain; /* Prevent pull-to-refresh in modals */
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
        overscroll-behavior: contain;
    }
    
    .modal-content-large {
        margin: 10px;
        max-width: none;
        overscroll-behavior: contain;
    }
    
    .active-set-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .active-set-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .active-set-btn {
        flex: 1;
        min-width: 0;
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    .active-set-btn.adjust {
        min-width: 0;
    }
    
    .active-set-btn.complete {
        min-width: 0;
    }
    
    .active-set-input {
        width: 90px;
        font-size: 1.1rem;
        padding: 12px;
        min-height: 48px;
    }
    
    .active-set-inputs {
        gap: 10px;
    }
    
    .plan-action-btn {
        padding: 8px 14px;
        font-size: 0.9rem;
    }
    
    .calendar-day-number {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .exercise-tile {
        padding: 16px 10px;
        min-height: 65px;
    }
    
    .exercise-name {
        font-size: 0.85rem;
    }
    
    .add-icon {
        font-size: 1.2rem;
    }
    
    .active-set-input {
        width: 85px;
        font-size: 1.05rem;
    }
}

@keyframes celebrate {
    0%, 100% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% { 
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% { 
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

/* --- Exercise note styles --- */
.plan-exercise-note, .plan-builder-note {
  font-size: 0.85rem;
  color: #ccc;
  margin-top: 4px;
  opacity: 0.8;
}