/* Plans CSS */
.plans-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
}

.plans-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plans-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.plans-filters {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.filter-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .plans-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .plans-grid { grid-template-columns: repeat(3, 1fr); }
}

.plans-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.plan-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: var(--transition);
  border: 1px solid var(--border);
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.plan-card-stripe {
  width: 6px;
  flex-shrink: 0;
}

.plan-card-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.plan-card-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow-wrap: anywhere;
  padding-top: 6px;
}

.plan-card-preview {
  font-size: var(--fs-md);
  color: var(--text-muted);
  margin-top: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-card-preview-more {
  color: var(--text-secondary);
  font-weight: 600;
}

.plan-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-card-type {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.badge-strength {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent-strength);
}

.badge-cardio {
  background: rgba(249, 115, 22, 0.1);
  color: var(--accent-cardio);
}

.plan-card-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Akcje w rzędzie z nazwą — osobny pasek pod linią zajmował tylko miejsce */
.plan-card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  margin: -4px -6px 0 0;
}

.plan-card-actions .btn-icon {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon.text-danger:hover {
  color: var(--accent-danger);
}

/* Plan Form Modal */
.plan-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-form h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.plan-type-toggle {
  display: flex;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border);
}

.type-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.type-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.plan-color-swatches {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.plan-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.plan-color-swatch:hover {
  transform: scale(1.1);
}

.plan-color-swatch.selected {
  border-color: white;
  box-shadow: 0 0 0 2px var(--bg-card);
}

.plan-exercises-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.plan-exercise-header {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0 8px;
}

.plan-exercise-header span:nth-child(1) { flex: 3; }
.plan-exercise-header span:nth-child(2) { flex: 1; text-align: center; }
.plan-exercise-header span:nth-child(3) { flex: 1; text-align: center; }
.plan-exercise-header span:nth-child(4) { flex: 1; text-align: center; }
.plan-exercise-header span:nth-child(5) { width: 24px; }

.plan-exercise-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  transition: var(--transition);
}

.plan-exercise-item.in-superset {
  border-left-width: 4px;
}

.plan-exercise-item.superset-group-a {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.04);
}

.plan-exercise-item.superset-group-b {
  border-left-color: #a855f7;
  background: rgba(168, 85, 247, 0.04);
}

.plan-exercise-item.superset-group-c {
  border-left-color: #eab308;
  background: rgba(234, 179, 8, 0.04);
}

.plan-exercise-item.superset-group-d {
  border-left-color: #ec4899;
  background: rgba(236, 72, 153, 0.04);
}

.plan-exercise-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ex-col-order {
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ex-number-badge {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.superset-badge {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
}

.superset-group-a .superset-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.superset-group-b .superset-badge {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.superset-group-c .superset-badge {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
}

.superset-group-d .superset-badge {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.ex-col-name { flex: 3; }
.ex-col-number { flex: 1; }

.ex-col-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 72px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.ex-input {
  width: 100%;
  padding: 8px;
}

.btn-icon-tiny {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon-tiny:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-icon-tiny:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-icon-small {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.25rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.btn-icon-small:hover {
  background: var(--bg-hover);
  color: var(--accent-danger);
}

.plan-exercise-subrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.subrow-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.plan-superset-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.superset-select {
  padding: 4px 8px;
  font-size: 0.8rem;
  min-height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
}

.plan-rest-time-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rest-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rest-time-input {
  width: 54px;
  padding: 4px 6px;
  text-align: center;
  font-size: 0.8rem;
  min-height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.rest-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rest-presets-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.rest-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.rest-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.rest-chip.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.plan-add-buttons-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.plan-add-exercise-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--accent-primary);
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.plan-add-exercise-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent-primary);
}

.plan-add-superset-btn {
  background: rgba(234, 179, 8, 0.08);
  border: 1px dashed rgba(234, 179, 8, 0.4);
  color: #eab308;
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  text-align: center;
}

.plan-add-superset-btn:hover {
  background: rgba(234, 179, 8, 0.18);
  border-color: #eab308;
}

.plan-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Exercise Option Chips */
.plan-exercise-options {
  display: flex;
  gap: 6px;
}

.exercise-option-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.exercise-option-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-secondary);
}

.exercise-option-chip.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.form-row {
  display: flex;
  gap: 1rem;
}


/* Partie ćwiczenia — chip pokazuje podsumowanie, wybór rozwija się pod spodem */
.plan-exercise-options { flex-wrap: wrap; }

.muscle-plan-chip {
  max-width: 100%;
  text-align: left;
}

.plan-muscle-editor {
  flex: 1 1 100%;
  padding: var(--sp-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.plan-muscle-reset { margin-top: var(--sp-3); }
