/* ============================================================ */
/* HABIT TRACKER PRO — CORE STYLES & APPLICATION SHELL          */
/* AESTHETIC: WARM MINIMAL & SPARKLING MODERN                  */
/* ============================================================ */

/* ============================================================ */
/* BASE SETUP & SMOOTH SCROLLBARS                               */
/* ============================================================ */

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-canvas, #FAF8F5);
  color: var(--text-primary, #1F1A16);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Custom Smooth Scrollbars con Tonalità Calde e Discrete */
::-webkit-scrollbar {
  height: 0.35rem;
  width: 0.35rem;
}
::-webkit-scrollbar-track {
  background: rgba(231, 224, 214, 0.4);
}
::-webkit-scrollbar-thumb {
  background: #D5CBBF;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #B6ACA0;
}

/* ============================================================ */
/* GLOW PULSES & ACCENT EFFECTS                                 */
/* ============================================================ */
.glow-brand {
  box-shadow: 0 0 25px -4px rgba(255, 90, 54, 0.3);
}
.glow-emerald {
  box-shadow: 0 0 25px -4px rgba(16, 185, 129, 0.3);
}
.glow-amber {
  box-shadow: 0 0 25px -4px rgba(245, 158, 11, 0.3);
}
.glow-iris {
  box-shadow: 0 0 25px -4px rgba(99, 102, 241, 0.3);
}

/* ============================================================ */
/* NOTION STYLE CARDS & TASK TRACKER CLASSES                    */
/* ============================================================ */
.notion-board-col {
  min-width: 18.5rem;
  max-width: 20.5rem;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(44, 38, 34, 0.08);
  border-radius: 1.25rem;
}

@media (max-width: 768px) {
  .notion-board-col {
    min-width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin-bottom: 1rem;
  }
}

.task-card {
  background-color: #FFFFFF;
  border: 1px solid rgba(44, 38, 34, 0.08);
  border-radius: 1rem;
  box-shadow: 0 2px 6px -1px rgba(31, 26, 22, 0.04);
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.18s ease;
}
.task-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 8px 18px -3px rgba(31, 26, 22, 0.08);
}
.task-card:active {
  transform: scale(0.99);
}

/* Badges con Colori Frizzanti ed Alta Leggibilità */
.badge-priority,
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 9999px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* Badges Priorità — Matrice Eisenhower (4 Categorie) */
.badge-priority-urgente-importante,
.badge-priority-alta {
  background-color: #FEE2E2 !important;
  color: #DC2626 !important;
  border: 1px solid #FCA5A5 !important;
}

.badge-priority-urgente-non-importante {
  background-color: #FEF3C7 !important;
  color: #D97706 !important;
  border: 1px solid #FCD34D !important;
}

.badge-priority-non-urgente-importante,
.badge-priority-media {
  background-color: #EEF2FF !important;
  color: #4F46E5 !important;
  border: 1px solid #C7D2FE !important;
}

.badge-priority-non-urgente-non-importante,
.badge-priority-bassa {
  background-color: #F1F5F9 !important;
  color: #64748B !important;
  border: 1px solid #CBD5E1 !important;
}

.badge-status-da-iniziare {
  background-color: #F5F1EB !important;
  color: #6E655F !important;
  border: 1px solid #E7E0D6 !important;
}
.badge-status-in-corso {
  background-color: #EEF2FF !important;
  color: #4F46E5 !important;
  border: 1px solid #C7D2FE !important;
}
.badge-status-fatto {
  background-color: #ECFDF5 !important;
  color: #059669 !important;
  border: 1px solid #A7F3D0 !important;
}

/* Today Button nella task card */
.card-today-btn {
  background-color: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
  transition: all 0.15s ease;
}
.card-today-btn:hover {
  background-color: #FDE68A;
}
.card-today-btn.is-today-active {
  background-color: #F59E0B !important;
  border-color: #D97706 !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px -1px rgba(245, 158, 11, 0.4);
}

.task-footer-bar {
  border-top: 1px solid rgba(44, 38, 34, 0.06);
}

/* Category filter chips */
.category-chip-btn {
  min-height: 2.25rem;
  letter-spacing: -0.01em;
  border-radius: 0.85rem;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.category-chip-btn:active {
  transform: scale(0.96);
}
/* Salvaguardia contrasto etichette attive: testo sempre scuro ad altissima leggibilità */
.category-chip-btn.active-chip {
  color: #1F1A16 !important;
}
.category-chip-btn.active-chip > span:not(.cat-chip-count) {
  color: #1F1A16 !important;
}

/* Modale Gestione Etichette: contrasto e icone ad alta visibilità */
#modal-reorder-categories .reorder-category-item {
  color: #1F1A16 !important;
}
#modal-reorder-categories .reorder-category-item * {
  color: inherit;
}
#modal-reorder-categories .reorder-drag-handle {
  color: #6E655F !important;
}
#modal-reorder-categories .reorder-drag-handle:hover {
  color: #1F1A16 !important;
}

/* ============================================================ */
/* GYM SPREADSHEET & WORKOUT STYLES                             */
/* ============================================================ */
.sheet-scroll::-webkit-scrollbar {
  height: 0.35rem;
  width: 0.35rem;
}
.sheet-scroll::-webkit-scrollbar-track {
  background: rgba(231, 224, 214, 0.4);
}
.sheet-scroll::-webkit-scrollbar-thumb {
  background: #D5CBBF;
  border-radius: 9999px;
}

/* Timer Pulsante con Solar Gold Amber Glow */
.timer-pulse {
  animation: timerPulse 2s infinite ease-in-out;
}
@keyframes timerPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
  50% { transform: scale(1.02); filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.45)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0)); }
}

/* Pallini Cliccabili Selezione Settimana (W1, W2, W3...) e Bottoni Attivi Gym */
.week-dot-btn {
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.week-dot-btn:active {
  transform: scale(0.9) !important;
}
.week-dot-btn:hover:not(.active):not(.gym-active-btn) {
  transform: translateY(-1.5px);
  border-color: #FF5A36 !important;
  color: #FF5A36 !important;
  box-shadow: 0 3px 10px -2px rgba(255, 90, 54, 0.25);
}

/* Regole per bottoni Gym attivi stile Habits: arancio #FF5A36 e testo bianco */
.gym-active-btn,
.week-dot-btn.active,
.gym-day-btn.active,
.view-tab-btn.active,
button.active.gym-active-btn {
  background-color: #FF5A36 !important;
  border-color: #FF5A36 !important;
  color: #FFFFFF !important;
}

.gym-active-btn *,
.week-dot-btn.active *,
.gym-day-btn.active *,
.view-tab-btn.active *,
button.active.gym-active-btn * {
  color: #FFFFFF !important;
}

/* ============================================================ */
/* FORM INPUTS, SELECT, TEXTAREA: CRISP WHITE CON BORDO CALDO   */
/* ============================================================ */
input,
select,
textarea {
  background-color: #FFFFFF !important;
  color: var(--text-primary, #1F1A16) !important;
  border-color: #E2DAD0 !important;
  border-radius: 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Allineamento dimensionale testo input/select/textarea al testo delle card (0.875rem / text-sm) e adattamento dinamico ai 5 livelli di Zoom (rem) */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(#habit-input-icon),
select,
textarea {
  font-size: 0.875rem !important;
  line-height: 1.35;
}

/* Conversione classi tipografiche fisse (px) in unità relative (rem) per scalare con i livelli di Zoom dell'App */
.text-\[9px\]  { font-size: 0.66rem !important; line-height: 1.25; }
.text-\[10px\] { font-size: 0.72rem !important; line-height: 1.3; }
.text-\[11px\] { font-size: 0.78rem !important; line-height: 1.35; }
.text-\[12px\] { font-size: 0.85rem !important; line-height: 1.4; }
.text-\[13px\] { font-size: 0.925rem !important; line-height: 1.4; }

input:focus,
select:focus,
textarea:focus {
  border-color: #FF5A36 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(255, 90, 54, 0.16) !important;
}

select option {
  background-color: #FFFFFF !important;
  color: #1F1A16 !important;
}

input::placeholder,
textarea::placeholder {
  color: #9C9289 !important;
}

/* ============================================================ */
/* MODALI, OVERLAY & DIALOG: WARM GLASS & FLOATING CARDS        */
/* ============================================================ */
.modal-overlay,
.fixed.bg-slate-950\/95,
.fixed.bg-slate-950\/80 {
  background-color: rgba(31, 26, 22, 0.45) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

/* Finestra modale interna */
.modal-overlay > div,
.fixed > div.bg-slate-900,
.fixed > div.bg-slate-900\/90,
.fixed > div.bg-slate-900\/95 {
  background-color: #FFFFFF !important;
  border: 1px solid rgba(44, 38, 34, 0.1) !important;
  box-shadow: 0 20px 48px -10px rgba(31, 26, 22, 0.18), 0 8px 16px -4px rgba(31, 26, 22, 0.08) !important;
  border-radius: 1.5rem !important;
}

/* Stile globale modali e card interne: testo e titoli sempre visibili in nero puro */
.modal-overlay h1, .modal-overlay h2, .modal-overlay h3, .modal-overlay h4,
.fixed > div h1, .fixed > div h2, .fixed > div h3, .fixed > div h4,
#modal-create-routine h3, #modal-edit-routine h3, #modal-reorder-categories h3,
#modal-exercise h3, #modal-workout-exercise-sets h3, #modal-no-routine-alert h3,
#modal-routine-missing-dates h3, #task-notion-modal h3, #modal-habit-edit h3 {
  color: #1F1A16 !important;
}

/* Guardia globale contro testo bianco su sfondi rimappati a chiaro (bg-slate-800/900/950) */
.bg-slate-800.text-white,
.bg-slate-900.text-white,
.bg-slate-950.text-white,
button.bg-slate-800:hover,
button.bg-slate-900:hover {
  color: #1F1A16 !important;
}

/* Ergonomia Smartphone: Modali stile Bottom Sheet */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0.5rem !important;
  }
  .modal-overlay > div {
    max-height: 92dvh !important;
    border-bottom-left-radius: 1.25rem !important;
    border-bottom-right-radius: 1.25rem !important;
  }
}

/* Sticky column per Foglio Carichi Gym su Mobile */
.sheet-sticky-col {
  position: sticky;
  left: 0;
  z-index: 15;
  background-color: #FFFFFF;
  box-shadow: 3px 0 8px -2px rgba(31, 26, 22, 0.06);
}
thead .sheet-sticky-col {
  background-color: #FAF8F5;
  z-index: 20;
}

.modal-overlay label,
.fixed > div label,
.modal-overlay p,
.fixed > div p {
  color: #1F1A16 !important;
}

/* Modali: input, select, textarea */
.modal-overlay input,
.fixed > div input,
.modal-overlay select,
.fixed > div select,
.modal-overlay textarea,
.fixed > div textarea {
  color: #1F1A16 !important;
  background-color: #FFFFFF !important;
  border-color: #D5CBBF !important;
}

/* Header modali con bordo chiaro */
.modal-overlay .border-b,
.fixed > div .border-b,
.modal-overlay .border-t,
.fixed > div .border-t {
  border-color: #E7E0D6 !important;
}

/* Pulsanti chiusura modali (X) */
.modal-overlay button[onclick*="close"],
.fixed > div button[onclick*="close"],
.modal-overlay button[onclick*="Close"],
.fixed > div button[onclick*="Close"] {
  color: #1F1A16 !important;
}

/* GYM View: Coerenza con lo stile Habits (Sunset Coral #FF5A36, sfondi caldi e contrasto elevato) */
#view-gym-app,
#view-section-workout,
#view-section-manage,
#view-section-reports,
#view-section-spreadsheet,
#context-bar-section {
  color: #1F1A16;
}

#view-gym-app h1, #view-gym-app h2, #view-gym-app h3, #view-gym-app h4,
#view-gym-app p, #view-gym-app label {
  color: #1F1A16;
}

/* Pulsanti attivi stile arancio Habit (Sunset Coral) con testo bianco puro */
#view-gym-app .gym-active-btn,
#view-gym-app button.gym-active-btn,
#view-gym-app button.active,
#view-gym-app .week-dot-btn.active,
#view-gym-app .gym-day-btn.active,
#view-gym-app button[class*="bg-[#FF5A36]"],
#view-gym-app button[class*="bg-emerald-600"] {
  background-color: #FF5A36 !important;
  color: #FFFFFF !important;
  border-color: #FF5A36 !important;
  box-shadow: 0 3px 10px -1px rgba(255, 90, 54, 0.4) !important;
}

#view-gym-app .gym-active-btn span,
#view-gym-app button.gym-active-btn span,
#view-gym-app button.active span,
#view-gym-app .week-dot-btn.active span,
#view-gym-app .gym-day-btn.active span,
#view-gym-app button[class*="bg-[#FF5A36]"] span {
  color: #FFFFFF !important;
}

/* Pulsanti regolari / inattivi con testo scuro leggibile */
#view-gym-app button:not(.gym-active-btn):not(.active):not([class*="bg-[#FF5A36]"]):not([class*="bg-emerald-600"]):not(.text-white) {
  color: #1F1A16 !important;
}

/* Fix per routine cards in Gym */
#routines-list-container > div {
  background-color: #FFFFFF !important;
  color: #1F1A16 !important;
}
#routines-list-container button {
  color: #1F1A16 !important;
}
#routines-list-container span,
#routines-list-container strong {
  color: #1F1A16 !important;
}

/* ============================================================ */
/* CALENDAR EVENTS: SKY AZURE HIGHLIGHTS                        */
/* ============================================================ */
.calendar-card {
  word-break: break-word;
  overflow-wrap: anywhere;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 1rem;
  background-color: #FFFFFF;
  border: 1px solid rgba(44, 38, 34, 0.08);
}
.calendar-card:hover {
  border-color: rgba(14, 165, 233, 0.4);
  box-shadow: 0 6px 18px -2px rgba(14, 165, 233, 0.12);
  transform: translateY(-1px);
}
.calendar-card:hover .event-title {
  color: #0EA5E9 !important;
}

/* ============================================================ */
/* DRAG & DROP ANIMAZIONI CON BAGLIORE CORAL BRAND              */
/* ============================================================ */
.reorder-category-item,
.reorder-habit-item {
  will-change: transform, box-shadow, opacity;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  touch-action: pan-y;
}

.reorder-category-item.is-dragging,
.reorder-habit-item.is-dragging,
.habit-card.is-dragging,
.habit-matrix-card.is-dragging,
.habit-matrix-row.is-dragging,
.task-card.is-dragging {
  opacity: 0.75 !important;
  transform: scale(1.02) !important;
  box-shadow: 0 14px 28px -4px rgba(255, 90, 54, 0.25) !important;
  border-color: #FF5A36 !important;
  background-color: rgba(255, 90, 54, 0.06) !important;
  z-index: 30;
}

.reorder-category-item.drag-target-over,
.reorder-habit-item.drag-target-over,
.habit-card.drag-target-over,
.habit-matrix-card.drag-target-over,
.habit-matrix-row.drag-target-over,
.task-card.drag-target-over {
  border-color: #FF5A36 !important;
  background-color: rgba(255, 90, 54, 0.08) !important;
  transform: scale(0.99);
  box-shadow: 0 0 0 2px #FF5A36, 0 6px 14px -3px rgba(255, 90, 54, 0.2) !important;
}

@keyframes dropPulse {
  0% { transform: scale(1.02); box-shadow: 0 0 16px rgba(255, 90, 54, 0.35); border-color: #FF5A36; }
  60% { transform: scale(0.99); }
  100% { transform: scale(1); box-shadow: none; }
}

.reorder-category-item.just-dropped,
.reorder-habit-item.just-dropped,
.task-card.just-dropped {
  animation: dropPulse 0.35s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* ============================================================ */
/* TOAST CONTAINER & NOTIFICATIONS: WARM GLASS WITH GLOW        */
/* ============================================================ */
#toast-container,
#toast-container div,
#toast-container span,
#toast-container p,
#toast-container strong,
#toast-container button {
  color: #1F1A16 !important;
}

#toast-container > div {
  background-color: #FFFFFF !important;
  border: 1px solid #E7E0D6 !important;
  color: #1F1A16 !important;
  box-shadow: 0 10px 25px -3px rgba(31, 26, 22, 0.15), 0 4px 6px -2px rgba(31, 26, 22, 0.08) !important;
}

.app-toast {
  background: #FFFFFF !important;
  border: 1px solid #E7E0D6 !important;
  color: #1F1A16 !important;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -3px rgba(31, 26, 22, 0.12), 0 4px 6px -2px rgba(31, 26, 22, 0.05);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* MODALE SERIE GYM LIVE (Foto 1) */
#modal-workout-exercise-sets {
  color: #1F1A16 !important;
}

#modal-workout-exercise-sets .bg-slate-50,
#modal-workout-exercise-sets .bg-slate-900,
#modal-workout-exercise-sets .bg-slate-950 {
  background-color: #FAF8F5 !important;
}

#modal-workout-exercise-sets h1,
#modal-workout-exercise-sets h2,
#modal-workout-exercise-sets h3,
#modal-workout-exercise-sets h4,
#modal-workout-exercise-sets span,
#modal-workout-exercise-sets label,
#modal-workout-exercise-sets p,
#modal-workout-exercise-sets strong,
#modal-workout-exercise-sets input {
  color: #1F1A16 !important;
}

#modal-workout-exercise-sets input {
  background-color: #FFFFFF !important;
  border-color: #D5CBBF !important;
}

/* ============================================================ */
/* TIME BOXING MODULE & ACTIVITY CARDS (WARM MINIMAL CONTRAST)  */
/* ============================================================ */
#view-timeboxing-app,
#modal-timeboxing-add,
#modal-timeboxing-settings {
  color: #1F1A16;
}

.timebox-entry-card {
  color: #1F1A16 !important;
  background-color: #FFFFFF !important;
}

.timebox-entry-title {
  color: #1F1A16 !important;
  font-weight: 800 !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
}
