/* -----------------------------
   PLAN BUILDER STYLES
----------------------------- */

.builder-layout {
  display: flex;
  gap: 24px;
  height: calc(100vh - 250px);
  min-height: 500px;
}

/* Sidebar */
.builder-sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

.filters-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filters-row::-webkit-scrollbar { height: 4px; }

.filter-pill {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.1);
}

.filter-pill.active {
  background: var(--primary);
  color: white;
}

.exercise-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exercise-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: var(--transition);
}

.exercise-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.exercise-card:active {
  cursor: grabbing;
}

.exercise-card img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
}

.ex-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.ex-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.move-handle {
  margin-left: auto;
  color: var(--text-muted);
  cursor: grab;
}

/* Canvas Area */
.builder-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 8px;
}

.plan-meta {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.plan-title-input {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border: none;
  border-bottom: 1px dashed transparent;
  width: 50%;
  transition: var(--transition);
}

.plan-title-input:focus {
  border-bottom-color: var(--primary);
  outline: none;
}

.plan-settings {
  display: flex;
  gap: 12px;
}

/* Workout Day Block */
.workout-day {
  margin-bottom: 24px;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-left: 8px;
}

.day-header h3 {
  font-size: 1.1rem;
  color: var(--text-main);
}

.workout-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workout-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-left: 3px solid transparent;
  transition: var(--transition);
}

.workout-row:hover {
  border-left-color: var(--primary);
}

.row-drag-handle {
  color: var(--text-muted);
  cursor: grab;
}

.row-ex-info {
  flex: 1;
  min-width: 150px;
}

.row-ex-info strong {
  display: block;
  font-size: 1rem;
}

.row-ex-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.row-metrics {
  display: flex;
  gap: 16px;
}

.metric-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-input label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-input input[type="number"],
.metric-input input[type="text"] {
  width: 60px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-align: center;
}

.input-with-addon {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-with-addon input {
  width: 50px;
  border: none;
  background: transparent;
}

.input-with-addon span {
  padding: 0 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.5);
  height: 100%;
  display: flex;
  align-items: center;
}

.row-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.text-danger { color: var(--danger); }
.text-danger:hover { background-color: rgba(239, 68, 68, 0.1); }

/* Drop Zone */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
  background: rgba(0, 0, 0, 0.1);
}

.drop-zone:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(124, 58, 237, 0.05);
}

.drop-zone i {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px dashed var(--panel-border);
}

.btn-block:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ── Builder Responsive ── */
@media (max-width: 1024px) {
  .builder-sidebar {
    width: 260px;
  }
}

@media (max-width: 768px) {
  .builder-layout {
    flex-direction: column;
    height: auto;
    min-height: unset;
  }

  .builder-sidebar {
    width: 100%;
    max-height: 320px;
  }

  .exercise-list {
    max-height: 220px;
  }

  .builder-canvas {
    overflow-y: visible;
    padding-right: 0;
  }

  .row-metrics {
    flex-wrap: wrap;
    gap: 8px;
  }

  .metric-input input[type="number"],
  .metric-input input[type="text"] {
    width: 52px;
  }

  .workout-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .row-ex-info {
    flex: 1 1 100%;
  }
}
