/* Week calendar styles with theme support */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

/* Week calendar theme variables */
:root {
  --week-header-bg: #ffffff;
  --week-header-text: #0D324D;
  --week-nav-button-bg: #CDCDCD;
  --week-nav-button-text: #0D324D;
  --week-nav-button-hover: #9DA2AB;
  --week-grid-bg: #ffffff;
  --week-border: #CDCDCD;
  --day-header-bg: transparent;
  --day-header-border: #CDCDCD;
  --day-name-color: #9DA2AB;
  --day-date-color: #0D324D;
  --day-content-bg: transparent;
  --card-border: #CDCDCD;
  --card-shadow: rgba(0,0,0,0.1);
  --card-body-text: #0D324D;
}

[data-theme="dark"] {
  --week-header-bg: #0D324D;
  --week-header-text: #ffffff;
  --week-nav-button-bg: #1a3a52;
  --week-nav-button-text: #ffffff;
  --week-nav-button-hover: #2a4a62;
  --week-grid-bg: #0D324D;
  --week-border: #1a3a52;
  --day-header-bg: transparent;
  --day-header-border: #1a3a52;
  --day-name-color: #9DA2AB;
  --day-date-color: #ffffff;
  --day-content-bg: transparent;
  --card-border: #1a3a52;
  --card-shadow: rgba(0,0,0,0.3);
  --card-body-text: #ffffff;
}

html, body, .week-calendar {
  font-family: 'Open Sans', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

p {
  font-family: 'Open Sans';
}

.wrapper {
  margin-right: 20px;
  margin-left: 20px;
  padding-right: 30px;
  padding-left: 30px;
  max-width: none;
}

.week-calendar {
  width: calc(100% - 2rem);
  margin: 1rem;
  padding: 0;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.week-summary {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
}

.week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--week-header-bg);
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

/* Week Summary Styles */
.week-summary {
  background: var(--week-header-bg);
  border-top: 1px solid var(--week-border);
  padding: 1.5rem 2rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.summary-header {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.summary-header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.progress-basis-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--week-border);
  flex-shrink: 0;
}

.progress-basis-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--day-name-color);
  padding: 0 0.35rem 0 0.5rem;
  white-space: nowrap;
}

.basis-toggle-btn {
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: var(--week-nav-button-bg);
  color: var(--week-nav-button-text);
  transition: background-color 0.2s ease, color 0.2s ease;
  font-family: inherit;
}

.basis-toggle-btn + .basis-toggle-btn {
  border-left: 1px solid var(--week-border);
}

.basis-toggle-btn:hover:not(.is-active) {
  background: var(--week-nav-button-hover);
}

.basis-toggle-btn.is-active {
  background: var(--primary-color);
  color: #fff;
}

.summary-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--week-header-text);
  margin: 0;
  transition: color 0.3s ease;
}

.summary-phase {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
}

.summary-phase-base {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.summary-phase-build {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.summary-phase-peak {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.summary-phase-taper {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.summary-phase-rest {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.summary-phase-recovery {
  background: linear-gradient(135deg, #f032d4 0%, #f032d4 100%);
}

.summary-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.summary-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--week-grid-bg);
  border-radius: 8px;
  border: 1px solid var(--week-border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  flex: 1;
  min-width: 150px;
  min-height: 148px;
  box-sizing: border-box;
}

.summary-item i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.summary-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

.summary-item-content {
  flex: 1;
}

.summary-item-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--day-name-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
  transition: color 0.3s ease;
}

.summary-item-planned,
.summary-item-done {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--day-date-color);
  line-height: 1.35;
  transition: color 0.3s ease;
}

.summary-item-done {
  margin-top: 0.2rem;
}

.summary-item-k {
  font-weight: 700;
  color: var(--day-name-color);
  margin-right: 0.25rem;
}

.summary-item-progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
  min-height: 28px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.summary-progress-track {
  flex: 1 1 0;
  min-width: 48px;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  overflow: hidden;
  position: relative;
}

.summary-progress-track--placeholder {
  background: rgba(148, 163, 184, 0.2);
}

.summary-progress-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 999px;
  transition: width 0.35s ease;
  box-sizing: border-box;
}

.summary-progress-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--day-name-color);
  min-width: 2.75rem;
  text-align: right;
  flex-shrink: 0;
}

.summary-progress-pct--placeholder {
  visibility: hidden;
}

.summary-item-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--day-date-color);
  transition: color 0.3s ease;
}

/* Activity-specific colors for summary items */
.summary-item.summary-run i {
  color: #ef4444;
}

.summary-item.summary-walk i {
  color: #eab308;
}

.summary-item.summary-cycle i {
  color: #22c55e;
}

.summary-item.summary-swim i {
  color: #3b82f6;
}

.summary-item.summary-openwater i {
  color: #06b6d4;
}

.summary-item.summary-workout i,
.summary-item.summary-strength i {
  color: #f97316;
}

.summary-item.summary-stretching i,
.summary-item.summary-yoga i {
  color: #a855f7;
}

.summary-total {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 1.25rem;
  background: var(--week-grid-bg);
  border-radius: 8px;
  border: 2px solid var(--week-border);
  margin-top: 0.5rem;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  min-height: 120px;
  box-sizing: border-box;
  gap: 0.65rem;
}

.summary-total-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
}

.summary-total-body {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.summary-total-sub {
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.summary-total-progress-row {
  margin-top: 0;
  padding-top: 0;
  min-height: 28px;
  width: 100%;
  min-width: 0;
}

.summary-total .summary-progress-fill {
  background-color: #ffffff !important;
}

.summary-total-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.summary-total-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  color: #ffffff;
}

.summary-total-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--week-header-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

.week-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--week-header-text);
  margin: 0;
  transition: color 0.3s ease;
}

.week-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.distance-unit-toggle {
  display: inline-flex;
  align-items: stretch;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--week-border);
  flex-shrink: 0;
}

.unit-toggle-btn {
  margin: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: var(--week-nav-button-bg);
  color: var(--week-nav-button-text);
  transition: background-color 0.2s ease, color 0.2s ease;
  font-family: inherit;
}

.unit-toggle-btn + .unit-toggle-btn {
  border-left: 1px solid var(--week-border);
}

.unit-toggle-btn:hover:not(.is-active) {
  background: var(--week-nav-button-hover);
}

.unit-toggle-btn.is-active {
  background: var(--primary-color);
  color: #fff;
}

.week-header-right .week-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.week-header-right .week-nav button {
  margin-left: 0;
}

.week-nav button {
  padding: 0.4rem 0.8rem;
  background: var(--week-nav-button-bg);
  color: var(--week-nav-button-text);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.week-nav button:hover {
  background: var(--week-nav-button-hover);
}

.week-nav .today-button {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.week-nav .today-button:hover {
  background: var(--button-hover-bg);
  opacity: 0.9;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border-top: 1px solid var(--week-border);
  border-left: 1px solid var(--week-border);
  flex: 1;
  min-height: 0;
  background: var(--week-grid-bg);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  overflow-y: visible;
  overflow-x: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.week-grid::-webkit-scrollbar {
  display: none;
}

.day-column {
  border-right: 1px solid var(--week-border);
  border-bottom: 1px solid var(--week-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  transition: border-color 0.3s ease;
  position: relative;
}

.day-header {
  background: var(--day-header-bg);
  padding: 0;
  border-bottom: 1px solid var(--day-header-border);
  text-align: center;
  flex-shrink: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.week-goal-bar {
  height: 4px;
  width: 100%;
  border-radius: 0;
  margin: 0;
  flex-shrink: 0;
}

.week-goal-base {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.week-goal-build {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.week-goal-peak {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.week-goal-taper {
  background: linear-gradient(90deg, #8b5cf6 0%, #7c3aed 100%);
}

.week-goal-rest {
  background: linear-gradient(90deg, #94a3b8 0%, #64748b 100%);
}

.week-goal-recovery {
  background: linear-gradient(90deg, #f032d4 0%, #f032d4 100%);
}

.day-header-content {
  padding: 0.5rem 0.4rem;
}

.day-name {
  font-size: 0.75rem;
  color: var(--day-name-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

.day-date {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--day-date-color);
  margin-top: 0.15rem;
  transition: color 0.3s ease;
}

/* Today highlighting */
.day-column.day-today {
  border-left: 3px solid var(--primary-color);
  border-right: 3px solid var(--primary-color);
}

.day-header-today {
  background: rgba(214, 61, 64, 0.1) !important;
}

.day-date-today {
  color: var(--primary-color) !important;
  font-weight: 700;
  position: relative;
}

.day-date-today::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--primary-color);
  border-radius: 2px;
}

[data-theme="dark"] .day-header-today {
  background: rgba(214, 61, 64, 0.2) !important;
}

.day-content {
  flex: 1;
  min-height: 0;
  padding: 0;
  background: var(--day-content-bg);
  overflow: visible;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease;
}

/* Time segments */
.time-segment {
  display: flex;
  flex-direction: column;
  height: 240px;
  border-bottom: 1px solid var(--week-border);
  overflow: visible;
  flex-shrink: 0;
  box-sizing: border-box;
}

.time-segment:last-child {
  border-bottom: none;
}

.time-segment-content {
  flex: 1;
  padding: 0.35rem;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
  position: relative;
  align-items: stretch;
}

.time-segment-content.no-scroll {
  overflow: visible;
}


/* Card layout: fixed height */
.workout-card {
  border-radius: 6px;
  height: 110px;
  min-height: 110px;
  max-height: 110px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 1;
  overflow: hidden;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.workout-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px var(--card-shadow);
}

/* Top bar (colored) */
.card-top {
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  flex-shrink: 0;
}

.card-top-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}




/* Card body */
.card-body {
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow: hidden;
  transition: color 0.3s ease;
  min-height: 0;
  flex-shrink: 1;
}


.notes-preview {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Per-activity top bar colors */
.workout-card.run {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.workout-card.walk {
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #fff;
}

.workout-card.cycle {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}

.workout-card.swim {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
}

.workout-card.openwater {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}

.workout-card.workout,
.workout-card.strength {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
}

.workout-card.stretching,
.workout-card.yoga {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
}

.workout-card.race {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #fff;
}

/* Skipped workouts (past planned workouts without actual activity) */
.workout-card.skipped {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  color: #fff;
  opacity: 0.7;
}

/* Strava linked indicator */
.workout-icon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.strava-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.strava-linked-icon {
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: inline-block;
}

/* Icon styling inside top bar */
.workout-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.workout-icon i {
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}

.card-top .workout-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0;
  color: #fff;
  line-height: 1.2;
}

.workout-meta {
  font-size: 0.75rem;
  opacity: 0.95;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.2;
}

/* Ensure workout details (if present) don't stretch */
.card-body .workout-details {
  flex: 0 0 auto;
}

/* Workout Modal Styles */
.workout-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.workout-modal.active {
  display: flex;
}

.workout-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.workout-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  animation: modalSlideIn 0.3s ease;
}

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

.workout-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  font-size: 1.2rem;
  z-index: 1002;
  transition: background-color 0.2s ease;
}

.workout-modal-close:hover {
  background: rgba(0, 0, 0, 0.2);
}

.workout-modal-body {
  padding: 2rem;
}

.modal-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.modal-workout-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 0.5rem;
}

.modal-workout-meta {
  font-size: 1rem;
  color: #666;
}

.modal-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-details .detail-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: #333;
}

.modal-details .detail-item:last-child {
  border-bottom: none;
}

.modal-details .detail-item strong {
  display: inline-block;
  min-width: 120px;
  margin-right: 0.5rem;
  color: #111;
  font-weight: 600;
}

/* Modal colors based on workout type */
.workout-modal-content.workout-modal-run {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
}

.workout-modal-content.workout-modal-run .modal-workout-name,
.workout-modal-content.workout-modal-run .modal-workout-meta,
.workout-modal-content.workout-modal-run .detail-item,
.workout-modal-content.workout-modal-run .detail-item strong {
  color: #fff;
}

.workout-modal-content.workout-modal-run .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-run .detail-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-run .workout-modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.workout-modal-content.workout-modal-run .workout-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.workout-modal-content.workout-modal-cycle {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}

.workout-modal-content.workout-modal-cycle .modal-workout-name,
.workout-modal-content.workout-modal-cycle .modal-workout-meta,
.workout-modal-content.workout-modal-cycle .detail-item,
.workout-modal-content.workout-modal-cycle .detail-item strong {
  color: #fff;
}

.workout-modal-content.workout-modal-cycle .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-cycle .detail-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-cycle .workout-modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.workout-modal-content.workout-modal-cycle .workout-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.workout-modal-content.workout-modal-swim {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
}

.workout-modal-content.workout-modal-swim .modal-workout-name,
.workout-modal-content.workout-modal-swim .modal-workout-meta,
.workout-modal-content.workout-modal-swim .detail-item,
.workout-modal-content.workout-modal-swim .detail-item strong {
  color: #fff;
}

.workout-modal-content.workout-modal-swim .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-swim .detail-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-swim .workout-modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.workout-modal-content.workout-modal-swim .workout-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.workout-modal-content.workout-modal-openwater {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}

.workout-modal-content.workout-modal-openwater .modal-workout-name,
.workout-modal-content.workout-modal-openwater .modal-workout-meta,
.workout-modal-content.workout-modal-openwater .detail-item,
.workout-modal-content.workout-modal-openwater .detail-item strong {
  color: #fff;
}

.workout-modal-content.workout-modal-openwater .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-openwater .detail-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-openwater .workout-modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.workout-modal-content.workout-modal-openwater .workout-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.workout-modal-content.workout-modal-workout,
.workout-modal-content.workout-modal-strength {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
}

.workout-modal-content.workout-modal-workout .modal-workout-name,
.workout-modal-content.workout-modal-workout .modal-workout-meta,
.workout-modal-content.workout-modal-workout .detail-item,
.workout-modal-content.workout-modal-workout .detail-item strong,
.workout-modal-content.workout-modal-strength .modal-workout-name,
.workout-modal-content.workout-modal-strength .modal-workout-meta,
.workout-modal-content.workout-modal-strength .detail-item,
.workout-modal-content.workout-modal-strength .detail-item strong {
  color: #fff;
}

.workout-modal-content.workout-modal-workout .modal-header,
.workout-modal-content.workout-modal-strength .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-workout .detail-item,
.workout-modal-content.workout-modal-strength .detail-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-workout .workout-modal-close,
.workout-modal-content.workout-modal-strength .workout-modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.workout-modal-content.workout-modal-workout .workout-modal-close:hover,
.workout-modal-content.workout-modal-strength .workout-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.workout-modal-content.workout-modal-stretching,
.workout-modal-content.workout-modal-yoga {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
}

.workout-modal-content.workout-modal-stretching .modal-workout-name,
.workout-modal-content.workout-modal-stretching .modal-workout-meta,
.workout-modal-content.workout-modal-stretching .detail-item,
.workout-modal-content.workout-modal-stretching .detail-item strong,
.workout-modal-content.workout-modal-yoga .modal-workout-name,
.workout-modal-content.workout-modal-yoga .modal-workout-meta,
.workout-modal-content.workout-modal-yoga .detail-item,
.workout-modal-content.workout-modal-yoga .detail-item strong {
  color: #fff;
}

.workout-modal-content.workout-modal-stretching .modal-header,
.workout-modal-content.workout-modal-yoga .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-stretching .detail-item,
.workout-modal-content.workout-modal-yoga .detail-item {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.workout-modal-content.workout-modal-stretching .workout-modal-close,
.workout-modal-content.workout-modal-yoga .workout-modal-close {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.workout-modal-content.workout-modal-stretching .workout-modal-close:hover,
.workout-modal-content.workout-modal-yoga .workout-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Strava link styling in modals - ensure white color */
.workout-modal-content .strava-link {
  color: #fff !important;
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.workout-modal-content .strava-link:hover {
  opacity: 0.8;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
  .week-calendar {
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .wrapper {
    margin-right: 0;
    margin-left: 0;
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .week-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
  }

  .week-title {
    font-size: 1rem;
    width: 100%;
  }

  .week-header-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .distance-unit-toggle {
    align-self: flex-end;
  }

  .week-nav {
    display: flex;
    width: 100%;
    gap: 0.5rem;
    justify-content: space-between;
  }

  .week-header-right .week-nav {
    width: 100%;
  }

  .week-nav button {
    flex: 1;
    margin-left: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .week-summary {
    padding: 1rem;
  }

  .summary-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .summary-header-controls {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .progress-basis-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .progress-basis-label {
    flex: 1;
  }

  .summary-header h3 {
    font-size: 1rem;
  }

  .summary-content {
    flex-direction: column;
    gap: 0.75rem;
  }

  .summary-item {
    min-width: 100%;
    padding: 0.6rem 0.75rem;
    min-height: 148px;
    box-sizing: border-box;
  }

  .summary-item-body {
    min-height: 120px;
  }

  .summary-item i {
    font-size: 1.1rem;
    width: 20px;
  }

  .summary-item-label {
    font-size: 0.75rem;
  }

  .summary-item-value {
    font-size: 0.85rem;
  }

  .summary-total {
    padding: 0.6rem 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    min-height: 148px;
    border-width: 1px;
  }

  .summary-total-main {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .summary-total-body {
    text-align: left;
    width: 100%;
    min-height: 0;
    flex: 0;
    min-width: 0;
    padding-left: calc(20px + 0.75rem);
  }

  .summary-total-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
  }

  .summary-total-progress-row {
    margin-top: auto;
    padding-top: 0.5rem;
    padding-left: calc(20px + 0.75rem);
  }

  .summary-total-icon {
    font-size: 1.1rem;
    width: 20px;
  }

  .summary-total-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--day-name-color);
  }

  .week-grid {
    display: flex;
    flex-direction: row;
    flex: 1;
    height: auto;
    min-height: clamp(420px, 68dvh, 560px);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    border-top: 1px solid var(--week-border);
    border-left: none;
    border-right: none;
    align-items: stretch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .day-column {
    min-width: 85vw;
    max-width: 85vw;
    min-height: 100%;
    border-right: 1px solid var(--week-border);
    border-left: none;
    scroll-snap-align: start;
    flex-shrink: 0;
    align-self: stretch;
  }

  .day-column.day-today {
    border-left: none;
    border-right: 3px solid var(--primary-color);
  }

  .day-header {
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    background: var(--day-header-bg);
    z-index: 10;
  }

  .day-header-content {
    padding: 0.4rem 0.3rem;
  }

  .day-name {
    font-size: 0.7rem;
  }

  .day-date {
    font-size: 1rem;
  }

  .day-content {
    flex: 1;
    min-height: 0;
    overflow: visible;
  }

  .time-segment {
    height: 120px;
    min-height: 120px;
    max-height: 120px;
    box-sizing: border-box;
  }

  .time-segment-content {
    padding: 0.3rem;
    gap: 0.3rem;
  }

  .workout-card {
    height: 100px;
    min-height: 100px;
    max-height: 100px;
  }

  .card-top {
    padding: 0.5rem 0.6rem;
    gap: 0.3rem;
  }

  .card-top .workout-name {
    font-size: 0.85rem;
  }

  .workout-meta {
    font-size: 0.7rem;
  }

  .workout-icon {
    width: 24px;
    height: 24px;
  }

  .workout-icon i {
    font-size: 12px;
  }

  .strava-linked-icon {
    font-size: 10px;
  }

  .card-body {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }

  .workout-modal {
    padding: 1rem;
    align-items: flex-end;
  }

  .workout-modal-content {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px 12px 0 0;
    animation: modalSlideUp 0.3s ease;
  }

  @keyframes modalSlideUp {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .workout-modal-body {
    padding: 1.5rem;
  }

  .modal-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  .modal-workout-name {
    font-size: 1.25rem;
  }

  .modal-workout-meta {
    font-size: 0.9rem;
  }

  .modal-details {
    gap: 0.75rem;
  }

  .modal-details .detail-item {
    padding: 0.6rem 0;
    font-size: 0.9rem;
  }

  .modal-details .detail-item strong {
    display: block;
    min-width: auto;
    margin-right: 0;
    margin-bottom: 0.25rem;
  }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
  .week-header {
    padding: 0.75rem;
  }

  .week-title {
    font-size: 0.9rem;
  }

  .week-nav button {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
  }

  .day-column {
    min-width: 90vw;
    max-width: 90vw;
  }

  .summary-phase {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  .workout-card {
    height: 90px;
    min-height: 90px;
    max-height: 90px;
  }

  .card-top {
    padding: 0.4rem 0.5rem;
  }

  .card-top .workout-name {
    font-size: 0.8rem;
  }

  .workout-meta {
    font-size: 0.65rem;
  }
}
