/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets 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
 * 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.
 *


 */

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 4px;
}

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

/* Lab background */
.lab-grid {
  background-color: var(--surface);
}

/* Clean sans-serif with slightly tighter tracking */
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.011em;
}

/* Primary buttons - pill shaped, muted terracotta */
.btn-primary {
  background-color: #b45a3c;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background-color 0.15s ease;
  display: inline-block;
  text-align: center;
}

.btn-primary:hover {
  background-color: #9a4d33;
}

/* Secondary buttons - subtle outline style */
.btn-secondary {
  background-color: var(--secondary-bg);
  color: var(--secondary-text);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid var(--secondary-border);
  transition: all 0.15s ease;
  display: inline-block;
  text-align: center;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover-bg);
  color: var(--secondary-hover-text);
}

/* Danger button */
.btn-danger {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid var(--danger-border);
  transition: all 0.15s ease;
  display: inline-block;
  text-align: center;
}

.btn-danger:hover {
  background-color: var(--danger-hover-bg);
}

/* Cards with rounder corners and subtle depth */
.lab-card {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
}

.light .lab-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Hide number input spin buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Input fields - rounded, subtle */
.lab-input {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--input-text);
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
}

.lab-input:focus {
  outline: none;
  border-color: #b45a3c;
}

.lab-input::placeholder {
  color: var(--input-placeholder);
}

/* Select inputs */
.lab-select {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--input-text);
  font-size: 0.875rem;
}

/* Status badges - pill shaped */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: var(--badge-success-bg);
  color: var(--badge-success-text);
}

.badge-warning {
  background-color: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

.badge-danger {
  background-color: var(--badge-danger-bg);
  color: var(--badge-danger-text);
}

.badge-neutral {
  background-color: var(--badge-neutral-bg);
  color: var(--badge-neutral-text);
}

.badge-rm {
  background-color: var(--badge-rm-bg);
  color: var(--badge-rm-text);
}

/* Tooltip */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--tooltip-bg);
  border: 1px solid var(--tooltip-border);
  border-radius: 0.5rem;
  color: var(--tooltip-text);
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 100;
  max-width: min(360px, calc(100vw - 2rem));
  width: max-content;
  white-space: normal;
  text-align: left;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

.light .tooltip::after {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Combobox dropdown list */
.lab-combobox-list {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--surface);
}

.lab-combobox-list::-webkit-scrollbar {
  width: 6px;
}

.lab-combobox-list::-webkit-scrollbar-track {
  background: var(--surface);
}

.lab-combobox-list::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 3px;
}

/* Pagination - pagy */
nav.pagy {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

nav.pagy a {
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--pagination-text);
  transition: all 0.15s ease;
}

nav.pagy a:hover {
  background-color: var(--pagination-hover-bg);
  color: var(--pagination-hover-text);
}

nav.pagy a[aria-disabled="true"][aria-current="page"] {
  background-color: #b45a3c;
  color: white;
}

nav.pagy a[role="separator"] {
  color: var(--pagination-separator);
}

nav.pagy a[aria-disabled="true"] {
  pointer-events: none;
}

/* Sidebar navigation links (mobile only) */
.sidebar-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  color: var(--nav-text);
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease;
}

.sidebar-nav-link:hover {
  color: var(--nav-hover-text);
}

/* Chat input safe area for devices with home indicator */
.chat-input-area {
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

/* Mobile bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--surface-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-default);
  z-index: 50;
  padding: 0.375rem 0 calc(0.375rem + env(safe-area-inset-bottom));
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  color: var(--nav-text);
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.25rem 0;
  transition: color 0.15s ease;
}

.bottom-nav-link:hover {
  color: var(--nav-hover-text);
}

.bottom-nav-link.active {
  color: var(--nav-active-text);
}

/* Flash message auto-dismiss */
.flash-fade-out {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Progress bar fill */
.progress-bar-fill {
  background-color: #b45a3c;
  transition: width 0.3s ease;
}

/* Step transition animation */
.step-fade-enter {
  opacity: 0;
  transform: translateX(8px);
}

.step-fade-active {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Sparklines */
.sparkline {
  display: inline-block;
  width: 50px;
  height: 20px;
  vertical-align: middle;
}

.sparkline-line {
  fill: none;
  stroke: #b45a3c;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Chat markdown prose */
.prose-chat {
  font-size: 0.9375rem;
  line-height: 1.7;
}

.prose-chat h1,
.prose-chat h2,
.prose-chat h3,
.prose-chat h4 {
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5rem;
  margin-bottom: 0.625rem;
}

.prose-chat h1 { font-size: 1.25rem; }
.prose-chat h2 { font-size: 1.125rem; }
.prose-chat h3 { font-size: 1rem; }

.prose-chat h1:first-child,
.prose-chat h2:first-child,
.prose-chat h3:first-child {
  margin-top: 0;
}

.prose-chat p {
  margin-bottom: 0.875rem;
}

.prose-chat p:last-child {
  margin-bottom: 0;
}

.prose-chat ul,
.prose-chat ol {
  padding-left: 1.5rem;
  margin-bottom: 0.875rem;
}

.prose-chat ul { list-style-type: disc; }
.prose-chat ol { list-style-type: decimal; }

.prose-chat li {
  margin-bottom: 0.375rem;
}

.prose-chat li:last-child {
  margin-bottom: 0;
}

.prose-chat strong {
  color: var(--text-heading);
  font-weight: 600;
}

.prose-chat a {
  color: var(--prose-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--prose-link-decoration);
  transition: text-decoration-color 0.15s ease;
}

.prose-chat a:hover {
  text-decoration-color: var(--prose-link);
}

.prose-chat code {
  background-color: var(--prose-code-bg);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.85em;
}

.prose-chat pre {
  background-color: var(--prose-pre-bg);
  border: 1px solid var(--border-default);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.prose-chat pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.prose-chat hr {
  border-color: var(--border-default);
  margin: 1rem 0;
}

.prose-chat table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0.875rem;
  background-color: var(--prose-table-bg);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  overflow: hidden;
}

.prose-chat th,
.prose-chat td {
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid var(--border-default);
  text-align: left;
}

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

.prose-chat th {
  color: var(--text-heading);
  font-weight: 600;
  background-color: var(--prose-th-bg);
}

.prose-chat .workout-block {
  background-color: var(--surface-elevated);
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  margin-bottom: 0.875rem;
}

.prose-chat .workout-block p {
  margin-bottom: 0.375rem;
}

.prose-chat .workout-block ul {
  margin-bottom: 0;
}

/* Chat sidebar */
.chat-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-default);
  background-color: var(--surface-overlay);
  overflow: hidden;
}

@media (max-width: 767px) {
  .chat-sidebar {
    position: fixed;
    top: 4rem;
    left: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .chat-sidebar.chat-sidebar-open {
    transform: translateX(0);
  }

  .chat-sidebar.chat-sidebar-open ~ .chat-sidebar-backdrop {
    display: block;
  }
}

.chat-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 4rem 0 0 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 39;
}
