/* --- Pulsanti --- */
.f360-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--f360-space-2);
  min-height: var(--f360-touch-target-min);
  padding: var(--f360-space-2) var(--f360-space-4);
  border-radius: var(--f360-radius-md);
  border: 1px solid transparent;
  font-size: var(--f360-font-size-base);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.f360-btn:disabled,
.f360-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

.f360-btn--primary {
  background: var(--f360-color-brand-600);
  color: var(--f360-color-text-inverse);
}
.f360-btn--primary:hover:not(:disabled) {
  background: var(--f360-color-brand-700);
}

.f360-btn--secondary {
  background: var(--f360-color-surface);
  border-color: var(--f360-color-border);
  color: var(--f360-color-text);
}
.f360-btn--secondary:hover:not(:disabled) {
  background: var(--f360-color-surface-alt);
}

.f360-btn--danger {
  background: var(--f360-color-danger);
  color: var(--f360-color-text-inverse);
}

.f360-btn--block {
  width: 100%;
}

/* --- Card --- */
.f360-card {
  background: var(--f360-color-surface);
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-lg);
  box-shadow: var(--f360-shadow-sm);
  padding: var(--f360-space-5);
}

.f360-card__title {
  font-size: var(--f360-font-size-md);
  margin-bottom: var(--f360-space-2);
}

.f360-card__meta {
  color: var(--f360-color-text-muted);
  font-size: var(--f360-font-size-sm);
}

.f360-card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.f360-card--link:hover {
  box-shadow: var(--f360-shadow-md);
}
.f360-card--disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* --- Badge di stato / priorità: sempre testo + colore, mai solo colore --- */
.f360-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--f360-space-1);
  padding: var(--f360-space-1) var(--f360-space-2);
  border-radius: 999px;
  font-size: var(--f360-font-size-sm);
  font-weight: 600;
  white-space: nowrap;
}

.f360-badge--critical { background: var(--f360-color-critical-bg); color: var(--f360-color-critical); }
.f360-badge--high { background: var(--f360-color-high-bg); color: var(--f360-color-high); }
.f360-badge--medium { background: var(--f360-color-medium-bg); color: var(--f360-color-medium); }
.f360-badge--low { background: var(--f360-color-low-bg); color: var(--f360-color-low); }
.f360-badge--info { background: var(--f360-color-info-bg); color: var(--f360-color-info); }
.f360-badge--neutral { background: var(--f360-color-neutral-bg); color: var(--f360-color-neutral); }

/* --- Form --- */
.f360-field {
  margin-bottom: var(--f360-space-4);
}

.f360-field label {
  display: block;
  margin-bottom: var(--f360-space-1);
  font-weight: 600;
}

.f360-field input,
.f360-field select,
.f360-field textarea {
  width: 100%;
  min-height: var(--f360-touch-target-min);
  padding: var(--f360-space-2) var(--f360-space-3);
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-md);
  background: var(--f360-color-surface);
}

.f360-field input:invalid[data-touched="true"] {
  border-color: var(--f360-color-danger);
}

/* Sezioni logiche di un form lungo (es. Nuova segnalazione) */
.f360-form-section {
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-lg);
  padding: var(--f360-space-5);
  margin: 0 0 var(--f360-space-5);
}

.f360-form-section__legend {
  padding: 0 var(--f360-space-2);
  font-weight: 700;
  font-family: var(--f360-font-family-heading);
  color: var(--f360-color-brand-300);
}

.f360-field--checkbox {
  display: flex;
  align-items: center;
  gap: var(--f360-space-2);
}

.f360-field--checkbox input {
  width: auto;
  min-height: auto;
}

.f360-level-selector {
  display: flex;
  gap: var(--f360-space-2);
}

.f360-level-selector label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--f360-touch-target-min);
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-md);
  cursor: pointer;
  font-weight: 600;
}

.f360-level-selector input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.f360-level-selector input:checked + span {
  color: inherit;
}

.f360-level-selector label:has(input:checked) {
  background: var(--f360-color-brand-600);
  border-color: var(--f360-color-brand-600);
  color: var(--f360-color-text-inverse);
}

.f360-level-selector input:focus-visible ~ * {
  outline: 3px solid var(--f360-color-focus-ring);
}

.f360-field__error {
  color: var(--f360-color-danger);
  font-size: var(--f360-font-size-sm);
  margin-top: var(--f360-space-1);
}

.f360-field__hint {
  color: var(--f360-color-text-muted);
  font-size: var(--f360-font-size-sm);
  margin-top: var(--f360-space-1);
}

/* --- Tabella desktop / card mobile --- */
.f360-table {
  width: 100%;
  border-collapse: collapse;
}

.f360-table th,
.f360-table td {
  text-align: left;
  padding: var(--f360-space-3);
  border-bottom: 1px solid var(--f360-color-border);
}

@media (max-width: 768px) {
  .f360-table thead {
    display: none;
  }
  .f360-table, .f360-table tbody, .f360-table tr, .f360-table td {
    display: block;
    width: 100%;
  }
  .f360-table tr {
    border: 1px solid var(--f360-color-border);
    border-radius: var(--f360-radius-md);
    margin-bottom: var(--f360-space-3);
    padding: var(--f360-space-2);
  }
  .f360-table td {
    border-bottom: none;
    padding: var(--f360-space-1) var(--f360-space-2);
  }
  .f360-table td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
  }
}

/* --- Toast --- */
.f360-toast-region {
  position: fixed;
  bottom: var(--f360-space-4);
  right: var(--f360-space-4);
  left: var(--f360-space-4);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--f360-space-2);
  z-index: 1200;
  pointer-events: none;
}

.f360-toast {
  pointer-events: auto;
  max-width: 24rem;
  width: 100%;
  background: var(--f360-color-text);
  color: var(--f360-color-text-inverse);
  padding: var(--f360-space-3) var(--f360-space-4);
  border-radius: var(--f360-radius-md);
  box-shadow: var(--f360-shadow-md);
  font-size: var(--f360-font-size-base);
}

.f360-toast--success { background: var(--f360-color-success); }
.f360-toast--error { background: var(--f360-color-danger); }
.f360-toast--warning { background: var(--f360-color-warning); }

/* --- Modale --- */
.f360-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--f360-space-4);
  z-index: 1300;
}

.f360-modal-backdrop[hidden] {
  display: none;
}

.f360-modal {
  background: var(--f360-color-surface);
  border-radius: var(--f360-radius-lg);
  box-shadow: var(--f360-shadow-md);
  max-width: 32rem;
  width: 100%;
  padding: var(--f360-space-5);
}

.f360-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--f360-space-2);
  margin-top: var(--f360-space-5);
}

/* --- Stato vuoto / dato non disponibile --- */
.f360-empty {
  color: var(--f360-color-text-muted);
  font-style: italic;
}

/* --- Tab di vista (tabellare/kanban/calendario), Area Gestore --- */
.f360-view-tabs {
  display: flex;
  gap: var(--f360-space-2);
  margin-bottom: var(--f360-space-4);
}

.f360-view-tabs button[aria-pressed="true"] {
  background: var(--f360-color-brand-600);
  border-color: var(--f360-color-brand-600);
  color: var(--f360-color-text-inverse);
}

/* --- Filtri salvati --- */
.f360-saved-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--f360-space-2);
}

.f360-saved-filters select {
  min-width: 12rem;
  padding: var(--f360-space-2) var(--f360-space-3);
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-md);
  background: var(--f360-color-surface);
}

/* --- Kanban (Area Gestore, vertical slice 4) --- */
.f360-kanban {
  display: flex;
  gap: var(--f360-space-4);
  overflow-x: auto;
  padding-bottom: var(--f360-space-3);
}

.f360-kanban__column {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: var(--f360-space-2);
  background: var(--f360-color-surface-alt);
  border-radius: var(--f360-radius-lg);
  padding: var(--f360-space-3);
}

.f360-kanban__column-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--f360-space-1);
  font-family: var(--f360-font-family-heading);
  font-weight: 700;
  font-size: var(--f360-font-size-sm);
}

.f360-kanban__count {
  background: var(--f360-color-surface);
  border-radius: 999px;
  padding: 0 var(--f360-space-2);
  font-size: var(--f360-font-size-sm);
  font-weight: 600;
}

.f360-kanban__card {
  display: block;
  background: var(--f360-color-surface);
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-md);
  padding: var(--f360-space-3);
  color: inherit;
  text-decoration: none;
}

.f360-kanban__card:hover {
  box-shadow: var(--f360-shadow-sm);
}

.f360-kanban__card strong {
  display: block;
  margin-bottom: var(--f360-space-1);
}

.f360-kanban__card p {
  margin: var(--f360-space-1) 0 0;
  color: var(--f360-color-text-muted);
  font-size: var(--f360-font-size-sm);
}

/* --- Calendario (Area Gestore, vertical slice 4) --- */
.f360-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--f360-space-3);
  font-family: var(--f360-font-family-heading);
}

.f360-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--f360-space-2);
}

.f360-calendar-grid__weekday {
  text-align: center;
  color: var(--f360-color-text-muted);
  font-weight: 700;
  font-size: var(--f360-font-size-sm);
}

.f360-calendar-day {
  min-height: 6rem;
  border: 1px solid var(--f360-color-border);
  border-radius: var(--f360-radius-md);
  padding: var(--f360-space-2);
  background: var(--f360-color-surface);
}

.f360-calendar-day--outside {
  background: var(--f360-color-surface-alt);
  color: var(--f360-color-text-muted);
}

.f360-calendar-day__date {
  font-weight: 700;
  font-size: var(--f360-font-size-sm);
}

.f360-calendar-day__link {
  display: block;
  margin-top: var(--f360-space-1);
  color: var(--f360-color-brand-600);
  font-size: var(--f360-font-size-sm);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .f360-calendar-grid {
    grid-template-columns: repeat(7, minmax(2.25rem, 1fr));
    gap: var(--f360-space-1);
  }
  .f360-calendar-day {
    min-height: 3.5rem;
    padding: var(--f360-space-1);
    font-size: 0.75rem;
  }
  .f360-calendar-day__link {
    display: none;
  }
}

/* --- Card modulo home (adattate da HR360/UGI360 shared/ugi360.css:
   griglia di card scure con accento colore per modulo) --- */
.f360-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--f360-space-5);
}

.f360-hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--f360-space-2);
  min-height: 190px;
  padding: var(--f360-space-5) var(--f360-space-4) var(--f360-space-4);
  border-radius: var(--f360-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(150deg, #1a2422 0%, #131b19 60%, #0d1211 100%);
  box-shadow: var(--f360-shadow-sm);
  color: var(--f360-color-text-inverse);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.f360-hero-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: var(--f360-radius-lg) var(--f360-radius-lg) 0 0;
  background: var(--accento, var(--f360-color-brand-600));
}

.f360-hero-card:hover,
.f360-hero-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--f360-shadow-md);
  outline: none;
}

.f360-hero-card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--f360-radius-md);
  background: color-mix(in srgb, var(--accento, var(--f360-color-brand-600)), transparent 25%);
}

.f360-hero-card__icon svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.f360-hero-card h3 {
  margin: var(--f360-space-1) 0 0;
  font-size: var(--f360-font-size-md);
}

.f360-hero-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: var(--f360-font-size-sm);
  line-height: 1.5;
}

.f360-hero-card__cta,
.f360-hero-card__badge {
  margin-top: auto;
  padding-top: var(--f360-space-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.f360-hero-card__cta {
  color: #fff;
}

.f360-hero-card__badge {
  color: rgba(255, 255, 255, 0.6);
}

.f360-hero-card--disabled {
  cursor: default;
  filter: grayscale(0.3);
}

.f360-hero-card--disabled:hover {
  transform: none;
  box-shadow: var(--f360-shadow-sm);
}

@media (max-width: 980px) {
  .f360-hero-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 620px) {
  .f360-hero-grid {
    grid-template-columns: 1fr;
  }
}
