/* ========== INVITE CODES ========== */
.invite-code-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.invite-code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
}

.invite-code-card .code-text {

  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--lime);
  cursor: pointer;
  transition: opacity 0.15s;
}

.invite-code-card .code-text:hover { opacity: 0.8; }

.invite-code-card .code-status {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
  text-transform: none;
  letter-spacing: 0.08em;
}

.code-available { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.code-used { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.code-expired { background: rgba(85, 85, 85, 0.15); color: var(--text-tertiary); }

/* ========== MODAL ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
  animation: modalBgIn 0.2s ease;
}

@keyframes modalBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Two-button confirm modals (skip sets, cancel workout, …). Hidden by default
   so the markup doesn't need an inline display:none; JS opens with
   style.display = 'flex' as usual. */
#skipSetsModal {
  display: none;
}

.confirm-modal-title {
  margin-bottom: var(--space-sm);
}

.confirm-modal-text {
  margin-bottom: var(--space-md);
}

.confirm-modal-actions {
  display: flex;
  gap: var(--space-sm);
}

.confirm-modal-actions button {
  white-space: nowrap;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(44, 44, 46, 0.85);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
}

/* iOS-style drag handle on modals */
.modal-content::before {
  content: '';
  display: block;
  width: 36px;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  margin: 0 auto var(--space-md);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {

  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(100%); opacity: 0; }
}

/* ========== FLOATING BOTTOM NAV ========== */
.bottom-nav {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  height: 64px;
  background: rgba(22, 22, 24, 0.7);
  backdrop-filter: blur(50px) saturate(1.8);
  -webkit-backdrop-filter: blur(50px) saturate(1.8);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 0.5px rgba(255, 255, 255, 0.06) inset;
}


.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  background: none;
  border: none;
  color: #636366;

  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  min-width: 56px;
  text-transform: none;
  letter-spacing: 0;
  position: relative;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.nav-item.active svg {
  transform: scale(1.1);
}

/* Active dot indicator */
.nav-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.2s, width 0.2s;
  margin-top: 1px;
}

.nav-item.active .nav-dot {
  background: var(--lime);
  width: 14px;
  border-radius: 2px;
}

/* ---- Center FAB ---- */
.nav-fab-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  top: -14px;
  padding: 0 2px;
}

.nav-fab {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--lime);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(204, 255, 0, 0.3), 0 0 0 3px rgba(204, 255, 0, 0.08);
  transition: transform 0.2s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.2s;
  position: relative;
}

.nav-fab svg {
  width: 24px;
  height: 24px;
  stroke: #000;
  stroke-width: 2.2;
}

.nav-fab:active {
  transform: scale(0.92);
}

.nav-fab.active {
  box-shadow: 0 4px 24px rgba(204, 255, 0, 0.45), 0 0 0 3px rgba(204, 255, 0, 0.15);
  transform: scale(1.08);
}

.nav-fab-label {

  font-size: 10px;
  font-weight: 500;
  color: #636366;
  margin-top: 4px;
  transition: color 0.2s;
}

.nav-fab.active + .nav-fab-label {
  color: var(--lime);
}

/* Badge on FAB */
.nav-fab .nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
}

.nav-badge {
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  letter-spacing: 0;
  text-transform: none;
}

.nav-badge.visible {
  display: block;
}

.nav-item.active {
  color: var(--lime);
}

.nav-item:active {
  transform: scale(0.9);
}

.nav-item:hover { color: #8E8E93; }

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  max-width: 420px;
  margin: 0 auto;
  padding: 12px 20px;
  background: rgba(30,30,30,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 300;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }

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

.toast-exit {
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: all 0.2s ease;
}

/* ========== CONFETTI / PR CELEBRATION ========== */
.confetti-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  animation: fadeIn 0.2s ease;
}

.confetti-content {
  text-align: center;
  z-index: 2;
}

.pr-text {

  font-size: 5rem;
  font-weight: 400;
  color: var(--lime);
  letter-spacing: 0.08em;
  text-transform: none;
  animation: prPulse 0.5s ease infinite alternate;
  line-height: 1;
  text-shadow: 0 0 60px rgba(204, 255, 0, 0.4);
}

.pr-details {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-top: var(--space-md);
  font-weight: 500;
}

@keyframes prPulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confetti-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 1px;
  animation: confettiFall 2.5s ease-in forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(-20vh) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* ========== UTILITIES ========== */
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }

/* ========== RESPONSIVE ========== */
@media (min-width: 768px) {
  .modal {
    align-items: center;
  }

  .modal-content {
    border-radius: 12px;
    max-width: 500px;
    border-bottom: 1px solid var(--border-primary);
  }

  .badge-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 390px) {
  .view-content {
    padding: var(--space-sm);
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xs);
  }

  .stat-value { font-size: 1.5rem; }

  .set-table-header,
  .set-row {
    grid-template-columns: 32px 1fr 70px 60px 40px;
    gap: 4px;
  }

  .greeting-section h2 {
    font-size: 1.5rem;
  }

  .macro-ring-value {
    font-size: 0.75rem;
  }
}

