/* ==========================================================================
   TRACCIATO STUDIO OS - COMPONENTI DELL'INTERFACCIA
   Craftsmanship Svizzero: Profondità, Gerarchia e Pulsanti Curati
   ========================================================================== */

/* --- PULSANTI DI SISTEMA (REFINED BUTTONS) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

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

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Pulsante Secondario / Neutro da Ufficio */
.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-medium);
  color: var(--text-secondary);
  box-shadow: var(--shadow-subtle);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Pulsante Pausa Attività (Curato, non grezzo) */
.btn-pause {
  background: var(--btn-pause-bg);
  border: 1px solid var(--btn-pause-border);
  color: var(--btn-pause-text);
  padding: 0.45rem 0.8rem;
  font-size: var(--text-xs);
  font-weight: 600;
}

.btn-pause:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

/* Pulsante Completa Attività (Solido, elegante, spiccato) */
.btn-complete {
  background: var(--btn-complete-bg);
  border: 1px solid var(--btn-complete-border);
  color: var(--btn-complete-text);
  padding: 0.45rem 0.85rem;
  font-size: var(--text-xs);
  font-weight: 600;
}

.btn-complete:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 16px var(--emerald-glow);
}

/* Pulsante "+ Aggiungi attività per oggi" (Tratteggiato raffinato con micro-hover) */
.btn-add-task {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-body);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.btn-add-task:hover {
  background: rgba(59, 130, 246, 0.04);
  border-color: var(--blue);
  color: var(--text-primary);
  border-style: solid;
}

.btn-add-task .icon-box {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-add-task:hover .icon-box {
  background: var(--blue);
  border-color: var(--blue);
  color: #FFFFFF;
}

/* Pulsante Avvio Rapido Riga Compito */
.btn-start-task {
  padding: 0.35rem 0.65rem;
  font-size: var(--text-xs);
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}

.btn-start-task:hover {
  background: var(--blue-subtle);
  border-color: var(--blue-border);
  color: var(--blue);
}

/* --- BANNER ATTIVITÀ IN CORSO (PRECISION ALIGNMENT & THEME COMPATIBLE) --- */
.active-task-banner {
  background: var(--active-banner-bg);
  border: 1px solid var(--active-banner-border);
  border-left: 3px solid var(--emerald);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card), var(--shadow-active);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
}

.active-task-banner::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 160px;
  height: 100%;
  background: var(--active-banner-glow);
  pointer-events: none;
}

/* Colonna Sinistra: Informazioni Attività */
.active-task-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.active-task-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emerald);
}

.status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.active-task-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.active-task-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--text-xs);
  color: var(--text-body);
}

.active-task-meta span.commessa-code {
  font-family: var(--font-mono);
  color: var(--active-code-text);
  background: var(--active-code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* Colonna Centro: Display Timer Monospazio */
.active-task-timer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  background: var(--active-timer-bg);
  border: 1px solid var(--active-timer-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
}

.active-task-timer .timer-digits {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--active-timer-digits);
  line-height: 1;
}

.active-task-timer .timer-label {
  font-size: 0.65rem;
  color: var(--active-timer-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

/* Colonna Destra: Gruppo Pulsanti Azione */
.active-task-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- CARD STRUTTURALI (ELEVATION & DEPTH) --- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* --- RIGHE COMPITI (CHECKLIST DELLA GIORNATA) --- */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.task-item:hover {
  background: var(--surface-3);
  border-color: var(--border-medium);
}

.task-item.is-active-row {
  border-left: 2px solid var(--emerald);
  background: rgba(16, 185, 129, 0.04);
}

.task-item-left {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
}

/* Casella di Spunta Minimale Personalizzata */
.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-fast);
}

.custom-checkbox:hover {
  border-color: var(--blue);
}

.custom-checkbox.checked {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #022C22;
}

.task-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.task-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.35;
}

.task-item:hover .task-title {
  color: var(--text-primary);
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Badge Semantici di Categoria e Urgenza */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-amber {
  background: var(--amber-subtle);
  border: 1px solid var(--amber-border);
  color: #FBBF24;
}

.badge-rose {
  background: var(--rose-subtle);
  border: 1px solid var(--rose-border);
  color: #F87171;
}

.badge-neutral {
  background: var(--badge-neutral-bg);
  border: 1px solid var(--badge-neutral-border);
  color: var(--badge-neutral-text);
}

.badge-blue {
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  color: #60A5FA;
}

/* Badge Orari / Eventi Agenda */
.time-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-subtle);
  border: 1px solid var(--blue-border);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
}

/* Barra di avanzamento ore odierne */
.progress-container {
  margin: 0.75rem 0 1rem 0;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--emerald));
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* Pulsante Accordion Mostra Altre Attività in Coda */
.btn-expand-tasks {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  margin-top: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-expand-tasks:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-color: var(--border-medium);
}

/* Adattamento Responsive Mobile */
@media (max-width: 860px) {
  .active-task-banner {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  .active-task-timer {
    align-items: flex-start;
  }
  .active-task-actions {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   REGOLE ESPLICITE TEMA CHIARO (MASSIMA LEGGIBILITÀ BANNER & CONTENITORI)
   ========================================================================== */
[data-theme="light"] .active-task-banner {
  background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 100%) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  border-left: 3px solid #10B981 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .active-task-banner::before {
  background: radial-gradient(circle at 100% 50%, rgba(16, 185, 129, 0.12), transparent 70%) !important;
}

[data-theme="light"] .active-task-timer {
  background: #FFFFFF !important;
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.10) !important;
}

[data-theme="light"] .active-task-timer .timer-digits {
  color: #065F46 !important;
}

[data-theme="light"] .active-task-timer .timer-label {
  color: #059669 !important;
}

[data-theme="light"] .active-task-meta span.commessa-code {
  background: #E2E8F0 !important;
  color: #1E293B !important;
  border-color: #CBD5E1 !important;
}

[data-theme="light"] .btn-pause {
  background: #FEF3C7 !important;
  border: 1px solid #F59E0B !important;
  color: #92400E !important;
}

[data-theme="light"] .btn-complete {
  background: #10B981 !important;
  border: 1px solid #059669 !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25) !important;
}


