/* Workout Modal Enhancements and Fixes */

/* Fix duplicate dropdown arrows */
.technique-select,
.technique-select.styled-dropdown,
.dropdown-container .technique-select {
  /* Remove ALL background-image arrows */
  background-image: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

/* Single arrow for dropdown container */
.dropdown-container {
  position: relative;
}

.dropdown-container::after {
  content: '▼';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.8rem;
  color: #64748B;
  transition: all 0.3s ease;
}

/* Ensure no double arrows in action bar */
.action-bar .dropdown-container::after {
  display: block;
}

/* Remove any arrows from the select itself */
.action-bar select,
.modern-workout-modal select {
  background-image: none !important;
}

/* Enhanced recommendation card styling */
.recommendation-card {
  position: relative;
  overflow: hidden;
}

.recommendation-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { transform: translate(-30%, -30%) rotate(0deg); }
  50% { transform: translate(-30%, -30%) rotate(180deg); }
}

/* Enhanced exercise name styling */
.exercise-name {
  position: relative;
  display: inline-block;
}

.exercise-name::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.exercise-header:hover .exercise-name::after {
  width: 100%;
}

/* Improved stats display */
.stats-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Enhanced muscle badge colors with better contrast */
.muscle-badge {
  position: relative;
  overflow: hidden;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.muscle-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.muscle-badge:hover::before {
  left: 100%;
}

/* Improved recommendation weight display */
.recommendation-weight {
  position: relative;
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced 1RM display */
.stat-value {
  position: relative;
  font-variant-numeric: tabular-nums;
  /* Ensures numbers align properly */
}

.stat-value::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color, #6366f1));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}

.stat-item:hover .stat-value::after {
  transform: scaleX(1);
}

/* Fix technique dropdown hover state */
.technique-select:hover {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(93, 95, 239, 0.1);
}

.technique-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(93, 95, 239, 0.2);
}

/* Ensure proper dropdown styling for all select elements in modal */
.modern-workout-modal select {
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .recommendation-weight {
    font-size: 1rem;
    padding: 0.2rem 0.6rem;
  }
  
  .exercise-name {
    font-size: 1.25rem;
  }
  
  .stat-value {
    font-size: 1rem;
  }
  
  /* Ensure dropdowns are touch-friendly on mobile */
  .technique-select {
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  .recommendation-weight {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .stats-card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
  }
  
  .muscle-badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}

/* Accessibility improvements */
.technique-select:focus-visible,
.action-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Loading state for stats */
.stat-value.loading {
  color: var(--text-secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* Smooth transitions for dynamic content */
.recommendation-content,
.stats-content,
.history-content {
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fix for potential z-index issues */
.modern-workout-modal {
  z-index: 99999;
}

.modern-workout-modal .dropdown-container {
  position: relative;
  z-index: 10;
}

/* Ensure consistent spacing */
.exercise-header {
  margin-bottom: 1.5rem;
}

.action-bar {
  align-items: center;
}

.action-bar > * {
  margin: 0 0.375rem;
}

.action-bar > *:first-child {
  margin-left: 0;
}

.action-bar > *:last-child {
  margin-right: 0;
}

/* ========================================
   DASHBOARD VIEW (MASTER-DETAIL ARCHITECTURE)
   ======================================== */

/* Dashboard Mode Container */
.exercise-slides-container.dashboard-mode {
  padding: 0;
  overflow-y: auto;
  height: 100%;
}

.dashboard-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Dashboard Header */
.dashboard-header {
  padding: 2rem 2rem 1.5rem 2rem;
  background: var(--bg-gray, #f9fafb);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.dashboard-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #1a202c);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.dashboard-header p {
  font-size: 0.875rem;
  color: #ffffff !important;
  margin: 0;
}

/* Dashboard Exercise List */
.dashboard-exercise-list {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
}

/* Dashboard Row */
.dashboard-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #F97316 0%, #ea580c 100%);
  border: 2px solid #ea580c;
  border-radius: 12px;
  transition: all 0.2s ease;
  min-height: 90px;
  margin-bottom: 0.75rem;
}

.dashboard-row:hover {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
  border-color: #dc2626;
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.3);
  transform: translateY(-3px);
}

.dashboard-row.completed {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
}

/* Dashboard Row Info Section */
.dashboard-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dashboard-exercise-name-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dashboard-exercise-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dashboard-technique-badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.25);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

.dashboard-exercise-details {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

/* Dashboard Row Input Section */
.dashboard-row-input {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.25rem;
}

.dashboard-inputs-container {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.dashboard-weight-input,
.dashboard-reps-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.25rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  color: #FF6B00 !important;
  transition: all 0.2s ease;
}

.dashboard-weight-input::placeholder,
.dashboard-reps-input::placeholder {
  color: rgba(249, 115, 22, 0.5);
  font-size: 0.75rem;
}

.dashboard-weight-input:focus,
.dashboard-reps-input:focus {
  outline: none;
  border-color: #ffffff;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.dashboard-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  padding: 0.125rem 0;
}

.dashboard-complete-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

/* Dashboard Row Action Section */
.dashboard-row-action {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.dashboard-details-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  background: rgba(255, 255, 255, 0.95);
  color: #F97316;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dashboard-details-btn:hover {
  background: #ffffff;
  color: #ea580c;
  border-color: #ffffff;
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.dashboard-details-btn i {
  font-size: 0.75rem;
}

/* Back to Dashboard Button (in Focus mode) */
.back-to-dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #F97316 0%, #ea580c 100%);
  color: white;
  border: 2px solid #ea580c;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.back-to-dashboard-btn:hover {
  background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
  border-color: #dc2626;
  transform: translateX(-4px);
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.3);
}

.back-to-dashboard-btn i {
  font-size: 0.95rem;
}

/* Focus Mode Container */
.exercise-slides-container.focus-mode {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

/* Mobile Responsive Styles for Dashboard */
@media (max-width: 767px) {
  .dashboard-header {
    padding: 1.5rem 1rem 1rem 1rem;
  }

  .dashboard-header h2 {
    font-size: 1.375rem;
  }

  .dashboard-exercise-list {
    padding: 0.75rem;
    gap: 1rem;
  }

  .dashboard-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    min-height: auto;
  }

  .dashboard-row-info {
    order: 1;
  }

  .dashboard-row-input {
    order: 2;
    flex-direction: column;
    align-items: stretch;
    padding: 0.625rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    gap: 0.5rem;
  }

  .dashboard-inputs-container {
    gap: 0.5rem;
  }

  .dashboard-row-action {
    order: 3;
  }

  .dashboard-details-btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
  }

  .dashboard-weight-input,
  .dashboard-reps-input {
    font-size: 0.8rem;
    padding: 0.5rem 0.25rem;
  }

  .back-to-dashboard-btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 1.25rem;
  }
}

/* Tablet Adjustments for Dashboard */
@media (min-width: 768px) and (max-width: 1024px) {
  .dashboard-row {
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
  }

  .dashboard-row-info {
    order: 1;
    grid-column: 1;
  }

  .dashboard-row-input {
    order: 2;
    grid-column: 2;
    align-items: flex-start;
  }

  .dashboard-row-action {
    order: 3;
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .dashboard-details-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .dashboard-header {
    background: #1A1A1A;
  }

  .dashboard-row {
    background: #0A0A0A;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .dashboard-row:hover {
    border-color: #F97316;
  }

  .dashboard-weight-input {
    background: #0A0A0A;
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
  }

  .dashboard-row-input {
    background: #1A1A1A;
  }
}

[data-theme="dark"] .dashboard-header {
  background: #1A1A1A;
}

[data-theme="dark"] .dashboard-row {
  background: #0A0A0A;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .dashboard-row:hover {
  border-color: #F97316;
}

[data-theme="dark"] .dashboard-weight-input {
  background: #0A0A0A;
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-theme="dark"] .dashboard-row-input {
  background: #1A1A1A;
}