/* ============================================================ */
/* HABIT TRACKER & CALENDAR STYLES                              */
/* AESTHETIC: FRESH SAGE, CRISP WHITE CARDS & VIBRANT STREAKS   */
/* ============================================================ */

/* Habit Check Button: Circular Tactile Button */
.habit-check-btn {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 36px;
  min-height: 36px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  border: 2px solid var(--border-medium, #E7E0D6);
  background-color: #FFFFFF;
  box-shadow: 0 1px 3px 0 rgba(31, 26, 22, 0.04);
  -webkit-tap-highlight-color: transparent;
}

/* Maniglia dedicata per riordino touch su mobile (evita conflitti con lo scroll verticale) */
.habit-drag-handle {
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.habit-drag-handle:active {
  cursor: grabbing;
}

.habit-check-btn:active {
  transform: scale(0.86);
}

/* Stato Checked: Fresh Sage / Mint con ombra vibrante */
.habit-check-btn.checked {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border-color: #10B981;
  box-shadow: 0 3px 12px -1px rgba(16, 185, 129, 0.45);
  color: #ffffff;
}

.habit-check-btn.checked svg {
  animation: habitCheckPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  stroke: #ffffff;
}

/* Stato Unchecked */
.habit-check-btn.unchecked {
  border-color: #D8D0C5;
  background-color: #FFFFFF;
  color: transparent;
}

.habit-check-btn.unchecked:hover {
  border-color: #10B981;
  background-color: #F0FDF4;
  color: rgba(16, 185, 129, 0.4);
}

@keyframes habitCheckPop {
  0% { transform: scale(0.3) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.22) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Habit Card Styling: Bianco puro su canvas avorio, bordi caldi e ombra leggera */
.habit-card {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  background-color: #FFFFFF;
  border: 1px solid rgba(44, 38, 34, 0.08);
  border-radius: 1.25rem;
  box-shadow: 0 2px 8px -2px rgba(31, 26, 22, 0.04);
  -webkit-tap-highlight-color: transparent;
}

.habit-card:hover {
  border-color: rgba(44, 38, 34, 0.16);
  box-shadow: 0 8px 22px -4px rgba(31, 26, 22, 0.08);
  transform: translateY(-2px);
}

.habit-card:active {
  transform: scale(0.992);
}

.habit-card.is-completed {
  opacity: 0.94;
  border-color: rgba(16, 185, 129, 0.25);
  background: linear-gradient(180deg, #FFFFFF 0%, #F5FBF7 100%);
}

/* Anello di Progresso Circolare SVG */
.progress-ring-circle {
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  stroke: #10B981;
}

/* Streak Flame Badge: Arancio Sunset vibrante con micro-fiamma */
.flame-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(255, 90, 54, 0.14) 0%, rgba(245, 158, 11, 0.14) 100%);
  border: 1px solid rgba(255, 90, 54, 0.32);
  color: #E84824;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  box-shadow: 0 1px 4px 0 rgba(255, 90, 54, 0.1);
}

.flame-icon {
  animation: flameFlicker 1.8s infinite alternate ease-in-out;
  display: inline-block;
}

@keyframes flameFlicker {
  0% { transform: scale(1) rotate(-3deg); filter: brightness(1); }
  50% { transform: scale(1.18) rotate(5deg); filter: brightness(1.2); }
  100% { transform: scale(1) rotate(-2deg); filter: brightness(1.05); }
}

/* Matrix Table: Colonna sinistra sticky per scorrimento mobile */
.habit-matrix-table th, 
.habit-matrix-table td {
  padding: 0.65rem 0.5rem;
  text-align: center;
}

.habit-matrix-table th:first-child,
.habit-matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 15;
  background-color: #FAF8F5;
  border-right: 1px solid var(--border-medium, #E7E0D6);
  box-shadow: 4px 0 10px -3px rgba(31, 26, 22, 0.06);
}

.matrix-cell-btn {
  width: 2.25rem;
  height: 2.25rem;
  min-width: 34px;
  min-height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
  font-size: 0.85rem;
}

.matrix-cell-btn:active {
  transform: scale(0.85);
}

.matrix-cell-btn.checked {
  background: #10B981;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 8px -1px rgba(16, 185, 129, 0.45);
}

.matrix-cell-btn.unchecked {
  background: #F5F1EB;
  border-color: #E2DAD0;
  color: transparent;
}

.matrix-cell-btn.unchecked:hover,
.matrix-cell-btn.unchecked:active {
  border-color: #10B981;
  background-color: #F0FDF4;
  color: rgba(16, 185, 129, 0.5);
}

/* Calendar Heatmap Tiles (Compact per Mobile) */
.cal-day-cell {
  aspect-ratio: 1;
  min-height: 3.25rem;
  transition: all 0.18s ease;
  cursor: pointer;
  border-radius: 12px;
  background-color: #FFFFFF;
  border: 1px solid rgba(44, 38, 34, 0.08);
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
  .cal-day-cell {
    min-height: 2.5rem;
    border-radius: 10px;
    padding: 0.2rem !important;
  }
}

.cal-day-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px -2px rgba(31, 26, 22, 0.08);
  z-index: 5;
}

.cal-day-cell:active {
  transform: scale(0.95);
}

.cal-day-cell.is-today {
  border-color: #FF5A36 !important;
  box-shadow: 0 0 0 1.5px #FF5A36, 0 3px 10px -1px rgba(255, 90, 54, 0.35);
}

.cal-day-cell.is-selected {
  border-color: #0EA5E9 !important;
  box-shadow: 0 0 0 2px #0EA5E9, 0 4px 14px -2px rgba(14, 165, 233, 0.4);
  background-color: rgba(14, 165, 233, 0.12) !important;
  color: #0369A1 !important;
}
