/* Exercise Library Table Styles */

.exercise-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 12px;
  /* Use fixed layout so column widths behave predictably and table fills container */
  table-layout: fixed;
  box-sizing: border-box;
}
.exercise-table th, .exercise-table td {
  font-family: inherit;
  font-size: 1.18rem;
  padding: 14px 12px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
  vertical-align: middle;
  background: var(--card);
  box-sizing: border-box;
  /* allow wrapping inside cells (important for description column) */
  white-space: normal;
  word-break: break-word;
}
.exercise-table th {
  font-weight: 700;
  font-size: 1.22rem;
}
.exercise-table td:last-child {
  /* Make description/notes column the largest and allow wrapping */
  width: 55%;
  min-width: 280px;
}
.exercise-table td {
  /* Default for other columns - let them share remaining space */
  width: auto;
  min-width: 80px;
}

/* Column width hints (adjust as needed) */
.exercise-table th:nth-child(1), .exercise-table td:nth-child(1) { width: 20%; }
.exercise-table th:nth-child(2), .exercise-table td:nth-child(2) { width: 10%; }
.exercise-table th:nth-child(3), .exercise-table td:nth-child(3) { width: 10%; }
.exercise-table th:nth-child(4), .exercise-table td:nth-child(4) { width: 10%; }
.exercise-table th:nth-child(5), .exercise-table td:nth-child(5) { width: 15%; }
.exercise-table th:nth-child(6), .exercise-table td:nth-child(6) { width: 35%; }
.exercise-desc {
  font-size: 1.08rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  margin-top: 10px;
  padding: 16px;
}
/* Enhanced KMNCE Fitness Portal Theme */

:root{
  /* Core Colors */
  --bg: #ffffff; /* main white background */
  --text: #000000; /* main black text */
  --accent: #606E7A; /* brand accent */
  --secondary-dark: #333333; /* secondary dark */
  --secondary-light: #cccccc; /* secondary light */
  --white: #ffffff;
  --black: #000000;
  
  /* Derived colors */
  --card: #ffffff; /* white cards with borders */
  --card-border: #cccccc; /* light border for cards */
  --muted: #666666; /* readable muted text on white */
  --surface: #ffffff; /* white surface */
  --border: rgba(51,51,51,0.15); /* subtle dark borders */
  --accent-hover: rgba(96,110,122,0.1);
  --accent-active: rgba(96,110,122,0.2);
  --font-body: "Oswald Light", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --button-height: 40px;
  --transition-fast: all 0.12s cubic-bezier(0.4, 0.0, 0.2, 1);
  --shadow-subtle: 0 2px 8px rgba(51,51,51,0.1);
  /* legacy/compat token used in several places */
  --area51: rgba(96,110,122,0.1);
  
  /* UI Enhancement Variables */
  --card-hover: #f5f5f5;
  --card-active: #e5e5e5;
  --border-subtle: rgba(51,51,51,0.1);
  --border-accent: rgba(96,110,122,0.3);
  --shadow-light: 0 2px 8px rgba(51,51,51,0.1);
  --shadow-medium: 0 4px 16px rgba(51,51,51,0.15);
  --shadow-heavy: 0 8px 32px rgba(51,51,51,0.2);
  --transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  
  /* Input styling */
  --input: #ffffff;
  --input-border: #cccccc;
  
  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  
  /* Component Sizing */
  --radius: 8px;
  --radius-lg: 12px;
  --gap: 16px;
  --header-height: 80px;
  --nav-height: 60px;
}

/* Enhanced Typography */
@font-face{
  font-family:"Oswald Light"; 
  src: url('assets/Oswald-Light.ttf') format('truetype'); 
  font-weight:300;
  font-display: swap;
}

body{
  font-family:"Oswald Light", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; 
  background:var(--bg); 
  color:var(--text); 
  margin:0;
  line-height: 1.6;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Screen Management */
.screen { 
  display: none; 
  opacity: 0;
  transform: translateY(8px);
  transition: var(--transition-slow);
}
.screen.active { 
  display: block; 
  opacity: 1;
  transform: translateY(0);
  animation: screenEnter 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

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

/* Enhanced Layout Components */
.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: var(--space-6) var(--space-8);
  background: linear-gradient(135deg, rgba(0,0,0,0.95) 0%, rgba(51,51,51,0.1) 100%);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  height: var(--header-height);
  box-sizing: border-box;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .logo{
  height: 48px;
  transition: var(--transition);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.header .logo:hover{
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.user-info{
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--muted);
}

.nav{
  background: rgba(51,51,51,0.8);
  padding: 0 var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  position: sticky;
  top: var(--header-height);
  z-index: 90;
}

.nav .nav-content{
  display:flex;
  gap: var(--space-2);
  width: 100%;
}

.nav-btn{
  background: transparent;
  color: var(--white);
  border: none;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 300;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-btn::before{
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(96,110,122,0.1), transparent);
  transition: var(--transition);
}

.nav-btn:hover{
  background: rgba(96,110,122,0.08);
  color: var(--white);
  transform: translateY(-1px);
}

.nav-btn:hover::before{
  left: 100%;
}

.nav-btn.active{
  background: var(--accent);
  color: var(--white);
  box-shadow: var(--shadow-light);
  transform: none;
}

.nav-btn.active::before{
  display: none;
}

.content{
  max-width: 1200px;
  margin: var(--space-8) auto;
  padding: 0 var(--space-8);
  min-height: calc(100vh - var(--header-height) - var(--nav-height) - var(--space-8));
}

/* cards */
/* Enhanced Card System */
.card, .exercise-item, .workout-card, .workout-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-subtle);
  color: var(--text);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  margin: var(--space-4) 0;
}

/* Ensure table containers use full width available and don't add extra inner padding */
.exercise-list, .exercise-list .card, .exercise-table-container {
  width: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.card::before, .exercise-item::before, .workout-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(96,110,122,0.3));
  opacity: 0;
  transition: var(--transition);
}

.card:hover, .exercise-item:hover, .workout-card:hover {
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-medium);
  transform: translateY(-2px);
}

.card:hover::before, .exercise-item:hover::before, .workout-card:hover::before {
  opacity: 1;
}

.card h3, .exercise-item h4, .workout-card h4 {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-lg);
  font-weight: 300;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--accent);
}

.card p, .exercise-item p, .workout-card p {
  color: var(--muted);
  margin: var(--space-2) 0;
  line-height: 1.6;
}

.card p:last-child, .exercise-item p:last-child, .workout-card p:last-child {
  margin-bottom: 0;
}

/* Card header enhancements */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.card-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* Card variants */
.card.success {
  border-left-color: rgba(34, 197, 94, 1);
  background: rgba(34, 197, 94, 0.02);
}

.card.warning {
  border-left-color: rgba(245, 158, 11, 1);
  background: rgba(245, 158, 11, 0.02);
}

.card.error {
  border-left-color: rgba(239, 68, 68, 1);
  background: rgba(239, 68, 68, 0.02);
}
.muted{color:var(--muted);font-size:0.95rem}

.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:var(--gap)}

/* Enhanced Form System */
.form-group {
  margin-bottom: var(--space-4);
  position: relative;
}

label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 300;
  word-break: break-word;
  transition: var(--transition);
}

input, select, textarea, .form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: var(--input);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  transition: var(--transition);
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

input:focus, select:focus, textarea:focus, .form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96,110,122,0.1);
  background: rgba(96,110,122,0.02);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

textarea {
  min-height: 100px;
  resize: vertical;
  font-family: var(--font-body);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23cccccc' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: var(--space-8);
  appearance: none;
}

/* Builder-specific layout tweaks */
/* Make global builder fields two columns (force with !important to override inline styles) */
#globalFields{display:grid !important;grid-template-columns:repeat(2,1fr) !important;gap:12px;align-items:start}
#globalFields > div{display:flex !important;flex-direction:column;min-width:0}
@media (max-width:720px){ #globalFields{grid-template-columns:1fr !important} }

/* Workout builder button theming: make builder buttons brand accent #606E7A with white text */
/* Scope to known builder IDs and controls to avoid affecting other pages */
#generate, #submitWorkout, #addExercise, #clearExercises, #reset, .controls-inline .btn {
  background: var(--accent) !important;
  color: #ffffff !important;
  border: 1px solid var(--accent) !important;
}

/* Ensure transparent/outlined buttons in builder still have dark text when present */
#exercises .card .btn[style*="background:transparent"], #globalFields .btn[style*="background:transparent"] {
  color: var(--text) !important;
  border: 1px solid var(--secondary-light) !important;
}

/* Exercise card inputs: 3 columns inside the builder's exercises list
  Use !important to override any inline `display:flex` used in the generated HTML */
#exercises .inline{display:grid !important;grid-template-columns:repeat(3,1fr) !important;gap:8px;align-items:start}
#exercises .inline > div{display:flex !important;flex-direction:column !important;min-width:0}
/* responsive fallbacks */
@media (max-width:900px){ #exercises .inline{grid-template-columns:repeat(2,1fr) !important} }
@media (max-width:520px){ #exercises .inline{grid-template-columns:1fr !important} }

/* Enhanced Autocomplete and Content Overflow */
.ac-list {
  max-height: 220px;
  overflow: auto;
  word-break: break-word;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-medium);
  z-index: 1000;
}

.ac-list-item {
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-subtle);
}

.ac-list-item:hover {
  background: var(--accent-hover);
}

.ac-list-item:last-child {
  border-bottom: none;
}

.exercise-item input, .exercise-item select, .exercise-item textarea {
  white-space: normal;
}

/* Enhanced Loading States */
.loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-sm);
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--secondary-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Enhanced Status Messages */
.message {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  margin: var(--space-4) 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.5;
  animation: messageEnter 0.3s ease-out;
}

@keyframes messageEnter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: rgba(34, 197, 94, 1);
}

.message.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: rgba(239, 68, 68, 1);
}

.message.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: rgba(245, 158, 11, 1);
}

.message.info {
  background: rgba(96, 110, 122, 0.1);
  border: 1px solid rgba(96, 110, 122, 0.3);
  color: var(--accent);
}

/* Enhanced Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--muted); }
.text-black { color: var(--black); }
.text-accent { color: var(--accent); }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

/* buttons */
/* Enhanced Button System */
.btn, button {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  min-height: var(--button-height);
  line-height: 1;
}

.btn::before, button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: var(--transition-fast);
}

.btn:hover::before, button:hover::before {
  left: 100%;
}

.btn:active, button:active {
  transform: translateY(1px);
}

.btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled, button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled::before, button:disabled::before {
  display: none;
}

/* Primary button */
.btn.primary, .btn-primary, button.primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: var(--shadow-light);
}

.btn.primary:hover, .btn-primary:hover, button.primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-medium);
  transform: translateY(-1px);
}

.btn.primary:active, .btn-primary:active, button.primary:active {
  background: var(--accent-active);
  transform: translateY(0);
  box-shadow: var(--shadow-light);
}

/* Secondary button */
.btn.secondary, .btn-secondary, button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--secondary-light);
}

.btn.secondary:hover, .btn-secondary:hover, button.secondary:hover {
  background: var(--accent-hover);
  border-color: var(--accent);
  color: var(--text);
}

/* Danger button */
.btn.danger, .btn-danger, button.danger {
  background: rgba(239, 68, 68, 1);
  color: var(--white);
}

.btn.danger:hover, .btn-danger:hover, button.danger:hover {
  background: rgba(239, 68, 68, 0.9);
}

/* Success button */
.btn.success, .btn-success, button.success {
  background: rgba(34, 197, 94, 1);
  color: var(--white);
}

.btn.success:hover, .btn-success:hover, button.success:hover {
  background: rgba(34, 197, 94, 0.9);
}

/* Small button */
.btn.small, .btn-small, button.small {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  min-height: 32px;
}

/* Large button */
.btn.large, .btn-large, button.large {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  min-height: 48px;
}

/* Icon button */
.btn.icon, .btn-icon, button.icon {
  padding: var(--space-2);
  min-width: var(--button-height);
  border-radius: var(--radius);
}

/* Loading state */
.btn.loading, button.loading {
  opacity: 0.7;
  cursor: wait;
}

.btn.loading::after, button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Enhanced Modal System */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-large);
  transform: scale(0.9) translateY(-20px);
  transition: var(--transition);
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 300;
  margin: 0;
  color: var(--accent);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius);
  transition: var(--transition);
  line-height: 1;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: rgba(239, 68, 68, 1);
}

.modal-body {
  margin-bottom: var(--space-4);
  line-height: 1.6;
  color: var(--muted);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
}

/* Enhanced Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.table th {
  background: var(--accent-hover);
  font-weight: 300;
  font-size: var(--text-sm);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td {
  color: var(--text);
  font-size: var(--text-sm);
}

.table tr:hover {
  background: var(--accent-hover);
}

.table tr:last-child td {
  border-bottom: none;
}

/* Responsive table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
}

@media (max-width: 768px) {
  .table-responsive {
    font-size: var(--text-xs);
  }
  
  .table th,
  .table td {
    padding: var(--space-2) var(--space-3);
  }
}

/* Enhanced Progress indicators */
.progress {
  width: 100%;
  height: 8px;
  background: var(--secondary-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(51,51,51,0.1);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), rgba(96,110,122,0.8));
  transition: width var(--transition-slow);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Responsive utilities */
@media (max-width: 768px) {
  .d-mobile-none { display: none; }
  .d-mobile-block { display: block; }
  .text-mobile-center { text-align: center; }
  
  .modal-content {
    width: 95%;
    padding: var(--space-4);
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .header {
    padding: var(--space-4) var(--space-6);
  }
  
  .nav {
    padding: 0 var(--space-6);
  }
  
}

/* Enhanced Micro-interactions and Polish */

/* Smooth page transitions */
html {
  scroll-behavior: smooth;
}

/* Enhanced focus management */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  outline-style: solid;
}

/* Interactive hover states for clickable elements */
[role="button"], 
.clickable,
.interactive {
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

[role="button"]:hover,
.clickable:hover,
.interactive:hover {
  transform: translateY(-1px);
}

/* Enhanced selection styles */
::selection {
  background: var(--accent-hover);
  color: var(--text);
}

/* Enhanced scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--secondary-light);
  border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: var(--radius);
  transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* Enhanced tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--secondary-dark);
  color: var(--white);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease-out forwards;
}

[data-tooltip]:hover::after {
  content: '';
  position: absolute;
  bottom: calc(100% - 5px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  color: var(--white);
  z-index: 1000;
  opacity: 0;
  animation: tooltipFadeIn 0.2s ease-out forwards;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Enhanced error states */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Enhanced success states */
.success-pulse {
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Enhanced empty states */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
  color: var(--accent);
}

.empty-state-description {
  margin-bottom: var(--space-4);
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* Enhanced accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
  --border: #ffffff;
  --border-subtle: #cccccc;
  --accent: #606E7A;
  --accent-hover: rgba(96,110,122,0.15);
  }
}

/* Dark mode optimization (already dark but enhance for OLED) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #111111;
  }
}

/* Print styles */
@media print {
  .nav,
  .header,
  .btn,
  button {
    display: none !important;
  }
  
  .card,
  .exercise-item,
  .workout-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #333333;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}

/* Performance optimizations */
.card,
.btn,
.exercise-item,
.workout-card {
  will-change: transform;
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Final layout polish */
.screen.active {
  animation-fill-mode: both;
}

/* Ensure proper stacking context */
.modal { z-index: 2000; }
.nav { z-index: 1000; }
.header { z-index: 1001; }
.ac-list { z-index: 1500; }

/* exercise / workout list styling */
.exercise-list, #workoutTemplates{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:var(--gap)}

/* When the exercise list is used as a full-screen section (the library), force block layout
   so table/list inside can span the full width of the card/container. This overrides the
   generic grid used for small exercise cards elsewhere. */
.screen > .exercise-list,
.screen > #exerciseList {
  display: block;
}

.screen > .exercise-list table.exercise-table,
.screen > #exerciseList table.exercise-table {
  /* Expand slightly beyond the inner padding of the card so the table appears to fill the full card width */
  width: calc(100% + 36px) !important; /* 18px padding each side on .screen card */
  margin-left: -18px;
  margin-right: -18px;
  table-layout: fixed;
}

/* Ensure the table is rendered as block to honor the negative margins safely */
.screen > .exercise-list > table.exercise-table,
.screen > #exerciseList > table.exercise-table { display: block; }

/* On small screens remove the negative margin so layout doesn't overflow horizontally */
@media (max-width:720px) {
  .screen > .exercise-list table.exercise-table,
  .screen > #exerciseList table.exercise-table {
    width: 100% !important;
    margin-left: 0;
    margin-right: 0;
  }
}
.exercise-item p, .workout-card p, .card p{color:var(--muted);margin:6px 0}
.exercise-item ul, .workout-card ul{margin:8px 0 0 18px;padding:0}
.exercise-item ul li, .workout-card ul li{color:var(--muted);margin-bottom:6px;font-size:0.95rem}

/* Workout template specific lists: exercises and reps should match visually */
.workout-ex-list { margin:8px 0 0 18px; padding:0; }
.workout-ex-list li { color:var(--muted); margin-bottom:6px; font-size:0.95rem; line-height:1.4; }
.workout-reps-list { list-style:none; margin:8px 0 0 0; padding:0; }
.workout-reps-list li { color:var(--muted); margin-bottom:6px; font-size:0.95rem; line-height:1.4; }

@media (max-width:720px) {
  /* Stack exercises and reps vertically on small screens for readability */
  .exercise-item > div > div[style*="display:flex"] { flex-direction:column; }
  .workout-reps-list { text-align:left; width:100%; }
}

/* search results */
.exercise-search-container{position:relative}
.exercise-search-results{position:absolute;left:0;right:0;background:var(--card);border:1px solid var(--card-border);max-height:260px;overflow:auto;display:none;z-index:60}
.exercise-search-item{padding:8px;border-bottom:1px solid var(--border-subtle);cursor:pointer;color:var(--text)}
.exercise-search-item:hover{background:var(--accent-hover);color:var(--text)}

/* small helpers */
.text-muted{color:var(--muted)}
.text-black{color:var(--text)}
.text-accent{color:var(--accent)}
.flex{display:flex;gap:12px;align-items:center}

/* section cards: make major titled sections appear as cards */
.screen > .dashboard-grid,
.screen > .recent-activity,
.screen > .workout-form,
.screen > .exercise-list,
.screen > #exerciseList,
.screen > #workoutTemplates,
.screen > .admin-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-subtle);
}

.screen h2 { 
  margin-bottom: 12px; 
  color: var(--accent);
  font-weight: 300;
}

@media (max-width:720px){.grid{grid-template-columns:1fr}.header{padding:14px}.content{padding:14px}}

/* keep some legacy selectors used by JS */
.workout-form{background:transparent;padding:0}
.workout-exercise{background:var(--card);padding:12px;border-radius:6px;border-left:3px solid var(--accent);border:1px solid var(--card-border);}
.alert{padding:10px;border-radius:6px;margin-bottom:12px;background:var(--card);border:1px solid var(--card-border);}

/* inverted logo helper */
.logo-invert { filter: invert(1) saturate(0.9); }

