/* ============================================
   COACH ONLINE - MOBILE-FIRST PWA
   Design Premium Bianco
   ============================================ */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Colors - iOS Health App Style - Vivid & Elegant */
  --color-primary: #5856D6; /* iOS Purple - meno blu */
  --color-primary-light: #7C7CE0;
  --color-primary-dark: #3D3DB8;
  --color-secondary: #5856D6; /* iOS Purple */
  --color-text: #000000;
  --color-text-light: #8E8E93;
  --color-bg: #FFFFFF; /* White background */
  --color-bg-light: #F8F9FA;
  --color-bg-card: #FFFFFF;
  --color-border: #E5E5EA;
  --color-border-light: #F2F2F7;
  --color-error: #FF3B30;
  --color-success: #34C759; /* iOS Green - for checkmarks */
  --color-warning: #FF9500;
  --color-shadow: rgba(0, 0, 0, 0.08);
  --color-shadow-hover: rgba(0, 0, 0, 0.12);
  
  /* Vivid Category Colors - iOS Health Style */
  --color-breakfast: #FF9500; /* Orange */
  --color-lunch: #34C759; /* Green */
  --color-dinner: #5856D6; /* Purple - meno blu */
  --color-snacks: #FF2D55; /* Pink */
  --color-workout: #5856D6; /* Purple */

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Typography - SF Pro (iOS Health Style) */
  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 400;
  letter-spacing: -0.01em; /* iOS style letter spacing */
}

/* ============================================
   AUTH VIEW (Login/Register)
   ============================================ */

.auth-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 24px var(--color-shadow);
  padding: var(--spacing-2xl);
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.logo-img {
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto var(--spacing-md);
  display: block;
  object-fit: contain;
}

.tagline {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  font-weight: 400;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: var(--spacing-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-group input::placeholder {
  color: var(--color-text-light);
  opacity: 0.6;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--spacing-md) center;
  background-size: 12px;
  padding-right: var(--spacing-2xl);
}

/* Buttons */
.btn {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--color-bg);
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  min-height: 48px; /* Touch target size */
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-light);
  box-shadow: 0 4px 12px var(--color-shadow-hover);
}

.btn-loader {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.auth-switch {
  text-align: center;
  margin-top: var(--spacing-lg);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.auth-switch a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.auth-switch a:active {
  color: var(--color-primary-light);
}

/* ============================================
   APP VIEW (Main App)
   ============================================ */

.app-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Impersonation Banner */
.impersonation-banner {
  background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: 0 2px 8px rgba(156, 39, 176, 0.3);
  border-bottom: 2px solid #7b1fa2;
}

.impersonation-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  max-width: 1200px;
  margin: 0 auto;
}

.impersonation-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.impersonation-info i {
  font-size: var(--font-size-base);
  opacity: 0.9;
}

.impersonation-info strong {
  font-weight: 700;
}

.btn-stop-impersonation {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
}

.btn-stop-impersonation:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.btn-stop-impersonation:active {
  transform: scale(0.95);
}

.btn-stop-impersonation i {
  font-size: 12px;
}

@media (max-width: 768px) {
  .impersonation-info {
    font-size: var(--font-size-xs);
  }
  
  .btn-stop-impersonation span {
    display: none;
  }
  
  .btn-stop-impersonation {
    padding: var(--spacing-xs);
    min-width: 32px;
  }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.9);
  min-height: 44px;
}

.btn-profile {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  margin: 0;
}

.btn-profile:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg-light);
}

.btn-profile:active {
  transform: scale(0.95);
  background: var(--color-bg-light);
}

.btn-profile i {
  font-size: 14px;
}

.btn-logout {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  margin: 0;
}

.btn-logout:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-bg-light);
}

.btn-logout:active {
  transform: scale(0.95);
  background: var(--color-bg-light);
}

.btn-logout i {
  font-size: 14px;
}

.app-main {
  flex: 1;
  padding: var(--spacing-md) var(--spacing-lg);
  padding-bottom: calc(70px + var(--spacing-md) + env(safe-area-inset-bottom, 0px));
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   DASHBOARD - HERO SECTION
   ============================================ */

.dashboard-hero {
  margin-bottom: var(--spacing-md);
}

.hero-greeting {
  text-align: left;
}

.greeting-text {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--spacing-xs);
  line-height: 1.2;
}

.greeting-text span {
  color: var(--color-primary);
}

.greeting-date {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  font-weight: 400;
}

/* ============================================
   DASHBOARD - SECTIONS
   ============================================ */

.dashboard-section {
  margin-bottom: var(--spacing-md);
}

.dashboard-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: all var(--transition-base);
}

.dashboard-card:active {
  transform: scale(0.98);
}

.card-header {
  margin-bottom: var(--spacing-sm);
}

.card-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.card-title i {
  font-size: var(--font-size-base);
  color: var(--color-text-light);
}

.card-content {
  min-height: 40px;
}

.loading-state {
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  text-align: center;
  padding: var(--spacing-md);
}

.empty-state {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
  color: var(--color-text-light);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
  opacity: 0.5;
}

.empty-state p {
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-sm);
}

/* ============================================
   COACH INFO CARD
   ============================================ */

.coach-info-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid var(--color-border);
}

.coach-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.coach-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-xl);
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--color-shadow);
}

.coach-details {
  flex: 1;
  min-width: 0;
}

.coach-name {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.coach-badge {
  font-size: var(--font-size-xs);
  font-weight: 500;
  background: var(--color-primary);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.coach-email {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-xs);
  word-break: break-word;
}

.coach-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: var(--font-size-xs);
  color: var(--color-success);
  font-weight: 500;
}

.coach-status i {
  font-size: var(--font-size-sm);
}

/* ============================================
   WORKOUT CARD
   ============================================ */

.workout-card {
  cursor: pointer;
  transition: all var(--transition-base);
}

.workout-card:active {
  transform: scale(0.98);
  border-color: var(--color-primary);
}

.meal-card {
  cursor: pointer;
  transition: all var(--transition-base);
}

.meal-card:active {
  transform: scale(0.98);
  border-color: var(--color-primary);
}

.workout-card .workout-info {
  margin-bottom: var(--spacing-md);
}

.workout-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--spacing-xs);
}

.workout-meta {
  display: flex;
  gap: var(--spacing-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
}

.workout-meta span {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.workout-exercises {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
}

.workout-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.btn-workout {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-bg);
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 40px;
}

.btn-workout.secondary {
  background: transparent;
  color: var(--color-primary);
}

.btn-workout:active {
  transform: scale(0.98);
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-xs);
}

.stat-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  text-align: center;
  transition: all var(--transition-base);
}

.stat-card:active {
  transform: scale(0.98);
  background: var(--color-bg-light);
}

.stat-icon {
  font-size: var(--font-size-base);
  color: var(--color-text-light);
  margin-bottom: 2px;
}

.stat-value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 2px;
  line-height: 1.2;
}

.stat-label {
  font-size: 9px;
  color: var(--color-text-light);
  line-height: 1.2;
}

/* ============================================
   MEAL PLAN CARD
   ============================================ */

.meal-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.meals-by-category {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.meal-category-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.meal-category-card:hover {
  box-shadow: 0 2px 8px var(--color-shadow);
}

.meal-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  background: var(--color-bg-light);
  border-bottom: 1px solid var(--color-border);
}

.meal-category-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
}

.meal-category-title i {
  font-size: var(--font-size-lg);
}

.meal-category-stats {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--font-size-xs);
}

.meal-count {
  padding: 4px 8px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--color-text);
}

.meal-calories {
  padding: 4px 8px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.meal-category-items {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-sm);
  gap: var(--spacing-xs);
}

.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-light);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-base);
  border-bottom: 1px solid var(--color-border-light);
}

.meal-item:hover {
  background: var(--color-bg);
  border-color: var(--color-border);
}

.meal-item.completed {
  opacity: 0.7;
  background: #f0fdf4;
}

.meal-item.completed .meal-name {
  text-decoration: line-through;
  color: var(--color-text-light);
}

.meal-item:last-child {
  border-bottom: none;
}

.meal-info {
  flex: 1;
  min-width: 0;
}

.meal-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 2px;
}

.meal-details {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.meal-notes {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  font-style: italic;
  margin-top: 4px;
}

.meal-checkbox {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.meal-checkbox:active {
  transform: scale(0.9);
}

.meal-checkbox.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.meal-checkbox i {
  font-size: 12px;
}

/* ============================================
   COMPACT MEALS LIST (Dashboard)
   ============================================ */

.meals-by-category-compact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.meal-category-compact {
  background: var(--color-bg-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.meal-category-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--spacing-sm);
  background: var(--color-bg);
  border-bottom: 3px solid;
  /* Il colore viene impostato inline dal JavaScript */
}

.meal-category-title-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text);
}

.meal-category-count-compact {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-primary);
  padding: 2px 6px;
  background: var(--color-bg-light);
  border-radius: var(--radius-sm);
}

.meal-category-items-compact {
  display: flex;
  flex-direction: column;
  padding: 4px;
  gap: 2px;
}

.meal-item-compact {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.meal-item-compact:hover {
  background: var(--color-bg-light);
  transform: translateX(2px);
}

.meal-item-compact:active {
  transform: translateX(2px) scale(0.98);
  opacity: 0.8;
}

.meal-item-compact.completed {
  opacity: 0.6;
}

.meal-item-compact.completed .meal-name-compact {
  text-decoration: line-through;
  color: var(--color-text-light);
}

.meal-checkbox-compact {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin-top: 2px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.meal-checkbox-compact:active {
  transform: scale(0.9);
}

.meal-checkbox-compact.checked {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.meal-checkbox-compact i {
  font-size: 9px;
}

.meal-info-compact {
  flex: 1;
  min-width: 0;
}

.meal-name-compact {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 2px;
}

.meal-details-compact {
  font-size: 10px;
  color: var(--color-text-light);
  line-height: 1.2;
}

/* Free Diet Card */
.free-diet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xl);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px dashed #0ea5e9;
  border-radius: var(--radius-lg);
  text-align: center;
}

.free-diet-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0ea5e9;
  border-radius: 50%;
  color: white;
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-md);
}

.free-diet-content h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

.free-diet-content p {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-xs);
}

.next-diet-info {
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
}

.next-diet-info i {
  color: var(--color-primary);
}

.next-diet-info strong {
  color: var(--color-primary);
  font-weight: 600;
}

/* ============================================
   CHECK-IN CARD
   ============================================ */

.checkin-status {
  text-align: center;
  padding: var(--spacing-md);
}

.checkin-done {
  color: var(--color-success);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-sm);
}

.checkin-done i {
  margin-right: var(--spacing-xs);
}

/* ============================================
   PROGRESS CARD
   ============================================ */

.progress-summary {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
}

.progress-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.progress-value {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-primary);
}

/* ============================================
   GOALS CARD
   ============================================ */

.goals-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.goal-item {
  padding: 4px 0;
}

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

.goal-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.goal-progress-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

.goal-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--spacing-xs);
}

.goal-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  transition: width var(--transition-slow);
}

/* ============================================
   QUICK ACTIONS
   ============================================ */

/* ============================================
   CHAT CARD
   ============================================ */

.chat-card {
  cursor: pointer;
  position: relative;
}

.chat-card:active {
  transform: scale(0.98);
  background: var(--color-bg-light);
}

/* Wrapper per icona con badge */
.icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, #FF3B30 0%, #FF6B5A 100%);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
  border: 2px solid var(--color-bg);
  z-index: 10;
  animation: badgePulse 2s infinite;
  transform: scale(1);
  transition: transform 0.2s ease;
}

.chat-badge:hover {
  transform: scale(1.1);
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.6);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.chat-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
}

.chat-last-message {
  flex: 1;
  min-width: 0;
}

.chat-message-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message-sender {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.chat-message-text {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chat-message-time {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  margin-top: 2px;
}

.chat-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-text-light);
  flex-shrink: 0;
}

.chat-card:active .chat-action {
  color: var(--color-primary);
}

.chat-empty {
  text-align: center;
  padding: var(--spacing-sm);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: none;
  padding: var(--spacing-xs) 0;
  padding-bottom: calc(var(--spacing-xs) + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--spacing-xs) var(--spacing-sm);
  color: var(--color-text-light);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 60px;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
  position: relative;
  border-radius: 12px;
  margin: 0 2px;
}

.nav-item i {
  font-size: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}

.nav-item span {
  font-size: 10px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
  letter-spacing: -0.01em;
}

/* Colori specifici per ogni icona */
.nav-item[data-page="home"] i {
  color: #5856D6; /* Purple */
}

.nav-item[data-page="workouts"] i {
  color: #FF9500; /* Orange */
}

.nav-item[data-page="nutrition"] i {
  color: #34C759; /* Green */
}

.nav-item[data-page="supplements"] i {
  color: #FF2D55; /* Pink */
}

.nav-item[data-page="chat"] i {
  color: #AF52DE; /* iOS Purple - meno blu */
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(88, 86, 214, 0.1) 0%, rgba(88, 86, 214, 0.05) 100%);
}

.nav-item.active[data-page="home"] {
  background: linear-gradient(135deg, rgba(88, 86, 214, 0.15) 0%, rgba(88, 86, 214, 0.08) 100%);
}

.nav-item.active[data-page="workouts"] {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.15) 0%, rgba(255, 149, 0, 0.08) 100%);
}

.nav-item.active[data-page="nutrition"] {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.15) 0%, rgba(52, 199, 89, 0.08) 100%);
}

.nav-item.active[data-page="supplements"] {
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.15) 0%, rgba(255, 45, 85, 0.08) 100%);
}

.nav-item.active[data-page="chat"] {
  background: linear-gradient(135deg, rgba(175, 82, 222, 0.15) 0%, rgba(175, 82, 222, 0.08) 100%);
}

.nav-item.active i {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.nav-item.active span {
  color: var(--color-text);
  font-weight: 700;
}

.nav-item:hover:not(.active) {
  background: rgba(0, 0, 0, 0.02);
  transform: translateY(-2px);
}

.nav-item:hover:not(.active) i {
  transform: scale(1.08);
}

.nav-item:active {
  transform: scale(0.96) translateY(0);
  opacity: 0.8;
}

/* Wrapper per icona nella navigazione con badge */
.nav-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, #FF3B30 0%, #FF6B5A 100%);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
  border: 2px solid var(--color-bg);
  z-index: 10;
  animation: badgePulse 2s infinite;
  transform: scale(1);
  transition: transform 0.2s ease;
}

.nav-badge:hover {
  transform: scale(1.1);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--spacing-lg);
  left: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
  box-shadow: 0 4px 12px var(--color-shadow);
  animation: slideInDown 0.3s ease;
  pointer-events: auto;
}

.toast.error {
  border-color: var(--color-error);
  background: #fef2f2;
}

.toast.success {
  border-color: var(--color-success);
  background: #f0fdf4;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   RESPONSIVE (Tablet & Desktop)
   ============================================ */

@media (min-width: 768px) {
  .auth-card {
    padding: var(--spacing-2xl) 3rem;
  }

  .logo-img {
    max-width: 240px;
  }
  
}

/* ============================================
   SAFE AREA INSETS (iOS)
   ============================================ */

@supports (padding: max(0px)) {
  .auth-container,
  .app-container {
    padding-left: max(var(--spacing-md), env(safe-area-inset-left));
    padding-right: max(var(--spacing-md), env(safe-area-inset-right));
  }

  .app-header {
    padding-top: max(var(--spacing-md), env(safe-area-inset-top));
  }
}

/* ============================================
   CHAT MODAL STYLES
   ============================================ */

.chat-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-modal-content {
  background: #FFFFFF;
  width: 100%;
  height: 85vh;
  max-height: 85vh;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
  animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

.chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #FFFFFF;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.chat-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #1D1D1F;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.chat-modal-header h3 i {
  color: #5856D6;
  font-size: 16px;
}

/* Pulsante chiusura modale */
.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--color-text-light);
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.btn-close-modal:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
  transform: scale(1.1);
}

.btn-close-modal:active {
  transform: scale(0.95);
}

.btn-close-modal i {
  font-size: 18px;
  line-height: 1;
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  background: #F5F5F7;
}

.chat-message {
  display: flex;
  margin-bottom: 4px;
  animation: fadeInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-message-own {
  justify-content: flex-end;
}

.chat-message-other {
  justify-content: flex-start;
}

.chat-message-content {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.chat-message-own .chat-message-content {
  background: linear-gradient(135deg, #5856D6 0%, #7C7CE0 100%);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.chat-message-other .chat-message-content {
  background: #FFFFFF;
  color: #1D1D1F;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom-left-radius: 4px;
}

.chat-message-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #5856D6;
  letter-spacing: -0.01em;
}

.chat-message-text {
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  letter-spacing: -0.01em;
}

.chat-message-own .chat-message-text {
  color: #FFFFFF;
}

.chat-message-time {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 6px;
  text-align: right;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.85);
}

.chat-message-other .chat-message-time {
  text-align: left;
  color: #6E6E73;
  opacity: 1;
}

.chat-input-container {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #FFFFFF;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.chat-attach-btn,
.chat-audio-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #86868B;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: rgba(88, 86, 214, 0.08);
  color: #5856D6;
  transform: scale(1.05);
}

.chat-attach-btn:active {
  transform: scale(0.95);
  background: rgba(88, 86, 214, 0.12);
}

.chat-attach-btn i {
  font-size: 16px;
}

/* Rimosse classi audio recording */

.chat-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  font-size: 15px;
  font-family: var(--font-family);
  background: #F5F5F7;
  color: #1D1D1F;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: -0.01em;
}

.chat-input::placeholder {
  color: #86868B;
}

.chat-input:focus {
  border-color: rgba(88, 86, 214, 0.3);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(88, 86, 214, 0.08);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5856D6 0%, #7C7CE0 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(88, 86, 214, 0.25);
}

.chat-send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #7C7CE0 0%, #9C9CE8 100%);
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(88, 86, 214, 0.35);
}

.chat-send-btn:active:not(:disabled) {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(88, 86, 214, 0.2);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.chat-send-btn i {
  font-size: 14px;
}

.chat-empty-state,
.chat-error-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-text-light);
}

.chat-empty-state i,
.chat-error-state i {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.3;
}

.chat-empty-hint {
  font-size: var(--font-size-xs);
  margin-top: var(--spacing-sm);
  opacity: 0.6;
}

.chat-typing-indicator {
  margin-bottom: var(--spacing-sm);
}

.chat-typing-dots {
  display: flex;
  gap: 4px;
  padding: var(--spacing-sm) 0;
}

.chat-typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--color-text-light);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.chat-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Chat Message Attachments */
.chat-message-image {
  margin: 6px 0;
  border-radius: 12px;
  overflow: hidden;
  max-width: 250px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-message-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-message-image:hover img {
  transform: scale(1.02);
}

.chat-message-audio {
  margin: 6px 0;
  width: 100%;
  max-width: 300px;
  min-width: 250px;
}

.chat-message-audio audio {
  width: 100%;
  max-width: 300px;
  min-width: 250px;
  height: 48px;
  min-height: 48px;
  outline: none;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.05);
  display: block;
  -webkit-appearance: none;
  appearance: none;
}

.chat-message-own .chat-message-audio audio {
  background: rgba(255, 255, 255, 0.2);
}

/* Assicura che tutti i controlli siano visibili */
.chat-message-audio audio::-webkit-media-controls-panel {
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 24px;
  display: flex !important;
}

.chat-message-own .chat-message-audio audio::-webkit-media-controls-panel {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Forza visibilità controlli audio */
.chat-message-audio audio::-webkit-media-controls-enclosure {
  background: transparent !important;
  border-radius: 24px;
  padding: 4px;
}

.chat-message-audio audio::-webkit-media-controls-panel {
  background-color: rgba(0, 0, 0, 0.05) !important;
  border-radius: 24px;
  display: flex !important;
  opacity: 1 !important;
}

.chat-message-own .chat-message-audio audio::-webkit-media-controls-panel {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

.chat-message-audio audio::-webkit-media-controls-play-button {
  display: inline-block !important;
  opacity: 1 !important;
  width: 32px !important;
  height: 32px !important;
  margin: 0 8px !important;
}

.chat-message-audio audio::-webkit-media-controls-current-time-display,
.chat-message-audio audio::-webkit-media-controls-time-remaining-display {
  display: inline-block !important;
  opacity: 1 !important;
  color: #1D1D1F !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  margin: 0 4px !important;
}

.chat-message-own .chat-message-audio audio::-webkit-media-controls-current-time-display,
.chat-message-own .chat-message-audio audio::-webkit-media-controls-time-remaining-display {
  color: #FFFFFF !important;
}

.chat-message-audio audio::-webkit-media-controls-timeline {
  display: inline-block !important;
  opacity: 1 !important;
  flex: 1 !important;
  margin: 0 8px !important;
  height: 4px !important;
}

.chat-message-audio audio::-webkit-media-controls-volume-slider {
  display: inline-block !important;
  opacity: 1 !important;
}

.chat-message-audio audio::-webkit-media-controls-mute-button {
  display: inline-block !important;
  opacity: 1 !important;
  width: 32px !important;
  height: 32px !important;
  margin: 0 4px !important;
}

/* Per Firefox */
.chat-message-audio audio {
  background-color: rgba(0, 0, 0, 0.05);
}

.chat-message-own .chat-message-audio audio {
  background-color: rgba(255, 255, 255, 0.2);
}

.chat-message-file {
  margin: 6px 0;
}

.chat-message-file a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  color: #1D1D1F;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 280px;
}

.chat-message-own .chat-message-file a {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.chat-message-file a:hover {
  background: rgba(88, 86, 214, 0.1);
  border-color: rgba(88, 86, 214, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(88, 86, 214, 0.15);
}

.chat-message-own .chat-message-file a:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
}

.chat-message-file a i:first-child {
  font-size: 16px;
  color: #5856D6;
}

.chat-message-own .chat-message-file a i:first-child {
  color: rgba(255, 255, 255, 0.9);
}

.chat-message-file a:hover i:first-child {
  color: #5856D6;
}

.chat-message-own .chat-message-file a:hover i:first-child {
  color: #FFFFFF;
}

.chat-message-file a span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.chat-message-file a i:last-child {
  font-size: 12px;
  opacity: 0.6;
}

/* Chat Header Button (per coach/nutrizionisti) */
.btn-chat-header {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
  margin-right: var(--spacing-sm);
}

.btn-chat-header:hover {
  background: var(--color-bg-light);
}

.btn-chat-header i {
  font-size: var(--font-size-lg);
}

.chat-header-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--color-error);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-bg);
}

/* Client Selector Modal */
.client-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition-base);
}

.client-item:hover {
  background: var(--color-bg-light);
}

.client-item:active {
  background: var(--color-bg);
}

.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.client-info {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.client-email {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-action {
  color: var(--color-text-light);
  flex-shrink: 0;
}

/* Desktop Chat Modal */
@media (min-width: 768px) {
  .chat-modal-overlay {
    align-items: center;
  }

  .chat-modal-content {
    width: 500px;
    height: 600px;
    max-height: 80vh;
    border-radius: var(--radius-xl);
  }
}

/* ============================================
   CONTACTS MODAL STYLES (Persone Assegnate)
   ============================================ */

.contacts-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.contacts-modal-content {
  background: var(--color-bg);
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.contacts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  border-bottom: 1.5px solid var(--color-border);
  flex-shrink: 0;
}

.contacts-modal-header h3 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.contacts-list-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-sm);
  -webkit-overflow-scrolling: touch;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-xs);
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--color-bg);
  border: 1px solid transparent;
}

.contact-item:hover {
  background: var(--color-bg-light);
  border-color: var(--color-border);
  transform: translateY(-1px);
}

.contact-item:active {
  transform: scale(0.98);
  background: var(--color-bg);
}

.contact-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(88, 86, 214, 0.2);
}

.contact-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(135deg, #FF3B30 0%, #FF6B5A 100%);
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
  border: 2px solid var(--color-bg);
  z-index: 10;
  animation: badgePulse 2s infinite;
  transform: scale(1);
  transition: transform 0.2s ease;
}

.contact-badge:hover {
  transform: scale(1.1);
}

.contact-avatar.coach {
  background: linear-gradient(135deg, #5856D6 0%, #7C7CE0 100%);
}

.contact-avatar.nutrizionista {
  background: linear-gradient(135deg, #34C759 0%, #5AD27A 100%);
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.contact-role {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.contact-role i {
  font-size: 10px;
}

.contact-action {
  color: var(--color-primary);
  flex-shrink: 0;
  font-size: var(--font-size-lg);
}

.contacts-empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-text-light);
}

.contacts-empty-state i {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.contacts-empty-state p {
  font-size: var(--font-size-base);
  margin: 0;
}

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

/* Desktop Contacts Modal */
@media (min-width: 768px) {
  .contacts-modal-overlay {
    align-items: center;
  }

  .contacts-modal-content {
    width: 500px;
    max-height: 600px;
    border-radius: var(--radius-xl);
  }
}

/* ============================================
   PROFILO COACH/NUTRIZIONISTA
   ============================================ */

.profile-container {
  padding: var(--spacing-md);
}

.profile-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-image-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.profile-image-upload-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(1.1);
}

.profile-info {
  flex: 1;
}

.profile-info h4 {
  margin: 0 0 var(--spacing-xs) 0;
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--color-text);
}

.profile-info p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.profile-form {
  margin-top: var(--spacing-lg);
}

.profile-form .form-group {
  margin-bottom: var(--spacing-md);
}

.profile-form label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.profile-form .form-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  transition: all 0.2s ease;
}

.profile-form .form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(88, 86, 214, 0.1);
}

.profile-form .form-hint {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

.profile-form .form-actions {
  margin-top: var(--spacing-lg);
  display: flex;
  gap: var(--spacing-sm);
}

/* ============================================
   PUSH NOTIFICATIONS CARD
   ============================================ */

.push-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.push-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.push-card .card-title {
  color: white;
}

.push-card .card-title i {
  color: white;
}

.push-status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.push-status-badge.active {
  background: rgba(52, 199, 89, 0.9);
  color: white;
}

.push-status-badge.pending {
  background: rgba(255, 149, 0, 0.9);
  color: white;
}

.push-status-badge.denied {
  background: rgba(255, 59, 48, 0.9);
  color: white;
}

.push-status-badge.default {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.push-status-badge.not-supported {
  background: rgba(142, 142, 147, 0.9);
  color: white;
}

.push-status-container {
  text-align: center;
  padding: var(--spacing-sm) 0;
}

.push-status-text {
  color: rgba(255, 255, 255, 0.95);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
}

.push-status-text i {
  margin-right: var(--spacing-xs);
}

.push-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  align-items: center;
}

.btn-push-enable,
.btn-push-test,
.btn-push-help {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  transition: all var(--transition-fast);
  min-width: 200px;
  justify-content: center;
}

.btn-push-enable {
  background: white;
  color: #667eea;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-push-enable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-push-enable:active {
  transform: translateY(0);
}

.btn-push-test {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-push-test:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-push-test:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-push-help {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-push-help:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Pre-permission modal animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

