/**
 * Main Stylesheet
 * Import order: variables → base → components → layout
 */

@import './variables.css';
@import './base.css';
@import './components.css';

/* ============================================================
   LAYOUT - Header, Main, Footer
   ============================================================ */

/* Header / Navbar */
.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  background-color: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--spacing-4);
  max-width: var(--container-max-width);
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-6);
}

.header-nav a {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-fast);
  text-decoration: none;
}

.header-nav a:hover {
  color: var(--color-primary);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

/* User Dropdown */
.user-dropdown {
  position: relative;
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-background);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-dropdown-toggle:hover {
  background: var(--color-gray-50);
  border-color: var(--color-gray-300);
}

.user-dropdown-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-arrow {
  font-size: 10px;
  transition: transform var(--transition-fast);
  color: var(--color-text-secondary);
}

.user-dropdown.open .user-dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: calc(var(--z-sticky) + 10);
}

.user-dropdown.open .user-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  width: 100%;
  padding: var(--spacing-3) var(--spacing-4);
  border: none;
  background: none;
  text-align: left;
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.user-dropdown-item:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-dropdown-logout {
  color: var(--color-danger);
}

.user-dropdown-logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

.user-dropdown-icon {
  font-size: var(--font-size-base);
  width: 20px;
  text-align: center;
}

.user-dropdown-divider {
  margin: var(--spacing-2) 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

/* Main content */
.main {
  min-height: calc(100vh - var(--header-height));
  padding: var(--spacing-8) 0;
}

.main-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
}

/* Dashboard Layout */
.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
  padding: var(--spacing-6);
}

@media (min-width: 768px) {
  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .dashboard {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dashboard-section {
  grid-column: 1 / -1;
}

/* Admin Layout con Sidebar */
.admin-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
}

.admin-sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--spacing-6) 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-6);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.admin-sidebar-link:hover,
.admin-sidebar-link.active {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--color-primary);
  text-decoration: none;
}

.admin-content {
  flex: 1;
  padding: var(--spacing-8);
}

/* Responsive: nasconde sidebar su mobile */
@media (max-width: 1023px) {
  .admin-sidebar {
    display: none;
  }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-8);
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background-color: #ffffff;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Stats Section - User dashboard with improved contrast */
.stats-section .stat-card .stat-value {
  color: #1e40af; /* blue-800 - più scuro per migliore contrasto */
}

.stats-section .stat-card .stat-label,
.stats-section .stat-card .stat-unit,
.stats-section .stat-card .stat-category {
  color: #1f2937; /* gray-800 - molto più scuro */
}

.stat-icon {
  font-size: var(--font-size-base);
  margin-right: var(--spacing-1);
}

.stat-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: #1f2937; /* gray-800 */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-2);
  display: flex;
  align-items: center;
}

.stat-value {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: #1e40af; /* blue-800 */
  line-height: 1.1;
}

.stat-unit,
.stat-category {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: #374151; /* gray-700 */
  margin-top: var(--spacing-2);
}

.stat-change {
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-2);
}

.stat-change.positive { color: var(--color-success); }
.stat-change.negative { color: var(--color-danger); }

/* Data Table */
.data-table {
  width: 100%;
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table table {
  margin: 0;
}

.data-table thead {
  background-color: var(--color-surface);
}

.data-table th {
  padding: var(--spacing-4);
  font-weight: var(--font-weight-semibold);
  text-align: left;
}

.data-table td {
  padding: var(--spacing-4);
}

.data-table tr:hover {
  background-color: var(--color-gray-50);
}

/* Responsive table wrapper */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile: nasconde colonne non essenziali */
@media (max-width: 767px) {
  .hide-mobile {
    display: none;
  }
}

/* ============================================================
   DASHBOARD STYLES
   ============================================================ */

/* Header Content */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.header-title {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
}

.user-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

/* Alert Container */
.alert-container {
  position: fixed;
  top: calc(var(--header-height) + var(--spacing-4));
  right: var(--spacing-4);
  z-index: var(--z-toast);
  max-width: 400px;
  width: 100%;
}

/* Main Content */
.main-content {
  padding: var(--spacing-8) var(--spacing-4);
  min-height: calc(100vh - var(--header-height));
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: var(--spacing-4);
}

.loading-state .spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
  border-color: rgba(37, 99, 235, 0.3);
  border-top-color: var(--color-primary);
}

/* Dashboard Content */
.dashboard-content {
  max-width: 1200px;
  margin: 0 auto;
}

/* Section Title */
.section-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-6);
}

/* Stats Section */
.stats-section {
  margin-bottom: var(--spacing-10);
}

.stat-unit,
.stat-category {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--spacing-2);
}

.stat-category {
  font-weight: var(--font-weight-medium);
}

/* Macros Card */
.macros-card {
  padding: var(--spacing-6);
  margin-top: var(--spacing-6);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-6);
}

.card-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: calc(var(--spacing-6) * -1 + var(--spacing-2)) 0 var(--spacing-5) 0;
  line-height: var(--line-height-relaxed);
}

.macros-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
}

@media (min-width: 640px) {
  .macros-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.macro-item {
  text-align: center;
}

.macro-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-2);
}

/* ============================================================
   SCANNER CTA CARD
   ============================================================ */

/* Scanner CTA Card - Mobile-first responsive design */
.scanner-cta-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  margin-bottom: var(--spacing-6);
  border: none;
  box-shadow: var(--shadow-md);
}

.scanner-cta-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
  padding: var(--spacing-6);
  align-items: stretch;
}

.scanner-cta-text {
  flex: 1;
  min-width: 0;
}

.scanner-cta-title {
  margin: 0 0 var(--spacing-2) 0;
  font-size: var(--font-size-xl);
  color: white;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

.scanner-cta-description {
  margin: 0;
  color: white;
  opacity: 0.95;
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
}

.scanner-cta-button {
  background: white !important;
  color: var(--color-primary) !important;
  font-weight: var(--font-weight-bold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  width: 100%;
  border: none;
}

.scanner-cta-button:hover:not(:disabled) {
  background: var(--color-gray-50) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Tablet and desktop: horizontal layout */
@media (min-width: 640px) {
  .scanner-cta-content {
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-6);
  }

  .scanner-cta-button {
    width: auto;
    min-width: 160px;
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* Data Entry Section */
.data-entry-section {
  margin-bottom: var(--spacing-10);
}

.data-entry-section .card {
  padding: var(--spacing-6);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-5);
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .form-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: var(--spacing-6);
  display: flex;
  justify-content: flex-end;
}

/* Recent Entries Section */
.recent-entries-section {
  margin-bottom: var(--spacing-10);
}

.recent-entries-section .card {
  padding: var(--spacing-6);
}

/* Table Styles */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table thead {
  background-color: var(--color-surface);
}

.table th {
  padding: var(--spacing-3) var(--spacing-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  border-bottom: 2px solid var(--color-border);
}

.table td {
  padding: var(--spacing-3) var(--spacing-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.table tbody tr:hover {
  background-color: var(--color-gray-50);
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-10) var(--spacing-6);
  color: var(--color-text-secondary);
}

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

/* Charts Section */
.charts-section {
  margin-bottom: var(--spacing-10);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
}

@media (min-width: 1024px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.chart-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4) var(--spacing-6);
  border-bottom: 1px solid var(--color-border);
}

.chart-card .card-header h3 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.chart-period-select {
  min-width: 120px;
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-sm);
}

.chart-card .card-body {
  padding: var(--spacing-6);
  min-height: 300px;
}

.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: var(--spacing-4);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
}

.chart-container canvas {
  max-height: 300px;
}

/* Responsive: mobile adjustments */
@media (max-width: 767px) {
  .header-title {
    font-size: var(--font-size-xl);
  }

  .user-name {
    display: none;
  }

  .section-title {
    font-size: var(--font-size-xl);
  }

  .table {
    font-size: var(--font-size-xs);
  }

  .table th,
  .table td {
    padding: var(--spacing-2) var(--spacing-3);
  }

  .chart-card .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-3);
  }

  .chart-controls {
    width: 100%;
  }

  .chart-period-select {
    width: 100%;
  }
}

/* ============================================================
   ADMIN DASHBOARD STYLES
   ============================================================ */

/* Admin Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-4);
  margin-bottom: var(--spacing-8);
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Admin dashboard stat cards - gradient backgrounds need white text */
.admin-layout .stat-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--border-radius);
  padding: var(--spacing-6);
  text-align: center;
  color: white;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-layout .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.admin-layout .stat-card .stat-value,
.admin-layout .stat-card .stat-label,
.admin-layout .stat-card .stat-unit,
.admin-layout .stat-card .stat-category {
  color: white;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-2);
}

.stat-label {
  font-size: var(--font-size-sm);
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Users Section */
.users-section {
  margin-bottom: var(--spacing-10);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-6);
  flex-wrap: wrap;
  gap: var(--spacing-4);
}

.filters {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  flex-wrap: wrap;
}

.filters .form-input {
  min-width: 150px;
}

/* Users Table */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.users-table thead {
  background-color: var(--color-surface);
}

.users-table th {
  padding: var(--spacing-3) var(--spacing-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.users-table td {
  padding: var(--spacing-3) var(--spacing-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  vertical-align: middle;
}

.users-table tbody tr:hover {
  background-color: var(--color-gray-50);
}

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

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: var(--spacing-2);
  flex-wrap: wrap;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: 9999px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background-color: var(--color-primary);
  color: white;
}

.badge-secondary {
  background-color: var(--color-gray-500);
  color: white;
}

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

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

.badge-danger {
  background-color: var(--color-error);
  color: white;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-4);
  padding: var(--spacing-6);
  margin-top: var(--spacing-4);
}

#page-info {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

/* Modal styles moved to components.css */

/* User Details */
.user-details {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-6);
}

.detail-group {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--spacing-4);
}

.detail-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-group h4 {
  margin: 0 0 var(--spacing-4) 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-3) 0;
  border-bottom: 1px solid var(--color-gray-100);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

.detail-value {
  font-weight: var(--font-weight-normal);
  color: var(--color-text-primary);
  text-align: right;
}

/* Error State */
.error-state {
  text-align: center;
  padding: var(--spacing-10) var(--spacing-6);
}

.error-message {
  color: var(--color-error);
  margin-bottom: var(--spacing-4);
}

/* Responsive Admin */
@media (max-width: 767px) {
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    width: 100%;
  }

  .filters .form-input {
    flex: 1;
    min-width: 0;
  }

  .users-table {
    font-size: var(--font-size-xs);
  }

  .users-table th,
  .users-table td {
    padding: var(--spacing-2) var(--spacing-2);
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-buttons .btn {
    width: 100%;
  }

  .stat-value {
    font-size: 2rem;
  }
}

/* ============================================================
   INFO PANEL STYLES
   ============================================================ */

/* Info Section */
.info-section {
  margin-bottom: var(--spacing-10);
}

/* Info Panel Container */
.info-panel {
  overflow: hidden;
}

/* Toggle Button */
.info-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-5);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  color: var(--color-text-primary);
}

.info-panel-toggle:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0.08) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.info-panel-toggle:active {
  transform: translateY(0);
}

/* Info Icon */
.info-icon {
  font-size: var(--font-size-2xl);
  flex-shrink: 0;
}

/* Info Title */
.info-title {
  flex: 1;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

/* Expand Icon (Arrow) */
.expand-icon {
  font-size: var(--font-size-base);
  color: var(--color-primary);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.info-panel-toggle[aria-expanded="true"] .expand-icon {
  transform: rotate(180deg);
}

/* Panel Content */
.info-panel-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow) ease-in-out;
  padding: 0 var(--spacing-6);
}

.info-panel-content:not(.hidden) {
  max-height: 2000px;
  padding: var(--spacing-6);
}

/* Overview Section */
.info-overview {
  padding: var(--spacing-5);
  background-color: var(--color-surface);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-6);
}

.info-overview p {
  margin: 0;
  color: var(--color-text-primary);
  line-height: 1.6;
}

.info-overview a {
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.info-overview a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* Info Sections Container */
.info-sections {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

/* Info Detail (Details/Summary Accordion) */
.info-detail {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.info-detail:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.info-detail[open] {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.info-detail summary {
  padding: var(--spacing-4) var(--spacing-5);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  background-color: var(--color-surface);
  transition: background-color var(--transition-fast);
}

.info-detail summary::-webkit-details-marker {
  display: none;
}

.info-detail summary::before {
  content: '▶';
  display: inline-block;
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  transition: transform var(--transition-fast);
  margin-right: var(--spacing-2);
}

.info-detail[open] summary::before {
  transform: rotate(90deg);
}

.info-detail summary:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

.info-detail p,
.info-detail ul {
  padding: 0 var(--spacing-5) var(--spacing-4) var(--spacing-5);
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.info-detail p + p {
  margin-top: var(--spacing-3);
}

.info-detail ul {
  margin-top: var(--spacing-2);
  padding-left: calc(var(--spacing-5) + var(--spacing-6));
  list-style-type: disc;
}

.info-detail li {
  margin-bottom: var(--spacing-2);
}

.info-detail em {
  display: block;
  margin-top: var(--spacing-3);
  font-style: italic;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* Responsive: Mobile adjustments for info panel */
@media (max-width: 767px) {
  .info-panel-toggle {
    padding: var(--spacing-4);
  }

  .info-title {
    font-size: var(--font-size-base);
  }

  .info-icon {
    font-size: var(--font-size-xl);
  }

  .info-panel-content:not(.hidden) {
    padding: var(--spacing-4);
  }

  .info-overview {
    padding: var(--spacing-4);
  }

  .info-detail summary {
    padding: var(--spacing-3) var(--spacing-4);
    font-size: var(--font-size-sm);
  }

  .info-detail p,
  .info-detail ul {
    padding: 0 var(--spacing-4) var(--spacing-3) var(--spacing-4);
    font-size: var(--font-size-sm);
  }

  .info-detail ul {
    padding-left: calc(var(--spacing-4) + var(--spacing-5));
  }
}

/* ============================================================
   SETTINGS PAGE STYLES
   ============================================================ */

/* Settings Layout */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .settings-layout {
    grid-template-columns: 2fr 1fr;
  }
}

.settings-card {
  margin-bottom: var(--spacing-6);
}

/* Dual Inputs (Range + Number) */
.input-dual {
  display: flex;
  gap: var(--spacing-3);
  align-items: center;
}

.input-dual input[type="range"] {
  flex: 1;
}

.input-dual input[type="number"] {
  width: 100px;
}

/* ============================================================
   HEALTHY RANGE INDICATORS FOR SLIDERS
   ============================================================ */

/* Range wrapper container for healthy zone overlay */
.range-wrapper {
  position: relative;
  flex: 1;
  height: 32px;
  display: flex;
  align-items: center;
}

.range-wrapper input[type="range"] {
  position: relative;
  z-index: 2;
  width: 100%;
  background: transparent !important;
  background-color: transparent !important;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  height: 8px;
}

/* Healthy zone overlay - hidden, using track gradient instead */
.range-healthy-zone {
  display: none;
}

/* Gray track background - hidden, using track gradient instead */
.range-wrapper::before {
  display: none;
}

/* Range track styling - uses dynamic gradient from JS */
.range-wrapper input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--track-bg, #e5e7eb);
  border-radius: var(--radius-full);
}

.range-wrapper input[type="range"]::-moz-range-track {
  height: 8px;
  background: var(--track-bg, #e5e7eb);
  border-radius: var(--radius-full);
}

/* Range thumb styling */
.range-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 10;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  border: 3px solid white;
}

.range-wrapper input[type="range"]::-moz-range-thumb {
  position: relative;
  z-index: 10;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  border: 3px solid white;
}

/* Hover state */
.range-wrapper input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.5);
}

/* Focus state for accessibility */
.range-wrapper input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2), 0 2px 6px rgba(37, 99, 235, 0.4);
}

/* Thumb color when outside healthy range - warning */
.range-wrapper.outside-range input[type="range"]::-webkit-slider-thumb {
  background: var(--color-warning);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

.range-wrapper.outside-range input[type="range"]::-moz-range-thumb {
  background: var(--color-warning);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

/* Thumb color when far outside range - danger */
.range-wrapper.far-outside-range input[type="range"]::-webkit-slider-thumb {
  background: var(--color-danger);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.range-wrapper.far-outside-range input[type="range"]::-moz-range-thumb {
  background: var(--color-danger);
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* Range status indicator badge */
.range-status {
  margin-top: var(--spacing-2);
  min-height: 24px;
}

.range-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
}

.range-status-icon {
  font-size: 0.75rem;
}

/* Status badge colors */
.range-status-optimal {
  background-color: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.range-status-acceptable {
  background-color: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.range-status-warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.range-status-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* Responsive adjustments for range */
@media (max-width: 767px) {
  .range-wrapper {
    height: 40px;
  }

  .range-wrapper input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -8px;
  }

  .range-healthy-zone {
    height: 10px;
  }

  .range-wrapper::before {
    height: 10px;
  }
}

/* ============================================================
   Health Conditions Section
   ============================================================ */

.card-description {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-4);
  line-height: 1.5;
}

.health-conditions-grid {
  display: grid;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-4);
}

.health-condition-item {
  display: flex;
  align-items: flex-start;
  padding: var(--spacing-3);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.health-condition-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.health-condition-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.health-condition-item .checkmark {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: var(--color-surface);
}

.health-condition-item input[type="checkbox"]:checked + .checkmark {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.health-condition-item input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.health-condition-item .condition-info {
  flex: 1;
}

.health-condition-item .condition-info strong {
  display: block;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-1);
}

.health-condition-item .condition-info small {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

/* Hide PCOS for males */
.health-condition-item.hidden {
  display: none;
}

/* Consent section */
.consent-section {
  margin: var(--spacing-4) 0;
  padding: var(--spacing-4);
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
}

.consent-item {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  position: relative;
}

.consent-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.consent-item .checkmark {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: var(--color-surface);
}

.consent-item input[type="checkbox"]:checked + .checkmark {
  background: var(--color-primary);
}

.consent-item input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.consent-item .consent-text {
  flex: 1;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ============================================================
   Health Conditions Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-4);
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

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

.modal-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease-out;
}

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

.modal-header {
  padding: var(--spacing-6);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.modal-header h2 {
  margin: 0 0 var(--spacing-2) 0;
  font-size: var(--font-size-xl);
  color: var(--color-text-primary);
}

.modal-header p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.modal-body {
  padding: var(--spacing-6);
}

.modal-intro {
  margin: 0 0 var(--spacing-4) 0;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.health-modal-grid {
  display: grid;
  gap: var(--spacing-3);
}

.health-modal-item {
  display: flex;
  align-items: flex-start;
  padding: var(--spacing-3);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.health-modal-item:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.health-modal-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.health-modal-item .checkmark {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-right: var(--spacing-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: var(--color-surface);
}

.health-modal-item input[type="checkbox"]:checked + .checkmark {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.health-modal-item input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.health-modal-item .condition-info {
  flex: 1;
}

.health-modal-item .condition-info strong {
  display: block;
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  margin-bottom: 2px;
}

.health-modal-item .condition-info small {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
}

.health-modal-item.hidden {
  display: none;
}

.modal-consent {
  margin-top: var(--spacing-4);
  padding: var(--spacing-4);
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
}

.modal-footer {
  padding: var(--spacing-4) var(--spacing-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-3);
  background: var(--color-background);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-footer .btn {
  min-width: 120px;
}

/* Responsive modal */
@media (max-width: 767px) {
  .modal-overlay {
    padding: var(--spacing-2);
    align-items: flex-end;
  }

  .modal-container {
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* Advanced Form Groups */
.form-group-advanced {
  margin-bottom: var(--spacing-6);
}

.form-group-advanced label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2);
  font-weight: var(--font-weight-medium);
}

.helper-text {
  display: block;
  margin-top: var(--spacing-1);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Reset Button */
.btn-reset {
  background: none;
  border: 1px solid var(--color-border);
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: var(--font-weight-normal);
}

.btn-reset:hover {
  background-color: var(--color-gray-100);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Preview Panel */
.settings-preview {
  position: relative;
}

.preview-card.sticky {
  position: sticky;
  top: calc(var(--header-height) + var(--spacing-4));
  max-height: calc(100vh - var(--header-height) - var(--spacing-8));
  overflow-y: auto;
}

.preview-section {
  margin-bottom: var(--spacing-5);
  padding-bottom: var(--spacing-4);
  border-bottom: 1px solid var(--color-border);
}

.preview-section:last-child {
  border-bottom: none;
}

.preview-section h4 {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-2);
  font-weight: var(--font-weight-semibold);
}

.preview-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  line-height: 1.2;
}

.preview-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--spacing-1);
}

.macros-preview {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-4);
}

.macro-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-2) 0;
}

.macro-name {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.macro-value {
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  font-size: var(--font-size-lg);
}

.macro-percent {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  min-width: 50px;
  text-align: right;
}

.preview-note {
  background-color: #eff6ff;
  padding: var(--spacing-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  color: #3b82f6;
  margin-top: var(--spacing-4);
  line-height: 1.5;
}

/* Preview Chart */
#preview-chart {
  max-height: 200px;
  margin-top: var(--spacing-4);
}

/* Responsive Settings */
@media (max-width: 1023px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .preview-card.sticky {
    position: relative;
    top: 0;
    max-height: none;
  }
}

@media (max-width: 767px) {
  .form-group-advanced label {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
  }

  .btn-reset {
    align-self: flex-start;
  }

  .input-dual {
    flex-direction: column;
    align-items: stretch;
  }

  .input-dual input[type="number"] {
    width: 100%;
  }

  .macro-preview {
    font-size: var(--font-size-sm);
  }
}

/* ============================================================
   WEIGHT GOAL SECTION
   ============================================================ */
.weight-goal-section {
  margin-bottom: var(--spacing-8);
}

.weight-goal-card {
  padding: var(--spacing-6);
}

/* Hero Stats - Current, Target, Difference */
.weight-goal-hero {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: var(--spacing-6);
  margin-bottom: var(--spacing-8);
  padding: var(--spacing-6);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.02));
  border-radius: var(--radius-lg);
}

.weight-stat {
  text-align: center;
  flex: 1;
}

.weight-stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-2);
  font-weight: var(--font-weight-medium);
}

.weight-stat-value {
  font-size: 2.5rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  line-height: 1;
}

.weight-stat-unit {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  margin-top: var(--spacing-1);
}

.weight-stat-arrow {
  font-size: 2rem;
  color: var(--color-primary);
  opacity: 0.5;
}

.weight-stat-diff .weight-stat-value {
  color: var(--color-success);
}

.weight-stat-diff.negative .weight-stat-value {
  color: var(--color-danger);
}

/* Progress Bar */
.weight-progress-container {
  margin-bottom: var(--spacing-6);
}

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

.weight-progress-label {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.weight-progress-percentage {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.weight-progress-bar {
  position: relative;
  height: 32px;
  background-color: var(--color-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.weight-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-success));
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.weight-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Milestones on progress bar */
#weight-milestones {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.weight-milestone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.weight-milestone::after {
  content: attr(data-label);
  position: absolute;
  top: -24px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
  background-color: white;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* Footer Info */
.weight-goal-footer {
  padding-top: var(--spacing-6);
  border-top: 1px solid var(--color-border);
}

.weight-goal-info {
  display: flex;
  gap: var(--spacing-6);
  justify-content: space-around;
}

.weight-info-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
  text-align: center;
}

.weight-info-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.weight-info-value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .weight-goal-hero {
    flex-direction: column;
    gap: var(--spacing-4);
  }

  .weight-stat-arrow {
    transform: rotate(90deg);
  }

  .weight-stat-value {
    font-size: 2rem;
  }

  .weight-goal-info {
    flex-direction: column;
    gap: var(--spacing-4);
  }

  .weight-milestone::after {
    font-size: 0.65rem;
    padding: 1px 3px;
  }
}

/* ============================================================
   ESTIMATED TIME DISPLAY (Tempo Stimato)
   ============================================================ */

/* Container for estimated time with full width support */
.weight-info-item-full {
  grid-column: 1 / -1; /* Span all columns */
}

.weight-info-value-container {
  width: 100%;
  margin-top: var(--spacing-2);
}

/* Main estimated time display */
.estimated-time-display {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  font-size: 0.95rem;
}

/* Comparison container */
.estimate-comparison {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
  padding: var(--spacing-3);
  background-color: var(--color-gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-200);
}

/* Individual estimate row */
.estimate-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  flex-wrap: wrap;
}

/* Label for estimate */
.estimate-label {
  font-weight: 500;
  color: var(--color-text-secondary);
  min-width: 130px;
}

/* Value display */
.estimate-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
}

/* Badge styles */
.estimate-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Details section */
.estimate-details {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
  padding: var(--spacing-2) var(--spacing-3);
  background-color: white;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.estimate-details strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Note/help text */
.estimate-note {
  padding: var(--spacing-2) var(--spacing-3);
  background-color: #eff6ff;
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.estimate-note a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.estimate-note a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .estimate-comparison {
    padding: var(--spacing-2);
  }

  .estimate-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
  }

  .estimate-label {
    min-width: auto;
    font-size: 0.85rem;
  }

  .estimate-value {
    font-size: 1rem;
  }

  .estimate-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
  }

  .estimate-details {
    font-size: 0.85rem;
    padding: var(--spacing-2);
  }

  .estimate-note {
    font-size: 0.8rem;
    padding: var(--spacing-2);
  }
}

/* ============================================================
   EVIDENCE-BASED PANEL - Pannello riferimenti scientifici
   ============================================================ */

.weight-goal-evidence {
  margin-top: var(--spacing-4);
  border-top: 1px solid var(--color-border);
  padding-top: var(--spacing-4);
}

.evidence-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.evidence-toggle:hover {
  background: var(--color-background);
  border-color: var(--color-primary);
}

.evidence-toggle .expand-icon {
  font-size: var(--font-size-lg);
  font-weight: bold;
  color: var(--color-primary);
}

.evidence-content {
  margin-top: var(--spacing-3);
  padding: var(--spacing-4);
  background: var(--color-background-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.evidence-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--spacing-2) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.evidence-item:last-of-type {
  border-bottom: none;
}

.evidence-label {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  flex: 1;
  min-width: 150px;
}

.evidence-value {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.evidence-modifiers {
  width: 100%;
  margin-top: var(--spacing-2);
  padding-left: var(--spacing-4);
  list-style: none;
}

.evidence-modifiers li {
  padding: var(--spacing-2) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  border-bottom: 1px dotted var(--color-border-light);
}

.evidence-modifiers li:last-child {
  border-bottom: none;
}

.evidence-modifiers strong {
  color: var(--color-text);
  text-transform: capitalize;
}

.evidence-source {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--color-primary);
  margin-top: var(--spacing-1);
}

.evidence-references {
  margin-top: var(--spacing-4);
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--color-border);
}

.evidence-references h4 {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--spacing-3);
}

.evidence-references ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.evidence-references li {
  padding: var(--spacing-2) 0;
  border-bottom: 1px dotted var(--color-border-light);
}

.evidence-references li:last-child {
  border-bottom: none;
}

.evidence-references a {
  color: var(--color-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.evidence-references a:hover {
  text-decoration: underline;
}

.ref-journal {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-style: italic;
  margin-top: var(--spacing-1);
}

.ref-finding {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  margin: var(--spacing-1) 0 0 0;
  padding-left: var(--spacing-3);
  border-left: 2px solid var(--color-primary-light);
}

.evidence-disclaimer {
  margin-top: var(--spacing-4);
  padding: var(--spacing-3);
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
}

.evidence-disclaimer small {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .evidence-item {
    flex-direction: column;
    gap: var(--spacing-1);
  }

  .evidence-value {
    width: 100%;
  }

  .evidence-toggle {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-xs);
  }

  .evidence-content {
    padding: var(--spacing-3);
  }
}

/* ============================================================
   BMI RECOMMENDATION CARD - Card raccomandazione BMI settings
   ============================================================ */

.bmi-recommendation-card {
  margin-bottom: var(--spacing-4);
  padding: var(--spacing-4);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid var(--color-primary-light);
  border-radius: var(--radius-lg);
}

.recommendation-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
  margin-bottom: var(--spacing-2);
}

.recommendation-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  line-height: 1.2;
}

.recommendation-range {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-3);
}

.recommendation-reason {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--spacing-3);
}

#use-recommended-bmi {
  margin-top: var(--spacing-2);
}

/* Cache bust: 1764374310 */
/* White text update: 1764374405 */
/* Tempo stimato feature: 1732900004 */
/* Evidence-based panel: 1733012400 */
