/*
 * This is a manifest file that'll be compiled into app.css, which will include all the files
 * listed below.
 *
 * Any CSS file within this directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require tailwind
 *= require_self
 */

/* Responsive navbar: functionality now handled via Tailwind classes in the view */


/* Z-Index Management - CSS Custom Properties */
:root {
  --z-tooltip: 99999;
  --z-modal: 10000;
  --z-dropdown: 1000;
  --z-card: 1;
  --ui-radius-md: 0.75rem;
  --ui-radius-lg: 1rem;
  --ui-border: #e5e7eb;
  --ui-border-strong: #d1d5db;
  --ui-text: #111827;
  --ui-muted: #6b7280;
  --ui-surface: #ffffff;
  --ui-primary: #2563eb;
  --ui-primary-hover: #1d4ed8;
  --ui-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --ui-shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body {
  color: var(--ui-text);
}

.app-shell {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(16, 185, 129, 0.08), transparent 60%),
    radial-gradient(1200px 500px at 90% -10%, rgba(37, 99, 235, 0.08), transparent 60%),
    #f8fafc;
  min-height: 100vh;
}

.ui-surface-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}

.ui-surface-card:hover {
  box-shadow: var(--ui-shadow-md);
  border-color: var(--ui-border-strong);
}

.ui-input-field {
  width: 100%;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-md);
  background: #fff;
  color: var(--ui-text);
  min-height: 2.75rem;
  padding: 0.625rem 0.9rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ui-input-field:hover {
  border-color: var(--ui-border-strong);
}

.ui-input-field:focus {
  outline: none;
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.ui-input-field::placeholder {
  color: #9ca3af;
}

/* Fitness-oriented page primitives shared by athlete and trainer areas */
.fitness-page {
  min-height: 100vh;
  background:
    radial-gradient(1100px 420px at 6% -8%, rgba(16, 185, 129, 0.11), transparent 62%),
    radial-gradient(1100px 420px at 94% -8%, rgba(37, 99, 235, 0.11), transparent 62%),
    linear-gradient(180deg, #f8fafc 0%, #f7fafc 45%, #f6f9ff 100%);
}

.fitness-container {
  max-width: 80rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .fitness-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .fitness-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.fitness-header {
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .fitness-header {
    margin-bottom: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .fitness-header {
    margin-bottom: 1.5rem;
  }
}

.fitness-title {
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.015em;
  background: linear-gradient(92deg, #059669 0%, #2563eb 55%, #1d4ed8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (min-width: 640px) {
  .fitness-title {
    font-size: 2rem;
  }
}

@media (min-width: 1024px) {
  .fitness-title {
    font-size: 2.4rem;
  }
}

.fitness-subtitle {
  color: #4b5563;
  font-size: 0.95rem;
}

@media (min-width: 640px) {
  .fitness-subtitle {
    font-size: 1rem;
  }
}

@media (min-width: 1024px) {
  .fitness-subtitle {
    font-size: 1.0625rem;
  }
}

.fitness-section-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(229, 231, 235, 0.95);
  border-radius: 1rem;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.fitness-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.fitness-kicker {
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
}

.fitness-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-fitness-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  appearance: none;
  padding: 0.625rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  background: linear-gradient(96deg, #0ea5e9 0%, #2563eb 45%, #1d4ed8 100%);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.btn-fitness-primary:hover {
  filter: saturate(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.btn-fitness-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 6px rgba(37, 99, 235, 0.32);
}

.btn-fitness-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.625rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.97);
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.btn-fitness-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-fitness-secondary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 6px rgba(100, 116, 139, 0.3);
}

.btn-fitness-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.625rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(217, 119, 6, 0.18);
  color: #b45309;
  font-size: 0.875rem;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(254, 243, 199, 0.94));
  box-shadow: 0 8px 18px rgba(245, 158, 11, 0.14);
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.btn-fitness-warning:hover {
  border-color: rgba(217, 119, 6, 0.3);
  box-shadow: 0 10px 22px rgba(245, 158, 11, 0.18);
  transform: translateY(-1px);
}

.btn-fitness-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.625rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(220, 38, 38, 0.16);
  color: #b91c1c;
  font-size: 0.875rem;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.94));
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.12);
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.btn-fitness-danger:hover {
  border-color: rgba(220, 38, 38, 0.26);
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.16);
  transform: translateY(-1px);
}

.touch-checkbox {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0.35rem;
  border-color: #94a3b8;
}

@media (max-width: 1023px) {
  .touch-checkbox {
    width: 1.35rem;
    height: 1.35rem;
  }
}

.fitness-filter-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.93));
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.fitness-empty-state {
  border: 1px dashed #cbd5e1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.9));
  border-radius: 1rem;
}

.fitness-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.7rem 0.95rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(203, 213, 225, 0.95);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, color 140ms ease;
}

.fitness-card-link:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.fitness-card-link--accent {
  color: #2563eb;
  border-color: rgba(147, 197, 253, 0.65);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.fitness-card-link--teal {
  color: #0f766e;
  border-color: rgba(153, 246, 228, 0.7);
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.96), rgba(255, 255, 255, 0.98));
}

.fitness-card-link--indigo {
  color: #4338ca;
  border-color: rgba(199, 210, 254, 0.78);
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.fitness-card-link--purple {
  color: #7c3aed;
  border-color: rgba(221, 214, 254, 0.78);
  background: linear-gradient(180deg, rgba(245, 243, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.profile-menu-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.profile-menu-card:hover {
  transform: translateY(-2px);
  border-color: rgba(148, 163, 184, 0.55);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.11);
}

/* Workout experience surfaces */
.workout-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 380px at 8% -12%, rgba(14, 165, 233, 0.13), transparent 62%),
    radial-gradient(900px 380px at 92% -10%, rgba(16, 185, 129, 0.13), transparent 64%),
    linear-gradient(180deg, #f8fafc 0%, #f5f9ff 46%, #f0fdf4 100%);
}

.workout-content {
  max-width: 64rem;
  margin: 0 auto;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

@media (min-width: 640px) {
  .workout-content {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
}

.workout-status-panel {
  border-radius: 1rem;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.workout-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.1;
  font-weight: 700;
}

.workout-status-chip.workout-status-chip-success {
  background: linear-gradient(180deg, rgba(236, 253, 245, 1), rgba(220, 252, 231, 0.94));
  border-color: rgba(110, 231, 183, 0.85);
  color: #166534;
}

.workout-status-chip.workout-status-chip-progress {
  background: linear-gradient(180deg, rgba(239, 246, 255, 1), rgba(219, 234, 254, 0.94));
  border-color: rgba(147, 197, 253, 0.8);
  color: #1e40af;
}

.workout-soft-notice {
  border-radius: 0.8rem;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.workout-exercise-shell {
  border-radius: 1rem;
  border-width: 2px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.workout-exercise-shell.workout-exercise-shell-active {
  border-color: rgba(59, 130, 246, 0.65);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.95));
}

.workout-exercise-shell.workout-exercise-shell-idle {
  border-color: rgba(203, 213, 225, 0.88);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
}

.workout-exercise-shell.workout-exercise-shell-superset {
  border-color: rgba(196, 181, 253, 0.92);
  background: linear-gradient(180deg, rgba(245, 243, 255, 0.95), rgba(255, 255, 255, 0.95));
}

.workout-cta-primary {
  background: linear-gradient(96deg, #0284c7 0%, #2563eb 55%, #1d4ed8 100%);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

.workout-cta-success {
  background: linear-gradient(96deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.22);
}

/* Tooltip Portal Container - Always on top */
/* Use isolation: isolate to create a new stacking context that's guaranteed to be above everything */
#tooltip-portal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: visible !important;
  pointer-events: none !important;
  z-index: 2147483647 !important;
  /* Maximum z-index value */
  isolation: isolate !important;
  /* Create new stacking context */
}


/* Tooltip content styling - ensure it's always on top */
#tooltip-portal>[role="tooltip"] {
  pointer-events: auto !important;
  position: fixed !important;
  z-index: 2147483647 !important;
  /* Explicit maximum z-index */
  /* Use transform to create new stacking context above everything */
  transform: translate3d(0, 0, 0) !important;
  will-change: transform !important;
  /* Hint browser for optimization */
  overflow: visible !important;
  width: max-content !important;
  min-width: 0 !important;
  height: auto !important;
}

/* Ensure tooltip inner content displays correctly */
#tooltip-portal>[role="tooltip"]>div {
  display: block !important;
  position: relative !important;
  z-index: inherit !important;
  width: max-content !important;
  min-width: 0 !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* Search input: app radius + enough height so icon and text are not clipped */
[data-search-input-wrapper] {
  min-height: 2.75rem;
}

[data-search-input-wrapper] input {
  border-radius: 0.75rem !important;
  min-height: 2.75rem;
  box-sizing: border-box;
  padding-left: 3.5rem !important;
  /* gap between icon and placeholder so they never overlay */
}

/* Blog article typography */
.blog-content {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #111827; /* gray-900 */
  max-width: 42rem;
  margin-inline: auto;
}

.blog-content p + p {
  margin-top: 1rem;
}

.blog-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.blog-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.blog-content ul,
.blog-content ol {
  padding-left: 1.25rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.blog-content li + li {
  margin-top: 0.25rem;
}

/* Mobile navigation: larger touch targets + active tab emphasis */
#mobile-navbar .mobile-nav-dock {
  margin: 0 auto;
  width: min(100vw, 60rem);
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-bottom: 0;
  border-top-left-radius: 1.15rem;
  border-top-right-radius: 1.15rem;
  background:
    radial-gradient(240px 54px at 50% -12px, rgba(255, 255, 255, 0.85), transparent 75%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.95));
  box-shadow:
    0 -8px 24px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.mobile-nav-dock[data-role="athlete"] {
  border-top-color: rgba(16, 185, 129, 0.4);
}

.mobile-nav-dock[data-role="trainer"] {
  border-top-color: rgba(37, 99, 235, 0.45);
}

.mobile-nav-dock[data-role="admin"] {
  border-top-color: rgba(147, 51, 234, 0.45);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  min-height: 3.5rem;
  border-radius: 0.95rem;
  position: relative;
  transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.mobile-nav-item:hover {
  background: rgba(148, 163, 184, 0.15);
}

#mobile-navbar a.mobile-nav-item[aria-current="page"] {
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.28),
    0 6px 16px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

#mobile-navbar .mobile-nav-item:first-child {
  border-top-left-radius: 1.05rem;
}

#mobile-navbar .mobile-nav-item:last-child {
  border-top-right-radius: 1.05rem;
}

#mobile-navbar a.mobile-nav-item:first-child[aria-current="page"] {
  border-top-left-radius: 1.05rem;
  border-top-right-radius: 0.85rem;
  border-bottom-left-radius: 0;
}

#mobile-navbar a.mobile-nav-item:last-child[aria-current="page"] {
  border-top-left-radius: 0.85rem;
  border-top-right-radius: 1.05rem;
  border-bottom-right-radius: 0;
}

#mobile-navbar .mobile-nav-item svg {
  transition: transform 150ms ease, color 150ms ease;
}

#mobile-navbar a.mobile-nav-item[aria-current="page"] svg {
  transform: translateY(-1px) scale(1.03);
}

#mobile-navbar a.mobile-nav-item:focus-visible {
  outline: none;
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.42),
    0 0 0 3px rgba(37, 99, 235, 0.28);
}

#mobile-navbar .mobile-nav-item span {
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Rest timer surface + urgency state */
.rest-timer-container {
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.94), rgba(219, 234, 254, 0.86));
  border-color: rgb(147 197 253);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.14);
}

.rest-timer-label {
  letter-spacing: 0.08em;
}

.rest-timer-display {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.rest-timer-action {
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.rest-timer-action:hover {
  transform: translateY(-1px);
}

.rest-timer-container.rest-timer-urgent {
  background: linear-gradient(180deg, rgba(254, 252, 232, 0.95), rgba(254, 243, 199, 0.9));
  border-color: rgb(245 158 11);
  box-shadow: 0 8px 16px rgba(245, 158, 11, 0.2);
}

.rest-timer-container.rest-timer-urgent .rest-timer-label,
.rest-timer-container.rest-timer-urgent .rest-timer-display {
  color: rgb(146 64 14) !important;
}

/* Rest timer: completion state */
.rest-timer-container.rest-timer-complete {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.95), rgba(220, 252, 231, 0.92));
  border-color: rgb(34 197 94);
  box-shadow: 0 8px 16px rgba(34, 197, 94, 0.18);
  animation: rest-timer-pulse 1.5s ease-in-out 2;
}

/* Stable app chrome spacing: avoid runtime Tailwind class mismatches */
.app-main {
  padding-top: 3.5rem;
}

.app-flash-stack {
  top: 3.5rem;
}

body.user-signed-in {
  /* Match mobile bottom nav height (h-14 = 3.5rem) + safe area */
  padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
}

.app-footer-signed-in {
  padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  /* Signed-in desktop nav uses lg:h-16 (4rem). */
  body.user-signed-in .app-main {
    padding-top: 4rem;
  }

  body.user-signed-in .app-flash-stack {
    top: 4rem;
  }

  body.user-signed-in {
    padding-bottom: 0;
  }

  .app-footer-signed-in {
    margin-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-item,
  #mobile-navbar .mobile-nav-item svg,
  .rest-timer-action,
  .btn-fitness-primary,
  .btn-fitness-secondary,
  .ui-surface-card,
  .workout-exercise-shell {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}

@keyframes rest-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}
