/*
 * Mobile-first styles for the workout generator website.
 * This stylesheet defines the look and feel of the interface, starting with
 * mobile layouts as the default, then enhancing for larger screens.
 * All sizes are relative so the layout remains responsive across devices.
 */

/* Reset some default margins and paddings */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}

header {
  background-color: #4CAF50;
  color: #fff;
  padding: 0.6rem;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
}

header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: bold;
}

main {
  width: 100%;
  margin: 0 auto;
  padding: 0.6rem;
  box-sizing: border-box;
}

/* Control panel styling */
.controls {
  background-color: #fff;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.controls h2 {
  margin-top: 0;
}

.controls form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-end;
  justify-content: space-between;
}

.controls label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
  font-size: 0.9rem;
  flex-basis: 100%;
}

.controls select {
  margin-top: 0.25rem;
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  font-size: 0.9rem;
}

/* Icon buttons styling */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-btn {
  padding: 0.6rem 1rem;
  background-color: #4CAF50;
  color: #fff;
  font-size: 0.9rem;
  width: 100%;
  margin-top: 0.5rem;
}

.primary-btn:hover {
  background-color: #45a049;
}

.icon-btn i {
  font-size: 1rem;
}

.btn-text, .link-text {
  display: none;
}

/* Superset styling */
#workoutOutput .superset {
  background-color: #fff;
  margin-bottom: 0.6rem;
  padding: 0.6rem;
  border-radius: 8px;
  border-left: 4px solid #4CAF50;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#workoutOutput h3 {
  margin: 0 0 0.5rem;
  color: #4CAF50;
  font-size: 1rem;
}

/* Mobile-friendly exercise list styling */
.exercise-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.exercise-item {
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.exercise-main-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  padding: 0.5rem;
  background-color: #f9f9f9;
  cursor: pointer;
  justify-content: space-between;
  position: relative; /* For absolute positioning of drag handle */
}

.muscle-group {
  background-color: #e8f5e9;
  color: #4CAF50;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  font-weight: normal;
  cursor: pointer;
  min-width: 40px;
  text-align: center;
  font-size: 0.75rem;
  border: 1px solid #4CAF50;
}

.muscle-group:hover {
  background-color: #c8e6c9;
}

.exercise-name {
  flex-grow: 1;
  font-weight: bold;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shuffle-icon {
  margin-left: 8px;
  color: #888;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.shuffle-icon:hover {
  color: #4CAF50;
  background-color: #e8f5e9;
}

.toggle-details {
  padding: 0.3rem 0.5rem;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.toggle-details:hover {
  background-color: #e0e0e0;
}

.exercise-details {
  padding: 0.8rem;
  border-top: 1px solid #ddd;
  background-color: white;
  font-size: 0.85rem;
}

.detail-item {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

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

footer {
  text-align: center;
  padding: 0.8rem;
  font-size: 0.85rem;
}

.icon-link {
  color: #4CAF50;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

footer a:hover {
  text-decoration: underline;
}

/* Change exercise button styling */
.change-exercise {
  padding: 0.3rem 0.5rem;
  background-color: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.change-exercise:hover {
  background-color: #45a049;
}

.change-exercise:active {
  background-color: #3d8b40;
  transform: translateY(1px);
}

/* Set management controls styling */
.superset-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0.4rem;
  flex-wrap: nowrap;
  gap: 0.4rem;
}

.set-controls {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}

.set-controls {
  display: flex;
  gap: 0.5rem;
  margin-left: auto; /* Right-align the controls */
}

.set-control-btn {
  padding: 0.3rem;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

/* Icon button styling */
.icon-btn {
  width: 28px;
  height: 28px;
  font-size: 1rem;
  line-height: 1;
}

.set-control-btn:hover {
  background-color: #e0e0e0;
}

.set-control-btn:active {
  transform: translateY(1px);
}

/* Add new set button styling */
.add-set-container {
  display: flex;
  justify-content: flex-end; /* Right-align the add button */
  margin: 1.5rem 0 0.5rem;
}

/* Drag and drop styling */
.drag-handle {
  cursor: grab;
  padding: 0 0.5rem 0 0;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drag-handle:active {
  cursor: grabbing;
}

.exercise-item.dragging {
  opacity: 0.8;
  position: relative;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.exercise-placeholder {
  border: 1px dashed #ccc;
  border-radius: 6px;
  background-color: #f5f5f5;
  margin-bottom: 0.5rem;
}

.add-set-btn {
  background-color: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 50%; /* Make it circular */
  cursor: pointer;
  font-size: 1.5rem;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.add-set-btn:hover {
  background-color: #45a049;
}

.add-set-btn:active {
  background-color: #3d8b40;
  transform: translateY(1px);
}

/* Button container */
.button-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Edit Workout Button */
.edit-workout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background-color: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
  margin: 0;
}

.edit-workout-btn:hover {
  background-color: #45a049;
}

.edit-workout-btn:active {
  background-color: #3d8b40;
  transform: translateY(1px);
}

/* Share Workout Button */
.share-workout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  background-color: #4CAF50; /* Same color as edit button */
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
  margin: 0 0 0 0.5rem; /* Add margin to separate from edit button */
}

.share-workout-btn:hover {
  background-color: #45a049;
}

.share-workout-btn:active {
  background-color: #3d8b40;
  transform: translateY(1px);
}

/* Notification for copy to clipboard */
.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 1000;
  font-size: 0.9rem;
  transition: opacity 0.5s ease;
}

.notification.fade-out {
  opacity: 0;
}

/* Hidden class for controls section */
.hidden {
  display: none;
}

/* Media queries for larger screens */
@media (min-width: 481px) {
  .controls label {
    flex-basis: 48%;
  }
  
  header h1 {
    font-size: 1.4rem;
  }
}

@media (min-width: 769px) {
  main {
    max-width: 900px;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  .muscle-group {
    min-width: 50px;
    font-size: 0.8rem;
  }
  
  .exercise-name {
    flex: 1;
    margin-bottom: 0;
    font-size: 1rem;
  }
  
  .toggle-details {
    width: auto;
    padding: 0.4rem 0.8rem;
  }
  
  .btn-text, .link-text {
    display: inline;
  }
  
  .controls label {
    flex-basis: auto;
  }
  
  .controls select {
    min-width: 120px;
    width: auto;
  }
  
  #generateBtn {
    margin-top: 0;
    width: auto;
  }
  
  .set-controls {
    width: auto;
  }
  
  .superset-header h3 {
    font-size: 1.1rem;
  }
  
  .exercise-details {
    padding: 1rem;
    font-size: 0.9rem;
  }
  
  .detail-item {
    margin-bottom: 0.75rem;
  }
}