/* ABOUTME: Main stylesheet defining design tokens, layout, and global styles */

/* ABOUTME: Imports all component stylesheets and sets CSS custom properties */

/*
 * Application-wide styles for Yafa - AI Fitness Tracker
 * Design system based on mockup-10 (Clean Evolution)
 */

/* Import Manrope font - friendly but professional */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

/* Import component stylesheets */
@import url("/assets/modals-f863faa2.css");
@import url("/assets/dashboard-93203b2f.css");
@import url("/assets/chat-6071e594.css");
@import url("/assets/admin-00cc1eb6.css");
@import url("/assets/mobile_layout-39bbb4a1.css");
@import url("/assets/workout_card-4abf1358.css");
@import url('https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css');

/* CSS Variables - Design Tokens from mockup-10 */
:root {
  /* ========== Core Brand Colors ========== */
  --orange: #E8743B;
  --orange-light: #FFF3ED;
  --orange-600: #cc662f;

  /* Legacy aliases */
  --yafa-orange: var(--orange);
  --yafa-orange-600: var(--orange-600);

  /* ========== Semantic Colors ========== */
  --green: #34A853;
  --green-light: #E6F4EA;
  --red: #EA4335;
  --red-light: #FCE8E6;
  --yellow: #FBBC04;
  --yellow-light: #FEF7E0;
  --purple: #8b5cf6;
  --purple-light: #f3e8ff;
  --blue: #4285f4;
  --blue-light: #e8f0fe;
  --indigo: #6366f1;
  --indigo-light: #e0e7ff;
  --teal: #14b8a6;
  --teal-light: #ccfbf1;
  --cyan: #06b6d4;
  --cyan-light: #cffafe;
  --amber: #f59e0b;
  --amber-light: #fef3c7;

  /* ========== Surface & Background ========== */
  --bg: #F8F9FA;
  --surface: #FFF;
  --border: #E5E7EB;

  /* ========== Typography Colors ========== */
  --text: #1F2937;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;

  /* ========== Spacing System (4px base) ========== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ========== Border Radius ========== */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ========== Shadows & Elevation ========== */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 5%);
  --shadow: 0 1px 3px rgb(0 0 0 / 8%);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 8%);
  --shadow-lg: 0 8px 24px rgb(0 0 0 / 12%);
  --elev-1: 0 1px 3px rgb(0 0 0 / 8%);
  --elev-2: 0 4px 12px rgb(0 0 0 / 10%);

  /* ========== Legacy Gray Scale (for backward compat) ========== */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* ========== Legacy Status Colors (for backward compat) ========== */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93bbfc;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-200: #bbf7d0;
  --success-300: #86efac;
  --success-400: #4ade80;
  --success-500: var(--green);
  --success-600: #16a34a;
  --success-700: #15803d;
  --success-800: #166534;
  --success-900: #14532d;
  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-200: #fecaca;
  --error-500: var(--red);
  --error-600: #dc2626;
  --error-700: #b91c1c;
  --warning-500: var(--yellow);
  --warning-600: #d97706;
  --warning-700: #b45309;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Yafa wordmark styling */
.yafa-wordmark {
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 1.125rem;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-700);
}

/* Navigation */
.main-navigation {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
}

.nav-links {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  height: 56px;
  gap: var(--space-4);
}

.nav-link {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

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

.nav-link:last-child {
  margin-left: auto;
}

/* Main content wrapper */
main {
  min-height: calc(100vh - 56px);
  padding-top: 56px;
}

/* Reset main padding for auth pages */
body:has(.login-container) main,
body:has(.signup-container) main {
  padding-top: 0;
  min-height: auto;
}

/* Trainer viewing stripe */
.trainer-viewing-stripe {
  background: var(--success-100);
  border-bottom: 2px solid var(--success-200);
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 35;
  padding: 0.75rem 0;
}

.trainer-viewing-stripe .stripe-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 0.75rem;
}

.trainer-viewing-stripe .breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.trainer-viewing-stripe .breadcrumb-link {
  color: var(--success-700);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.trainer-viewing-stripe .breadcrumb-link:hover {
  color: var(--success-900);
  text-decoration: underline;
}

.trainer-viewing-stripe .breadcrumb-separator {
  color: var(--success-400);
  font-size: 0.875rem;
  margin: 0 0.25rem;
}

.trainer-viewing-stripe .breadcrumb-current {
  color: var(--success-900);
  font-weight: 600;
}

/* Breadcrumb dropdown */
.breadcrumb-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.breadcrumb-dropdown-toggle {
  background: none;
  border: none;
  color: var(--success-600);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.breadcrumb-dropdown-toggle:hover {
  background: var(--success-200);
  color: var(--success-700);
}

.breadcrumb-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
}

.breadcrumb-dropdown:hover .breadcrumb-dropdown-menu,
.breadcrumb-dropdown:focus-within .breadcrumb-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.breadcrumb-dropdown-item {
  display: block;
  padding: 0.625rem 1rem;
  color: var(--gray-700);
  text-decoration: none;
  transition: background-color 0.2s;
  font-size: 0.875rem;
}

.breadcrumb-dropdown-item:hover {
  background: var(--gray-50);
  color: var(--primary-600);
}

.breadcrumb-dropdown-item.active {
  background: var(--success-50);
  color: var(--success-700);
  font-weight: 500;
}

.breadcrumb-dropdown-item:first-child {
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.breadcrumb-dropdown-item:last-child {
  border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
}

/* Adjust main content when trainer stripe is shown */
body.has-trainer-stripe main {
  padding-top: calc(56px + 48px);
}

/* User breadcrumb navigation */
.user-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.user-breadcrumb .breadcrumb-link {
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.user-breadcrumb .breadcrumb-link:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

.user-breadcrumb .breadcrumb-separator {
  color: var(--gray-400);
  font-size: 0.875rem;
  margin: 0 0.25rem;
}

.user-breadcrumb .breadcrumb-current {
  color: var(--gray-900);
  font-weight: 600;
}

.user-breadcrumb .breadcrumb-dropdown-toggle {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-breadcrumb .breadcrumb-dropdown-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* Container utilities */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

.container.max-w-4xl {
  max-width: 56rem;
}

.container.max-w-6xl {
  max-width: 72rem;
}

/* Card component */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: var(--space-4) var(--space-5);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  padding: 0 var(--space-5);
  height: 44px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1;
  gap: var(--space-2);
}

.btn-primary {
  background: var(--orange);
  color: white;
  border: 0;
}

.btn-primary:hover {
  background: var(--orange-600);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:focus {
  outline: 2px solid var(--orange-light);
  outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover,
.btn[disabled]:hover {
  transform: none !important;
  box-shadow: none;
}

.btn-sm {
  padding: 0 var(--space-3);
  height: 32px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 0 var(--space-2);
  height: 28px;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-icon {
  padding: 0;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--bg);
  border-color: var(--gray-400);
}

.btn-success {
  background: var(--green);
  border: none;
  color: white;
  font-weight: 600;
}

.btn-success:hover {
  background: #2d9249;
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background-color: var(--red);
  color: white;
  border: none;
}

.btn-danger:hover {
  background-color: #d33426;
  box-shadow: var(--shadow-md);
}



/* Forms */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  font-size: 0.8125rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: all 0.2s;
  background-color: var(--bg);
}

.form-select {
  appearance: none;
  padding-right: 3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.25rem center;
  background-size: 1rem;
  cursor: pointer;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--orange);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgb(232 116 59 / 10%);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background-color: var(--gray-100);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

thead th {
  background-color: var(--gray-50);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.8rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 1;
}

th, td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--gray-100);
}

tbody tr:nth-child(even) {
  background: transparent; /* Remove heavy stripes */
}

tbody tr:hover {
  background: #f7f7f9;
}

/* Number alignment and tabular figures */
td[data-align="num"],
[data-align="num"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

th[data-align="num"] {
  text-align: right;
}

/* Dim units in tables for better readability */
td .unit,
.table-unit {
  opacity: 0.7;
}

/* Progress bars with CSS variable model */
.goal-progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.goal-progress-fill {
  height: 100%;
  transition: width 0.3s ease;
  background: linear-gradient(90deg, var(--yafa-orange), var(--yafa-orange-600));
}

/* CSS variable model for progress percentage */
[style*="--p"] .goal-progress-fill {
  width: calc(var(--p) * 1%);
}

/* Sticky table headers for activity tables */
.table-scroll-container {
  max-height: calc(100vh - 300px); /* Account for header and tabs */
  overflow: auto;
  position: relative;

  /* Allow tooltips to be visible outside container */
}

.table-scroll-container thead th {
  position: sticky;
  top: 0;
  z-index: 20; /* Higher z-index for headers */
  background: var(--gray-50);
  box-shadow: 0 1px 0 var(--gray-200);
  overflow: visible; /* Allow tooltips to escape */
}

/* Sticky footer for tables */
.table-scroll-container tfoot {
  position: sticky;
  bottom: 0;
  z-index: 20; /* Higher than row borders */
}

.table-scroll-container tfoot td {
  background: var(--primary-50);
  border-top: 2px solid var(--primary-200);
  position: relative; /* Create stacking context */
}

/* Hide row borders that would show through footer */
.table-scroll-container tfoot td::before {
  content: '';
  position: absolute;
  left: -3px; /* Cover the 3px border */
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-50);
  z-index: 1;
}

/* Activity table scroll shadows */
.activity-table-wrapper {
  position: relative;
}

.activity-scroll-shadow-top,
.activity-scroll-shadow-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 15px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  width: 100%;
  z-index: 25; /* Above content but below modals */
}

.activity-scroll-shadow-top {
  top: 0; /* At the top of the scroll container */
  background: linear-gradient(to bottom, rgb(0 0 0 / 6%), transparent);
}

.activity-scroll-shadow-bottom {
  bottom: 0; /* At the bottom of the scroll container */
  background: linear-gradient(to top, rgb(0 0 0 / 6%), transparent);
}

.activity-scroll-shadow-top.visible,
.activity-scroll-shadow-bottom.visible {
  opacity: 1;
}

/* On daily dashboard, make the table container scrollable */
.daily-dashboard-container .table-scroll-container {
  max-height: calc(100vh - 280px); /* Adjust for daily dashboard header */
}

/* Ensure proper stacking in daily dashboard */
.daily-dashboard-container .table-scroll-container thead th {
  z-index: 25;
}

.daily-dashboard-container .table-scroll-container tbody tr:first-child[style*="background: var(--primary-50)"] td {
  z-index: 20;
}

/* Alerts and notifications */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Chat-specific styles */
.messages-container {
  background-color: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message:last-child {
  margin-bottom: 0;
}

/* Activity item cards */
.activity-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}

.activity-item:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
}

/* Loading states */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-300) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.hidden { display: none; }

/* Responsive */
@media (width <= 640px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .nav-links {
    gap: 0.5rem;
  }
}

/* =================================================================
   Chat Components
   ================================================================= */

/* Typing Indicator Animation */

.typing-indicator span {
  height: 8px;
  width: 8px;
  background-color: #4B5563;
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Inline typing indicator (used in streaming messages) */
.typing-indicator-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgb(0 0 0 / 5%);
  border-radius: 16px;
  margin-left: 4px;
}

.typing-indicator-inline span {
  height: 8px;
  width: 8px;
  background-color: #4B5563;
  border-radius: 50%;
  display: inline-block;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator-inline span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator-inline span:nth-child(2) {
  animation-delay: -0.16s;
}

/* Message Styles (used in daily dashboard) */

.message.own-message {
  align-items: flex-end;
}

.message.other-message {
  align-items: flex-start;
}

.sender-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.message-bubble {
  max-width: 90%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.own-message .message-bubble {
  background: var(--primary-600);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.own-message.trainer-mode .message-bubble {
  background: var(--success-600);
}

.other-message .message-bubble {
  background: white;
  border: 1px solid var(--gray-200);
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 0.25rem;
}

.other-message.trainer-mode .message-bubble {
  background: var(--success-50);
  border-color: var(--success-200);
}

.message-bubble p {
  margin: 0 0 0.75rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

/* Markdown styling for chat messages */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
  margin: 1rem 0 0.5rem;
  line-height: 1.3;
}

.message-bubble h1 { font-size: 1.25rem; }
.message-bubble h2 { font-size: 1.125rem; }
.message-bubble h3 { font-size: 1rem; }
.message-bubble h4 { font-size: 0.9375rem; }
.message-bubble h5 { font-size: 0.875rem; }
.message-bubble h6 { font-size: 0.875rem; }

/* First heading shouldn't have top margin */
.message-bubble h1:first-child,
.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child,
.message-bubble h5:first-child,
.message-bubble h6:first-child {
  margin-top: 0;
}

/* Lists in messages */
.message-bubble ul,
.message-bubble ol {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.5rem;
}

.message-bubble ul:last-child,
.message-bubble ol:last-child {
  margin-bottom: 0;
}

.message-bubble li {
  margin: 0.25rem 0;
  line-height: 1.5;
}

.message-bubble li:first-child {
  margin-top: 0;
}

.message-bubble li:last-child {
  margin-bottom: 0;
}

/* Nested lists */
.message-bubble ul ul,
.message-bubble ol ol,
.message-bubble ul ol,
.message-bubble ol ul {
  margin: 0.25rem 0;
}

/* Strong emphasis */
.message-bubble strong {
  font-weight: 600;
}

/* Code blocks */
.message-bubble code {
  background: rgb(0 0 0 / 5%);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.875em;
}

.message-bubble pre {
  background: rgb(0 0 0 / 5%);
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.5rem 0 0.75rem;
}

.message-bubble pre code {
  background: none;
  padding: 0;
}

/* Blockquotes */
.message-bubble blockquote {
  border-left: 3px solid rgb(0 0 0 / 10%);
  margin: 0.5rem 0 0.75rem;
  padding-left: 1rem;
  font-style: italic;
  color: rgb(0 0 0 / 70%);
}

/* Horizontal rules */
.message-bubble hr {
  border: none;
  border-top: 1px solid rgb(0 0 0 / 10%);
  margin: 1rem 0;
}

/* Tables in messages */
.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.875rem;
}

.message-bubble th,
.message-bubble td {
  padding: 0.5rem;
  border: 1px solid rgb(0 0 0 / 10%);
  text-align: left;
}

.message-bubble th {
  background: rgb(0 0 0 / 5%);
  font-weight: 600;
}

/* Adjust colors for own messages (blue/green bubbles) */
.own-message .message-bubble code {
  background: rgb(255 255 255 / 20%);
}

.own-message .message-bubble pre {
  background: rgb(255 255 255 / 15%);
}

.own-message .message-bubble blockquote {
  border-left-color: rgb(255 255 255 / 30%);
  color: rgb(255 255 255 / 90%);
}

.own-message .message-bubble hr {
  border-top-color: rgb(255 255 255 / 20%);
}

.own-message .message-bubble th,
.own-message .message-bubble td {
  border-color: rgb(255 255 255 / 20%);
}

.own-message .message-bubble th {
  background: rgb(255 255 255 / 10%);
}

.message-bubble.streaming p {
  color: var(--gray-500);
  font-style: italic;
}


.own-message .message-time {
  text-align: right;
}

/* Activity jump links in chat messages */
.message a[href^="#activity-"] {
  color: #007AFF;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease-out;
  border-bottom: 1px solid transparent;
  position: relative;
}

.message a[href^="#activity-"]:hover {
  color: #0051D5;
  border-bottom-color: #0051D5;
}

/* Loading animation */
.message #loading {
  max-width: 90%;
}

.message #loading .typing-indicator {
  padding: 0.5rem;
}

/* Mutations Display Styles */
.mutations {
  max-width: 90%;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.mutations-header {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--gray-700);
}

.mutation-group {
  margin-bottom: 0.5rem;
}

.mutation-group:last-child {
  margin-bottom: 0;
}

.activity-link {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}

.activity-link:hover {
  text-decoration: underline;
}

.show-details-btn {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--primary-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.show-details-btn:hover {
  color: var(--primary-700);
}

.mutation-details {
  margin-top: 0.5rem;
  position: relative;
}

.mutation-table-wrapper {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 0.25rem;
}




/* Sticky actions column */
.mutation-table .actions-column,
.mutation-table .action-buttons {
  position: sticky;
  right: 0;
  background: inherit;
  z-index: 1;
}

.mutation-table th.actions-column {
  background: var(--gray-50);
  box-shadow: -2px 0 4px rgb(0 0 0 / 5%);
}

.mutation-table td.action-buttons {
  background: white;
  box-shadow: -2px 0 4px rgb(0 0 0 / 5%);
}

.mutation-table.deleted th.actions-column {
  background: white;
  box-shadow: -2px 0 4px rgb(0 0 0 / 5%);
}

.mutation-table.deleted td.action-buttons {
  background: white;
  box-shadow: -2px 0 4px rgb(0 0 0 / 5%);
}

.mutation-table tr:last-child td {
  border-bottom: none;
}

.mutation-table.deleted {
  border-color: var(--error-200);
}

.mutation-table.deleted th {
  background: var(--error-50);
  color: var(--error-700);
  border-bottom-color: var(--error-200);
}

.mutation-table.deleted td {
  background: var(--error-50);
}

.action-buttons {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

.btn-icon {
  padding: 0.25rem;
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 0.25rem;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.15s;
  position: relative;
}

.btn-icon:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-700);
}

/* Primary button icon style for daily dashboard */
.btn-icon.btn-primary {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  color: white;
}

.btn-icon.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-700);
  border-color: var(--primary-700);
  color: white;
}

/* Tooltips below for activity header buttons */

.section-header .btn[data-tooltip] {
  position: relative;
  z-index: 10;
}

.section-header .btn[data-tooltip]::before {
  top: 100%;
  bottom: auto;
  border-top-color: transparent;
  border-bottom: 6px solid var(--gray-900);
  margin-bottom: 0;
  margin-top: 4px;
  z-index: 9999;
  position: absolute;
}

.section-header .btn[data-tooltip]::after {
  top: 100%;
  bottom: auto;
  margin-bottom: 0;
  margin-top: 10px;
  z-index: 9999;
  position: absolute;
  line-height: 1.2;
  white-space: nowrap;
}

/* Custom tooltips - Remove native tooltips */
.btn-icon[title] {
  overflow: visible;
  position: relative;
}

.btn-icon[title]:hover::before,
.btn-icon[title]:hover::after {
  opacity: 1;
  visibility: visible;
  transition-delay: 0.5s;
}

/* Hide native tooltips by removing title on hover */
.btn-icon[title]:hover {
  cursor: pointer;
}

/* Ensure tooltips aren't clipped by table */

.action-buttons {
  position: relative;
  z-index: 10;
}

.btn-icon[title]::before {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 4px 8px;
  background: #000;
  background-color: rgb(0 0 0 / 90%);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  transition-delay: 0s;
  z-index: 1000;
  pointer-events: none;
}

.btn-icon[title]::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 3px;
  border: 5px solid transparent;
  border-top-color: #000;
  border-top-color: rgb(0 0 0 / 90%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  transition-delay: 0s;
  z-index: 1000;
  pointer-events: none;
}

/* Adjust tooltip position for buttons in the rightmost column */
.action-buttons .btn-icon:last-child[title]::before,
td:last-child .btn-icon[title]::before,
.btn-icon:last-child[title]::before {
  left: auto;
  right: 0;
  transform: none;
}

.action-buttons .btn-icon:last-child[title]::after,
td:last-child .btn-icon[title]::after,
.btn-icon:last-child[title]::after {
  left: auto;
  right: 8px;
  transform: none;
}

.btn-icon.disabled {
  cursor: not-allowed;
}

.btn-icon.disabled svg {
  opacity: 0.5;
}

.btn-icon.delete {
  color: var(--error-500);
}

.btn-icon.delete:hover:not(:disabled) {
  background: var(--error-50);
  border-color: var(--error-300);
  color: var(--error-600);
}

.btn-icon.revert {
  color: var(--error-500);
}

.btn-icon.revert:hover:not(:disabled) {
  background: var(--error-50);
  border-color: var(--error-300);
  color: var(--error-600);
}

.btn-icon.restore {
  color: var(--success-600);
}

.btn-icon.restore:hover:not(:disabled) {
  background: var(--success-50);
  border-color: var(--success-300);
  color: var(--success-700);
}

/* Reorder buttons - mobile-friendly touch targets with subtle appearance */
.btn-reorder {
  padding: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--gray-300);
  border-radius: 0.25rem;
  cursor: pointer;
  color: var(--gray-600);
  transition: all 0.15s;

  /* Ensure minimum touch target */
  min-width: 28px;
  min-height: 28px;
}

.btn-reorder:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
  color: var(--gray-900);
}

.btn-reorder:active:not(:disabled) {
  background: var(--gray-200);
}

.mutation-summary {
  margin-left: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.action-added {
  color: var(--success-600);
}

.action-edited {
  color: var(--primary-600);
}

.action-deleted {
  color: var(--error-500);
}

/* Navigation highlight for attention banner navigation */
.navigation-highlight {
  background: rgb(255 149 0 / 15%) !important; /* Stronger orange when navigating */
  border-left: 4px solid var(--warning-600) !important; /* Thicker, darker border */
  box-shadow: 0 0 0 2px rgb(255 149 0 / 20%) !important; /* Orange glow */
  transition: all 0.3s ease-out;
  animation: pulse-highlight 1.5s ease-in-out infinite;
}

@keyframes pulse-highlight {
  0%, 100% {
    box-shadow: 0 0 0 2px rgb(255 149 0 / 20%);
  }

  50% {
    box-shadow: 0 0 0 4px rgb(255 149 0 / 10%);
  }
}

/* Smooth highlight animation for jump links */
@keyframes gentle-highlight {
  0% {
    background-color: rgb(0 122 255 / 15%);
    transform: scale(1.005);
  }

  100% {
    background-color: transparent;
    transform: scale(1);
  }
}

.highlight-flash {
  animation: gentle-highlight 2s ease-out;
}

/* Dropdown styles */
.dropdown-item:hover {
  background: var(--gray-50);
}

.dropdown-menu {
  max-height: 300px;
  overflow-y: auto;
}

.suggested-actions {
  display: flex;
  gap: 0.375rem;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  position: relative;
  z-index: 10; /* Same as .action-buttons to create proper stacking context */
}

/* Font Awesome stack-based attention badges */

/* Action required indicator wrapper */
.suggestion-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
}


@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* Square icon buttons for suggested actions to match other action buttons */
.suggested-actions .btn-icon {
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}



.required-fields-notice {
  font-size: 0.75rem;
  color: #f59e0b;
  margin-top: 0.25rem;
}

/* Daily Dashboard Styles */

/* Base layout styles */

/* Adjust when trainer stripe is present */
body.has-trainer-stripe .daily-dashboard-container {
  top: calc(56px + 48px); /* Navbar + trainer stripe height */
}


/* Header section */




/* Date navigation buttons */


.date-nav-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

/* Lightning bolt overlay badge for yesterday button */
.date-nav-button-wrapper {
  position: relative;
  display: inline-block;
}

.attention-badge-overlay {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #E8743B;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
  pointer-events: none;
  z-index: 1;
}

/* Tab button wrapper for overlay badges */
.tab-button-wrapper {
  position: relative;
  display: inline-block;
}

/* Lightning bolt overlay for tabs */
.tab-attention-overlay {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #E8743B;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
  pointer-events: none;
  z-index: 1;
}

/* Add button wrapper for overlay badges */
.add-button-wrapper {
  position: relative;
  display: inline-block;
}

/* Lightning bolt overlay for add buttons */
.add-button-attention-overlay {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--warning-500);
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  border: 1.5px solid white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 20%);
  pointer-events: none;
  z-index: 1;
}

.add-button-attention-overlay .fa-bolt {
  font-size: 9px;
}




.date-nav-icon-button.disabled {
  color: var(--gray-300);
  cursor: not-allowed;
}

.date-nav-icon-button.disabled:hover {
  background: transparent;
  color: var(--gray-300);
  border-color: transparent;
}

/* Hidden date picker input */

/* Date display */










/* Desktop chat panel - hidden by default */

/* Tab navigation improvements */




/* Activity badges (used in navigation and tabs) */
.activity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 9999px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  vertical-align: middle;
}

.activity-badge.incomplete {
  background: var(--amber-500, #f59e0b);
  color: white;
}

.activity-badge.planned {
  background: var(--blue-500, #3b82f6);
  color: white;
}

/* Activity badge tooltips */
.activity-badge[data-tooltip],
.activity-badge-missing[data-tooltip] {
  position: relative;
  cursor: help;
}

.activity-badge[data-tooltip]:hover::after,
.activity-badge-missing[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  background: var(--gray-900);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  margin-left: 0.5rem;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
}

.activity-badge[data-tooltip]:hover::before,
.activity-badge-missing[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--gray-900);
  margin-left: 1px;
  z-index: 1001;
  pointer-events: none;
}

/* Activity badge position adjustments */
.nav-link .activity-badge {
  margin-left: 0.25rem;
}

.tab-button .activity-badge {
  margin-left: 0;
  margin-right: 0.375rem;
  vertical-align: baseline;
}

.tab-button .activity-badge-missing {
  margin-right: 0;
  vertical-align: baseline;
  position: relative;
  top: -1px;
  font-size: 0.625rem;
}

/* Dropdown item badge positioning */
.nav-item-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}


.tab-button.active .tab-badge:not(.tab-badge-empty) {
  background: var(--primary-100);
  color: var(--primary-700);
}

.tab-button-all {
  margin-left: auto;
}


/* Badge container for count + suggestion indicator */
.badge-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Action-required indicator for pending suggestions (on badge containers) */
.suggestion-indicator {
  position: absolute;
  top: -4px;
  right: -4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tab suggestion indicators (left of tab text) */


.tab-button .suggestion-indicator {
}

/* Attention banner for actions required */


/* Highlight animation for jumped-to items */
.highlight-action {
  animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
  0%, 100% {
    background-color: transparent;
    box-shadow: none;
  }

  25%, 75% {
    background-color: rgb(37 99 235 / 10%);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 20%);
  }
}

/* Lightning bolt inside add button */
.btn-primary .button-bolt {
  color: white;
  margin-right: 0.25rem;
  font-size: 0.875rem;
}



@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes subtle-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/* Mobile adjustments for date navigation */
@media (width <= 768px) {
  .date-display-info {
    gap: 0.5rem;
  }
}

/* Mobile-only elements - hide by default on desktop */
@media (width >= 1024px) {
}

/* Show mobile-only elements on mobile */
@media (width <= 1023px) {
  /* Hide entire desktop chat panel on mobile */

  /* Make activities section full width on mobile */
}

/* Ensure proper scrolling for both panels */
.activities-section .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


.activities-section .card-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding: 0;
}

/* Chat panel styling */

/* Desktop chat panel scrolling */

.desktop-chat-panel .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.desktop-chat-panel .chat-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat messages scroll shadow */


.chat-scroll-shadow-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, rgb(0 0 0 / 10%), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.chat-scroll-shadow-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to top, rgb(0 0 0 / 10%), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.chat-scroll-shadow-top.visible,
.chat-scroll-shadow-bottom.visible {
  opacity: 1;
}

/* Empty states */



/* Chat badge for notifications */

/* Tab content styling */


/* Responsive layout for desktop */
@media (width >= 1024px) {
  /* Hide chat in tab view on desktop */
  #tab_chat .chat-interface {
    display: none !important;
  }
}

/* Mobile-specific adjustments */
@media (width <= 1023px) {
  /* Show chat interface in tab when active */
  #tab_chat.active .chat-interface {
    display: flex;
    height: calc(100vh - 300px); /* Adjust for header and tab bar */
    max-height: 500px; /* Reasonable max height for tab view */
  }

  /* Override desktop chat styles when in tab mode */
  #tab_chat .chat-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #tab_chat .chat-messages-wrapper {
    flex: 1;
    min-height: 0; /* Important for proper flex behavior */
  }

  #tab_chat .chat-messages {
    height: 100%;
    overflow-y: auto;
  }
}

/* Remove browser tooltips on buttons in mutation details */
.mutation-details button[title] {
  pointer-events: auto;
}

/* Prevent browser tooltip */
.mutation-details button[title]:hover::before {
  content: attr(title);
  pointer-events: none;
}

/* OAuth Authentication Styles */
.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  width: 100%;
}

.btn-oauth:hover {
  border-color: var(--gray-400);
  background-color: var(--gray-50);
  text-decoration: none;
}

.btn-google {
  color: var(--gray-700);
  background-color: white;
}

.btn-google:hover {
  color: var(--gray-700);
}

/* OAuth divider */
.oauth-section {
  margin-bottom: 1.5rem;
}

.divider {
  position: relative;
  margin: 1.5rem 0;
  text-align: center;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--gray-300);
}

.divider span {
  position: relative;
  background-color: white;
  padding: 0 1rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Authentication pages specific styles */
.login-container,
.signup-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-box,
.signup-box {
  width: 100%;
  max-width: 28rem;
}

/* SVG icon sizing for OAuth buttons */
.btn-oauth svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* Devise links styling */
.devise-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.devise-links .link {
  color: var(--primary-600);
  font-weight: 500;
  transition: color 0.2s;
}

.devise-links .link:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

.devise-links .text-sm {
  font-size: 0.875rem;
}

/* Devise error messages */
.error-alert {
  background-color: #FEE2E2;
  border: 1px solid #FECACA;
  color: #991B1B;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.error-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  color: #DC2626;
}

.error-messages {
  flex: 1;
}

.error-message {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.error-message + .error-message {
  margin-top: 0.25rem;
}

/* Fix Rails field_with_errors wrapper */
.field_with_errors {
  display: contents;
}

.field_with_errors input,
.field_with_errors textarea,
.field_with_errors select {
  border-color: #EF4444;
}

.field_with_errors input:focus,
.field_with_errors textarea:focus,
.field_with_errors select:focus {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgb(239 68 68 / 10%);
}

/* Portal Overlay System */
#overlay-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* Portaled Tooltip Styles */
.tooltip-portal {
  position: fixed;
  max-width: 160px;
  background: var(--gray-900);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}

.tooltip-portal::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--gray-900);
}

/* Flipped tooltip when at top of viewport */
.tooltip-bottom {
  transform: translate(-50%, 0);
}

.tooltip-bottom::before {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--gray-900);
}

/* Portaled Dropdown Menu Styles */
.dropdown-menu-portal {
  position: fixed;
  display: flex;
  gap: 0.5rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 12%);
  padding: 6px;
  pointer-events: auto;
}

.dropdown-align-right {
  transform: translateX(-100%);
}

/* Button States */
.btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-processing {
  opacity: 0.7;
  cursor: wait;
}

/* Applied count span styles */
.applied-count {
  font-size: 0.75rem !important;
  margin-left: 0.5rem !important;
}

/* Utility Classes for JavaScript */
.hidden {
  display: none !important;
}

.visible {
  opacity: 1 !important;
}

.invisible {
  opacity: 0 !important;
}

.opacity-50 {
  opacity: 0.5 !important;
}

.opacity-60 {
  opacity: 0.6 !important;
}

.inline-flex {
  display: inline-flex !important;
}

.block {
  display: block !important;
}

.inline-block {
  display: inline-block !important;
}

.table-row {
  display: table-row !important;
}

.scroll-auto {
  scroll-behavior: auto !important;
}

.scroll-smooth {
  scroll-behavior: smooth !important;
}

.bg-white {
  background: white !important;
}

.pointer-events-none {
  pointer-events: none !important;
}

.pointer-events-auto {
  pointer-events: auto !important;
}

.text-success {
  color: var(--success-600) !important;
}

.fade-out {
  transition: opacity 0.3s;
  opacity: 0;
}

/* Date Section */
.date-section {
  margin-bottom: var(--space-4);
}

.date-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: center;
}

.date-btn {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.date-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--gray-400);
}

.date-content {
  flex: 1;
  text-align: center;
}

.date-main {
  font-size: 1.125rem;
  font-weight: 700;
}

.date-chip {
  display: inline-block;
  background: var(--orange-light);
  color: var(--orange);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  margin-top: 4px;
  text-transform: uppercase;
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg);
  border-radius: var(--radius);
  position: relative;
  transition: all 0.2s;
}

.activity-item:hover {
  background: var(--gray-100);
}

/* AI-logged items have subtle purple highlight */
.activity-item.from-ai {
  border-left: 3px solid var(--purple, #667eea);
  background: var(--purple-light, #f0f0ff);
}

.activity-icon {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.activity-meta {
  display: flex;
  gap: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.activity-meta strong {
  color: var(--text);
}

.ai-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  color: var(--purple, #667eea);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: var(--space-1);
}

/* Meal Groups */
.meal-group {
  margin-bottom: var(--space-4);
}

.meal-group:last-child {
  margin-bottom: 0;
}

.meal-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
  padding-left: 4px;
}

/* Quick Stats Grid */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.quick-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  text-align: center;
}

.quick-stat-value {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text);
}

.quick-stat-value.good {
  color: var(--green);
}

.quick-stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.quick-stat-progress {
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  margin-top: var(--space-2);
}

.quick-stat-progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.quick-stat-progress-fill.good {
  background: var(--green);
}

/* FAB (Floating Action Button) Styles */
.fab-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 40;
}

@media (width <= 768px) {
  .fab-container {
    bottom: calc(80px + env(safe-area-inset-bottom, 0));
  }
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  border: none;
  font-size: 1.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.fab-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 4px 20px rgb(232 116 59 / 40%);
}

.fab-primary:hover {
  background: var(--orange-600);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgb(232 116 59 / 50%);
}

.fab-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.fab-secondary:hover {
  background: var(--bg);
  border-color: var(--gray-400);
  transform: translateY(-2px);
}
