/* ClinData Portal — Follow-up (4.18): calendario settimana/mese e pannello di prenotazione. */

.fu-dialog { max-width: 1240px; width: 96vw; }

.fu-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 0.85rem; }
.fu-nav { display: flex; align-items: center; gap: 0.35rem; }
.fu-title { font-size: 1.02rem; margin-left: 0.4rem; white-space: nowrap; }
.fu-views { display: flex; gap: 0.25rem; }
.fu-filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.fu-filters select { width: auto; max-width: 220px; padding: 0.32rem 0.5rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: 0.85rem; background: var(--bg-surface); }
.fu-actions { display: flex; gap: 0.4rem; margin-left: auto; flex-wrap: wrap; }

.fu-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.fu-layout.fu-with-side { grid-template-columns: minmax(0, 1fr) 340px; }
.fu-side:empty { display: none; }
.fu-side { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; background: #f8fafc; position: sticky; top: 0; font-size: 0.88rem; }
.fu-side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.fu-side-head h4 { margin: 0; font-size: 1rem; }
.fu-side .form-group { margin-bottom: 0.6rem; }
.fu-side textarea { width: 100%; }
.fu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.fu-row .form-group:first-child { grid-column: 1 / -1; }
.fu-row .form-group input, .fu-row .form-group select { width: 100%; min-width: 0; }
.fu-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0 0 0.55rem; font-size: 0.82rem; }
.fu-note { background: var(--primary-light); border-radius: var(--radius-sm); padding: 0.4rem 0.55rem; margin: 0 0 0.6rem; font-size: 0.82rem; }
.fu-mail { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.2rem 0 0.7rem; }
.fu-mail input[type=email] { width: 100%; }
.fu-side-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; margin-top: 0.6rem; }
.fu-side-actions .text-danger { margin-right: auto; }
.fu-feed-url { display: flex; gap: 0.4rem; }
.fu-feed-url input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.fu-steps { padding-left: 1.1rem; margin: 0.4rem 0 0.7rem; font-size: 0.83rem; }
.fu-steps li { margin-bottom: 0.3rem; }
.fu-hint { font-size: 0.78rem; margin: 0.45rem 0 0; }

/* Stati degli appuntamenti */
.fu-ev, .fu-chip, .fu-ag-ev { border: 0; cursor: pointer; text-align: left; font: inherit; color: #0c4a6e; background: #e0f2fe; border-left: 3px solid #0284c7; }
.fu-ev-done { background: #dcfce7; color: #14532d; border-left-color: #16a34a; }
.fu-ev-cancelled { background: #f1f5f9; color: #64748b; border-left-color: #94a3b8; text-decoration: line-through; }
.fu-ev:hover, .fu-chip:hover, .fu-ag-ev:hover { filter: brightness(0.96); }
.fu-ev:focus-visible, .fu-chip:focus-visible, .fu-ag-ev:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Settimana (griglia oraria) */
.fu-week { border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; }
.fu-week-head, .fu-week-body { display: grid; grid-template-columns: 48px repeat(7, minmax(0, 1fr)); }
.fu-week-head { background: #f8fafc; border-bottom: 1px solid var(--border-color); }
.fu-day-head { padding: 0.4rem 0.3rem; font-size: 0.8rem; font-weight: 600; text-align: center; border-left: 1px solid var(--border-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fu-day-head.fu-today { color: var(--primary); background: var(--primary-light); }
.fu-week-body { max-height: 62vh; overflow-y: auto; position: relative; }
.fu-axis { position: relative; }
.fu-axis span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 0.7rem; color: var(--text-muted); }
.fu-axis span:first-child { transform: none; }
.fu-day { position: relative; border-left: 1px solid var(--border-color); cursor: copy; }
.fu-day.fu-today { background: #f0f9ff; }
.fu-hline { position: absolute; left: 0; right: 0; border-top: 1px dashed #e2e8f0; pointer-events: none; }
.fu-ev { position: absolute; border-radius: 4px; padding: 1px 4px; font-size: 0.72rem; line-height: 1.25; overflow: hidden; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0 4px; z-index: 1; }
.fu-ev-time { font-weight: 700; }
.fu-ev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.fu-ev-doc { width: 100%; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mese */
.fu-month { border: 1px solid var(--border-color); border-radius: var(--radius-sm); overflow: hidden; }
.fu-month-head, .fu-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.fu-month-head div { padding: 0.35rem; font-size: 0.78rem; font-weight: 600; text-align: center; background: #f8fafc; border-bottom: 1px solid var(--border-color); }
.fu-cell { min-height: 96px; border-left: 1px solid var(--border-color); border-top: 1px solid var(--border-color); padding: 2px 3px 4px; display: flex; flex-direction: column; gap: 2px; cursor: copy; position: relative; min-width: 0; }
.fu-cell:nth-child(7n + 1) { border-left: 0; }
.fu-cell:nth-child(-n + 7) { border-top: 0; }
.fu-out { background: #f8fafc; color: var(--text-muted); }
.fu-cell.fu-today { background: #f0f9ff; }
.fu-cell-num { align-self: flex-start; border: 0; background: none; font: inherit; font-size: 0.78rem; font-weight: 600; padding: 1px 5px; border-radius: 999px; cursor: pointer; color: inherit; }
.fu-today .fu-cell-num { background: var(--primary); color: #fff; }
.fu-chip { border-radius: 3px; padding: 1px 4px; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fu-more { border: 0; background: none; font: inherit; font-size: 0.72rem; color: var(--primary); text-align: left; cursor: pointer; padding: 0 4px; }
.fu-count { display: none; }

/* Settimana su smartphone: elenco per giorno */
.fu-agenda { display: flex; flex-direction: column; gap: 0.5rem; }
.fu-ag-day { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 0.45rem 0.55rem; }
.fu-ag-day.fu-today { border-color: var(--primary); background: #f0f9ff; }
.fu-ag-day header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.fu-ag-ev { display: block; width: 100%; border-radius: 4px; padding: 0.4rem 0.5rem; margin-top: 0.3rem; font-size: 0.88rem; }
.fu-ag-ev small { display: block; opacity: 0.8; }
.fu-ag-empty { margin: 0; font-size: 0.82rem; }

@media (max-width: 1000px) {
  .fu-layout.fu-with-side { grid-template-columns: minmax(0, 1fr); }
  .fu-layout.fu-with-side .fu-side { order: -1; position: static; }
}

@media (max-width: 700px) {
  .fu-dialog { width: 100%; }
  .fu-toolbar { gap: 0.5rem; }
  .fu-nav { width: 100%; }
  .fu-title { margin-left: auto; }
  .fu-views, .fu-filters, .fu-actions { width: 100%; margin-left: 0; }
  .fu-views .btn, .fu-actions .btn { flex: 1; justify-content: center; min-height: 40px; }
  .fu-filters select { flex: 1; min-width: 0; max-width: none; min-height: 40px; }
  .fu-cell { min-height: 54px; padding: 2px; }
  .fu-cell .fu-chip, .fu-cell .fu-more { display: none; }
  .fu-count { display: inline-block; border: 0; cursor: pointer; align-self: center; margin-top: auto; font-size: 0.7rem; font-weight: 700; color: #0c4a6e; background: #e0f2fe; border-radius: 999px; padding: 0 6px; }
  .fu-side-actions .btn { flex: 1; justify-content: center; min-height: 42px; }
}
