/* ------------------------------------------------------------------
 * Banner notifiche (gestite da Laravel) — Gruppo Cedir
 * Animazione: cerchio -> pillola -> cerchio.
 * ------------------------------------------------------------------ */

.newsbar {
  /* Palette allineata ai colori usati sul sito (non quelli dell'area
     prenota/percorso guidato):
     - blu "Prenota" della home  -> #0058b5
     - rosa/viola senologia      -> #9f4468
     - arancione cardio TC       -> #c85f16
     - verde bassa dose ConeBeam -> #28a745 */
  --cedir-blue: #0058b5;
  --cedir-blue-dark: #004a99;
  --cedir-panel-blue: #385b7f;
  --cedir-magenta: #9f4468;
  --cedir-orange: #c85f16;
  --cedir-green: #28a745;
  --cedir-green-dark: #218838;

  --toast-accent: var(--cedir-blue);
  --toast-accent-dark: var(--cedir-blue-dark);
  --circle-size: 64px;

  /* L'header del sito e' position:fixed (z-index 130): la notifica deve
     stare sopra di esso e non essere coperta. La posizioniamo fissa in
     alto, centrata orizzontalmente, sotto l'altezza dell'header. */
  position: fixed;
  top: 96px;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.newsbar[hidden] {
  display: none;
}

/* Su mobile la notifica non viene mostrata: occuperebbe troppo spazio. */
@media (max-width: 640px) {
  .newsbar {
    display: none !important;
  }
}

.newsbar__inner {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--toast-accent), var(--toast-accent-dark));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);

  /* Stato iniziale: cerchio piccolo, invisibile */
  width: var(--circle-size);
  height: var(--circle-size);
  padding: 0;
  transform: scale(0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    padding 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Fase 1: appare come cerchio */
.newsbar.is-circle .newsbar__inner {
  transform: scale(1);
  opacity: 1;
}

/* Fase 2: si allarga in pillola con la notizia.
   La larghezza si adatta al contenuto (fino a un massimo) così il testo
   si vede per intero, senza puntini di troncamento. */
.newsbar.is-pill .newsbar__inner {
  width: auto;
  max-width: min(680px, 100%);
  padding: 0 22px 0 0;
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Senza tasto azione la pillola resta aderente al testo: niente spazio vuoto a destra. */
.newsbar.is-pill.newsbar--no-action .newsbar__inner {
  width: auto;
  max-width: min(680px, 100%);
  padding: 0 22px 0 0;
}

/* Fase 3: si richiude in cerchio e svanisce */
.newsbar.is-closing .newsbar__inner {
  width: var(--circle-size);
  padding: 0;
  transform: scale(0.4);
  opacity: 0;
  pointer-events: none;
  transition:
    width 0.45s cubic-bezier(0.55, 0, 0.68, 0.19),
    transform 0.45s cubic-bezier(0.55, 0, 0.68, 0.19),
    opacity 0.4s ease 0.12s,
    padding 0.45s ease;
}

/* Icona inline: cerchio compatto a sinistra, icona bianca centrata. */
.newsbar__icon {
  flex: 0 0 auto;
  width: var(--circle-size);
  height: var(--circle-size);
  display: grid;
  place-items: center;
  color: #fff;
}

.newsbar__icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.newsbar__content {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  padding-left: 12px;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

.newsbar.is-pill .newsbar__content {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease 0.2s;
}

.newsbar__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;

  /* La frase resta su una sola riga e si vede per intero: niente troncamento. */
  white-space: nowrap;
}

/* Piccolo tasto azione trasparente */
.newsbar__action {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 24px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  cursor: pointer;
  white-space: nowrap;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, background 0.15s ease;
}

.newsbar.is-pill .newsbar__action {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease 0.2s, background 0.15s ease;
}

.newsbar__action:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ---------- Varianti colore (palette Gruppo Cedir) ---------- */
.newsbar--blue {
  --toast-accent: var(--cedir-blue);
  --toast-accent-dark: var(--cedir-blue-dark);
}

.newsbar--panel {
  --toast-accent: var(--cedir-panel-blue);
  --toast-accent-dark: #2b4763;
}

.newsbar--magenta {
  --toast-accent: var(--cedir-magenta);
  --toast-accent-dark: #7d3452;
}

.newsbar--orange {
  --toast-accent: var(--cedir-orange);
  --toast-accent-dark: #9c4a11;
}

.newsbar--green {
  --toast-accent: var(--cedir-green);
  --toast-accent-dark: var(--cedir-green-dark);
}

@media (prefers-reduced-motion: reduce) {
  .newsbar__inner {
    transition-duration: 0.01ms;
  }
}
