/* ==========================================================================
   Styrketræning PWA - Dark Theme & Touch Optimized CSS
   ========================================================================== */

:root {
  --bg-main: #0c0d0e;
  --bg-card: #18191d;
  --bg-card-hover: #22232a;
  --bg-input: #121316;
  --border-color: #272832;
  --border-focus: #3b82f6;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  
  --success: #10b981;
  --success-hover: #059669;
  --success-light: rgba(16, 185, 129, 0.15);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.15);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --nav-height: 64px;
  --header-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 24px);
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  user-select: auto;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(18, 19, 22, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
}

.brand-icon {
  font-size: 1.4rem;
}

.header-status {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

/* Container */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

/* View Pages */
.view-page {
  display: none;
  animation: fadeIn 0.15s ease-out forwards;
}

.view-page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Page Titles & Headers */
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: -10px;
  margin-bottom: 16px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: var(--success-hover);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-secondary {
  background: #2a2b36;
  color: var(--text-main);
}
.btn-secondary:hover {
  background: #353745;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  background: #272832;
  color: var(--text-muted);
}
.btn-icon:hover {
  color: var(--text-main);
  background: #353745;
}

.btn-full {
  width: 100%;
}

/* Inputs & Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* Search and Filter Bar */
.search-bar {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px 10px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-main);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Rest Timer Widget */
.rest-timer-banner {
  display: none;
  position: sticky;
  top: calc(var(--header-height) + 8px);
  z-index: 40;
  background: #1f1b2e;
  border: 1px solid #7c3aed;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.25);
  animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
  from { box-shadow: 0 4px 14px rgba(124, 58, 237, 0.2); }
  to { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45); }
}

.rest-timer-banner.active {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timer-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-display {
  font-size: 1.6rem;
  font-weight: 800;
  color: #c4b5fd;
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: 0.8rem;
  color: #a78bfa;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.timer-controls {
  display: flex;
  gap: 6px;
}

/* workout-live-time moved to bottom of file */

/* Live pulsing dot */
.live-pulse {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  background: #ef4444;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Exercise track card */
.exercise-track-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Last performance badge */
.last-perf-badge {
  font-size: 0.78rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Set Table */
.set-table {
  width: 100%;
  border-collapse: collapse;
}

.set-table th {
  padding: 10px 12px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.set-table td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.set-table td:first-child {
  font-weight: 700;
  color: var(--text-muted);
  width: 44px;
}

.set-input {
  width: 100%;
  max-width: 80px;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.set-input:focus {
  border-color: var(--primary);
  background: #1b1e26;
}

.set-check-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: #262732;
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.set-row.completed {
  background: rgba(16, 185, 129, 0.04);
}

.set-row.completed .set-check-btn {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.exercise-card-footer {
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #18191d;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Analytics & Progression Styles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: #141518;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  height: 100%;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.67rem;
  font-weight: 600;
  transition: color 0.15s ease;
  cursor: pointer;
  gap: 3px;
  padding: 2px 1px;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  transition: transform 0.15s ease;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: #1f2937;
  color: #f3f4f6;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s ease-out forwards;
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}
.toast.toast-error {
  border-left: 4px solid var(--danger);
}
.toast.toast-info {
  border-left: 4px solid var(--primary);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ============================================================
   Workout Active Header – restructured
   ============================================================ */
.workout-active-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: #1a1b22;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.workout-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workout-header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.workout-name-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 4px 6px;
  min-height: 32px;
  max-width: 190px;
  width: 190px;
  outline: none;
  transition: border-color 0.15s ease;
}
.workout-name-input:focus {
  border-color: var(--border-focus);
  background: rgba(59,130,246,0.06);
}

.workout-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.workout-live-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  padding-left: 22px; /* aligns under title past the pulse dot */
}

/* Ghost danger button – Afbryd */
.btn-ghost-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-ghost-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ============================================================
   Exercise card header – compact action buttons
   ============================================================ */
.exercise-card-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.exercise-card-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.exercise-name-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.exercise-meta-tag {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 12px;
  background: #2a2b36;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.exercise-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* Compact icon+text autofill button */
.btn-autofill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  min-height: 30px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-autofill:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--primary);
}

/* Compact icon-only remove button */
.btn-remove-ex-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-remove-ex-icon:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ============================================================
   Custom Confirm Dialog Modal
   ============================================================ */
.confirm-card {
  max-width: 340px;
  text-align: center;
  padding: 28px 24px 20px;
  border-radius: 18px;
}

.confirm-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  margin-bottom: 14px;
}

.confirm-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-actions .btn {
  min-width: 110px;
}

/* ============================================================
   Profile Switcher & Header Badge
   ============================================================ */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #23242c;
  border: 1px solid var(--border-color);
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-profile-btn:hover {
  background: #2d2e38;
  border-color: var(--primary);
}

.header-profile-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: var(--primary);
  line-height: 1;
}

.header-profile-arrow {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Profile Dropdown */
.profile-dropdown {
  position: fixed;
  top: calc(var(--header-height) + 4px);
  right: 16px;
  z-index: 95;
  background: #1b1c22;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 220px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 8px;
  animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.profile-dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--primary);
}

.profile-dropdown-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.profile-dropdown-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

.profile-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.profile-dropdown-item:hover {
  background: #272832;
}

/* ============================================================
   Netflix Profile Selector (Overlay)
   ============================================================ */
.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 11, 14, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}

.profile-selector-container {
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.profile-brand-icon {
  font-size: 2.5rem;
  margin-bottom: 6px;
}

.profile-selector-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.profile-selector-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.profile-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 20px;
  justify-content: center;
  margin-bottom: 36px;
  padding: 0 10px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.profile-card:hover {
  transform: translateY(-4px) scale(1.04);
}

.profile-card:active {
  transform: scale(0.96);
}

.profile-avatar-box {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 2px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.profile-card:hover .profile-avatar-box {
  border-color: #ffffff;
  box-shadow: 0 12px 32px rgba(255, 255, 255, 0.15);
}

.profile-card-name {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: color 0.15s;
}

.profile-card:hover .profile-card-name {
  color: #ffffff;
}

.profile-lock-tag {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.profile-card.add-card .profile-avatar-box {
  background: transparent;
  border: 2px dashed #3a3b48;
  color: var(--text-dim);
  font-size: 2.2rem;
}

.profile-card.add-card:hover .profile-avatar-box {
  border-color: var(--primary);
  color: var(--primary);
}

.profile-selector-footer {
  margin-top: 20px;
}

/* ============================================================
   PIN Code Keypad Modal
   ============================================================ */
.pin-card {
  max-width: 320px;
  text-align: center;
  padding: 28px 20px 24px;
}

.pin-avatar-wrap {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.pin-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.pin-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 24px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #272832;
  border: 1.5px solid #3f4052;
  transition: all 0.15s ease;
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
  transform: scale(1.15);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 240px;
  margin: 0 auto;
}

.pin-key {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #23242d;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
  user-select: none;
}

.pin-key:active {
  background: #373847;
  transform: scale(0.92);
}

.pin-key-cancel, .pin-key-delete {
  font-size: 1.1rem;
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
}

.pin-error-text {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 14px;
  animation: shake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Avatar chips in editor */
.avatar-icon-chips, .avatar-color-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.avatar-chip {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #23242d;
  border: 2px solid transparent;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.avatar-chip.active {
  border-color: var(--primary);
  background: #2e303c;
  transform: scale(1.1);
}

.color-chip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.color-chip.active {
  border-color: #ffffff;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Fase 2: Gamification, Gruppe-Leaderboard & Aktivitetsfeed
   ========================================================================== */

/* Subtab switcher buttons */
.community-tabs {
  display: flex;
  gap: 6px;
  background: #141518;
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.community-tab-btn {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.community-tab-btn.active {
  background: #23252d;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border-color: var(--border-color);
}

/* Period selector bar */
.leaderboard-period-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.period-chip {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.period-chip.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--primary);
  color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

/* Podium Visualization */
.leaderboard-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  margin: 10px 0 22px 0;
  padding: 8px 4px 0 4px;
  min-height: 200px;
}

.podium-slot {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.podium-user-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
  width: 100%;
}

.podium-crown {
  font-size: 1.4rem;
  line-height: 1;
  margin-bottom: -4px;
  animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.podium-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.podium-slot.rank-1 .podium-avatar {
  width: 60px;
  height: 60px;
  font-size: 1.8rem;
  border: 3px solid #f59e0b;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.45);
}

.podium-name {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 6px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.podium-score {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.podium-block {
  width: 100%;
  border-radius: 10px 10px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.podium-slot.rank-1 .podium-block {
  height: 100px;
  background: linear-gradient(180deg, #d97706 0%, #78350f 100%);
  border-top: 2px solid #fbbf24;
}

.podium-slot.rank-2 .podium-block {
  height: 75px;
  background: linear-gradient(180deg, #64748b 0%, #334155 100%);
  border-top: 2px solid #cbd5e1;
}

.podium-slot.rank-3 .podium-block {
  height: 55px;
  background: linear-gradient(180deg, #b45309 0%, #451a03 100%);
  border-top: 2px solid #f97316;
}

/* Leaderboard Table List */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #141519;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.leaderboard-row.is-active-user {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.leaderboard-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.leaderboard-rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #23252e;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.leaderboard-row.rank-1 .leaderboard-rank-badge {
  background: #f59e0b;
  color: #111827;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.leaderboard-row.rank-2 .leaderboard-rank-badge {
  background: #94a3b8;
  color: #0f172a;
}
.leaderboard-row.rank-3 .leaderboard-rank-badge {
  background: #d97706;
  color: #ffffff;
}

.leaderboard-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.leaderboard-user-info {
  display: flex;
  flex-direction: column;
}

.leaderboard-user-name {
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-subinfo {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.leaderboard-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.leaderboard-volume {
  font-weight: 800;
  font-size: 1rem;
  color: #10b981;
  font-variant-numeric: tabular-nums;
}

.leaderboard-streak-tag {
  font-size: 0.74rem;
  color: #f59e0b;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Feed Container & Cards */
.community-feed-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}

.feed-card.has-pr {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, #1d1a14 0%, #18191d 40%);
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.feed-author-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.feed-author-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.feed-time {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.feed-event-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.4px;
}

.feed-event-tag.tag-pr {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.feed-event-tag.tag-workout {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.feed-body {
  margin-bottom: 12px;
}

.feed-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.feed-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* PR Highlighting callout in feed */
.feed-pr-callout {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-pr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 600;
}

.feed-pr-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fef08a;
}

.feed-pr-item-stat {
  font-weight: 800;
  color: #f59e0b;
}

/* Reactions Bar */
.feed-reactions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.feed-react-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #20222a;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.feed-react-btn:active {
  transform: scale(0.92);
}

.feed-react-btn.reacted {
  background: rgba(59, 130, 246, 0.22);
  border-color: #3b82f6;
  color: #93c5fd;
  font-weight: 700;
}

.feed-react-count {
  font-size: 0.78rem;
  font-weight: 700;
}

/* Badges Showcase Grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.badge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.badge-card.unlocked {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, #18191d 0%, #201b12 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.badge-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.badge-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #23252e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.badge-card.unlocked .badge-icon-box {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.badge-info {
  flex: 1;
}

.badge-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.badge-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
}

.badge-card.unlocked .badge-title {
  color: #fbbf24;
}

.badge-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-status-pill.pill-unlocked {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-status-pill.pill-locked {
  background: #22232a;
  color: var(--text-dim);
}

.badge-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 6px;
}

.badge-achievers {
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* PR Alert Banner inside Workout Summary Modal */
.summary-pr-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: left;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
  animation: pulse-border 1.5s infinite alternate;
}

@keyframes pulse-border {
  from { box-shadow: 0 0 8px rgba(245, 158, 11, 0.2); }
  to { box-shadow: 0 0 20px rgba(245, 158, 11, 0.5); }
}

.summary-pr-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.summary-pr-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.5px;
}

.summary-pr-details {
  font-size: 0.82rem;
  color: #fef08a;
  margin-top: 2px;
}

