/* app/assets/stylesheets/pages/workout-logs.css */

/* === WORKOUT LOGGER LAYOUT === */
.workout-logger {
  padding-bottom: 120px; /* Space for fixed bottom section */
}

/* === BADGE SYSTEM === */
.badge-container {
  min-height: 200px;
}

.exercise-block {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.exercise-block:hover {
  border-color: rgba(220, 53, 69, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.exercise-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.set-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.set-number {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 2rem;
}

/* === WORKOUT BADGES === */
.workout-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.workout-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.workout-badge:active {
  transform: translateY(0);
}

/* Badge Types */
.badge-status {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
}

.badge-reps {
  background: linear-gradient(135deg, #7ED321 0%, #5CB85C 100%);
  color: white;
}

.badge-weight {
  background: linear-gradient(135deg, #F5A623 0%, #E67E22 100%);
  color: white;
}

.badge-reflection {
  background: linear-gradient(135deg, #9013FE 0%, #6A1B9A 100%);
  color: white;
}

.badge-time {
  background: linear-gradient(135deg, #FF6B35 0%, #E55A4E 100%);
  color: white;
}

.badge-energy {
  background: linear-gradient(135deg, #FF1744 0%, #D32F2F 100%);
  color: white;
}

/* Badge Animations */
@keyframes badge-spawn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  60% {
    transform: scale(1.05) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.badge-creating {
  animation: badge-spawn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-loading {
  opacity: 0.7;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* === EXERCISE CONTEXT SECTION === */
.exercise-context-section {
  margin: 2rem 0;
  position: relative;
}

.exercise-context-section .btn {
  transition: all 0.3s ease;
  border-radius: 8px;
  font-weight: 500;
}

.exercise-context-section .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 🆕 NEW: Context Badge Display */
.context-badge-display {
  margin: 1rem 0;
}

.context-badge {
  display: flex;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(25, 135, 84, 0.1) 100%);
  border: 1px solid rgba(13, 110, 253, 0.3);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  width: 100%;
  gap: 0.75rem;
  position: relative;
  transition: all 0.3s ease;
  animation: contextBadgeAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: left;
}

.context-badge:hover {
  border-color: rgba(13, 110, 253, 0.5);
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.15) 0%, rgba(25, 135, 84, 0.15) 100%);
}

.context-badge .bi-chat-square-text {
  color: #0d6efd;
  font-size: 1rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.context-preview {
  flex: 1;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
}

.context-edit-btn {
  background: rgba(13, 110, 253, 0.15);
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #0d6efd;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: -0.1rem;
}

.context-edit-btn:hover {
  background: rgba(13, 110, 253, 0.25);
  color: #0a58ca;
  transform: scale(1.05);
}

@keyframes contextBadgeAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  60% {
    transform: scale(1.05) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* 🆕 NEW: IG-style context input with submit button */
.context-input-wrapper {
  position: relative;
}

.context-input-wrapper .form-control {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all 0.3s ease;
  resize: none;
  padding: 12px 50px 12px 16px; /* Extra padding for submit button */
  min-height: 60px;
}

.context-input-wrapper .form-control:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.context-submit-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #0d6efd;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.context-submit-btn:hover {
  background: #0a58ca;
  transform: scale(1.05);
}

.context-submit-btn:active {
  transform: scale(0.95);
}

.exercise-context-section .form-control {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all 0.3s ease;
  resize: vertical;
  min-height: 80px;
}

.exercise-context-section .form-control:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.exercise-context-section .form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Context section slide animation */
.exercise-context-section [data-log-builder-target="contextBody"] {
  transition: all 0.3s ease;
  overflow: hidden;
}

.exercise-context-section [data-log-builder-target="contextBody"][style*="display: block"] {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  0% {
    opacity: 0;
    max-height: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    max-height: 200px;
    transform: translateY(0);
  }
}

/* === BADGE MODAL === */
.badge-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.badge-modal.show {
  display: flex;
  animation: modalFadeIn 0.3s ease-out;
}

.badge-modal-content {
  background: var(--surface-primary);
  border-radius: 16px;
  padding: 0;
  max-width: 90vw;
  max-height: 80vh;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  justify-content: between;
  align-items: center;
}

.badge-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.badge-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.badge-modal-close:hover {
  color: var(--text-primary);
  background: var(--surface-secondary);
}

.badge-options-grid {
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
  display: grid;
  gap: 0.5rem;
}

.badge-option {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid transparent;
  text-align: center;
  font-weight: 500;
}

.badge-option:hover {
  background: var(--surface-tertiary);
  border-color: #dc3545;
  transform: translateY(-1px);
}

/* === BENCHMARK MODAL === */
.benchmark-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(6px);
}

.benchmark-modal-content {
  background: var(--surface-primary);
  border-radius: 16px;
  padding: 2rem;
  max-width: 90vw;
  width: 400px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  animation: modalSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* === EXERCISE SELECTOR === */
.exercise-selector-dropdown {
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.exercise-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-muted);
}

.exercise-option:hover {
  background: var(--surface-secondary);
}

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

/* === EMPTY STATE === */
.empty-exercise {
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-exercise .btn {
  transition: all 0.3s ease;
  border-radius: 12px;
  font-weight: 600;
}

.empty-exercise .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* === ANIMATIONS === */
@keyframes modalFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes modalSlideUp {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideInRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .workout-logger {
    padding-bottom: 140px;
  }

  .exercise-block {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .set-line {
    gap: 0.25rem;
  }

  .workout-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    margin-right: 0.25rem;
  }

  .badge-modal-content {
    width: 90vw;
    margin: 1rem;
  }

  .exercise-context-section .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* === SUCCESS FEEDBACK === */
.badge-success-feedback {
  font-weight: 500;
  border: 1px solid #c3e6cb;
}

/* === UTILITY CLASSES === */
.transition-transform {
  transition: transform 0.3s ease;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}
