/*
 * NutriLift — Exercise Picker Modal
 * Prefix: epk- (Exercise PicKer)
 *
 * Dipende da: css/theme.css, css/training-wizard.css
 * (riusa .tpw-hdr, .tpw-spinner, @keyframes tpwFadeIn/tpwSlideUp)
 */

/* ─────────────────────────────────────────────────────────────────
   OVERLAY + MODAL SHELL
   ───────────────────────────────────────────────────────────────── */
.epk-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-heavy, rgba(0, 0, 0, 0.5));
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: tpwFadeIn 0.18s ease;
}

.epk-box {
  background: var(--bg-surface);
  border-radius: 16px;
  width: 100%;
  max-width: 940px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px var(--shadow-lg, rgba(0, 0, 0, 0.25));
  overflow: hidden;
  animation: tpwSlideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────────────────────────
   SEARCH BAR
   ───────────────────────────────────────────────────────────────── */
.epk-search-bar {
  padding: 14px 20px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface);
}

.epk-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.epk-search-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
  opacity: 0.45;
  line-height: 1;
}

.epk-search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1.5px solid var(--border-medium);
  border-radius: 10px;
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.epk-search-input:focus {
  outline: none;
  border-color: var(--gradient-app-start);
  box-shadow: 0 0 0 3px var(--shadow-brand-sm, rgba(102, 126, 234, 0.15));
}
.epk-search-input::placeholder { color: var(--text-muted); }

.epk-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 6px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}
.epk-search-clear:hover { color: var(--text-primary); }

/* ─────────────────────────────────────────────────────────────────
   FILTER CHIPS (muscle group)
   ───────────────────────────────────────────────────────────────── */
.epk-filters {
  padding: 8px 20px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  scrollbar-width: none;
}
.epk-filters::-webkit-scrollbar { display: none; }

.epk-filters-inner {
  display: flex;
  gap: 6px;
  width: max-content;
  padding-bottom: 2px;
}

.epk-chip {
  padding: 5px 12px;
  border: 1.5px solid var(--border-medium);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
}
.epk-chip:hover:not(.is-active) {
  border-color: var(--gradient-app-start);
  color: var(--text-primary);
  background: var(--bg-surface-raised);
}
.epk-chip.is-active {
  background: var(--gradient-app);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px var(--shadow-brand-md, rgba(102, 126, 234, 0.3));
}

/* ─────────────────────────────────────────────────────────────────
   BODY — scrollable exercise list
   ───────────────────────────────────────────────────────────────── */
.epk-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  scrollbar-width: none;
}

.epk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.epk-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.epk-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ─────────────────────────────────────────────────────────────────
   EXERCISE ITEM
   ───────────────────────────────────────────────────────────────── */
.epk-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.epk-item:hover:not(.is-selected) {
  border-color: var(--gradient-app-start);
  background: var(--bg-surface-raised);
}
.epk-item.is-selected {
  border-color: var(--gradient-app-start);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.07) 0%, rgba(118, 75, 162, 0.04) 100%);
  box-shadow: 0 2px 8px var(--shadow-brand-sm, rgba(102, 126, 234, 0.1));
}

/* Check circle */
.epk-item-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.18s;
}
.epk-item.is-selected .epk-item-check {
  background: var(--gradient-app);
  border-color: transparent;
  color: #fff;
}

/* Type badge */
.epk-item-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border-radius: 5px;
  flex-shrink: 0;
  line-height: 1.4;
}
.epk-item-type--compound  { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
.epk-item-type--isolation { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.epk-item-type--core      { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.epk-item-type--cardio    { background: rgba(239, 68, 68, 0.12);  color: #dc2626; }
.epk-item-type--mobility  { background: rgba(6, 182, 212, 0.12);  color: #0891b2; }
.epk-item-type--other     { background: rgba(100, 116, 139, 0.12); color: #475569; }

/* Info */
.epk-item-info {
  flex: 1;
  min-width: 0;
}
.epk-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.epk-item-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  line-height: 1.3;
}
.epk-dot { color: var(--text-muted); }

/* Fonte badge */
.epk-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.epk-badge--personal {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.1));
  color: var(--gradient-app-start, #667eea);
}

/* ─────────────────────────────────────────────────────────────────
   TRAY — selected exercises
   ───────────────────────────────────────────────────────────────── */
.epk-tray {
  padding: 10px 16px;
  background: var(--bg-surface-raised);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.epk-tray::-webkit-scrollbar { display: none; }

.epk-tray-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.epk-tray-chips {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.epk-tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--gradient-app);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.epk-tray-chip-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  transition: color 0.1s;
}
.epk-tray-chip-remove:hover { color: #fff; }

/* ─────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────── */
.epk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-surface-raised);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.epk-count-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .epk-overlay { align-items: flex-end; padding: 0; }
  .epk-box {
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
  }
}
