/* ============================================
   PLANNER.CSS
   ============================================ */

.planner-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: calc(100vh - 60px);
}

.planner-stop__badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.45rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
}

.planner-stop__badge--accessible {
  background: #e7f7ed;
  color: #137333;
  border: 1px solid #b7e4c7;
}

/* ============================================
   TIMELINE (sinistra)
   ============================================ */

.planner-timeline {
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.planner-timeline__header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f9fa;
}

.planner-timeline__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: #1a1a2e;
}

.planner-timeline__actions {
  display: flex;
  gap: 0.5rem;
}

.planner-timeline__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Day accordion */
.planner-day {
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.planner-day__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: white;
  cursor: pointer;
  transition: background 0.2s;
}

.planner-day__header:hover {
  background: #f8f9fa;
}

.planner-day__title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1a1a2e;
}

.planner-day__date {
  font-size: 0.8rem;
  color: #888;
}

.planner-day__toggle {
  font-size: 0.8rem;
  color: #888;
  transition: transform 0.2s;
}

.planner-day.is-open .planner-day__toggle {
  transform: rotate(180deg);
}

.planner-day__body {
  padding: 0.5rem;
  display: none;
  background: #f8f9fa;
}

.planner-day.is-open .planner-day__body {
  display: block;
}

/* Stops */
.planner-stops {
  list-style: none;
  min-height: 40px;
}

.planner-stop {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s;
}

.planner-stop:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.planner-stop__info {
  flex: 1;
  min-width: 0;
}

.planner-stop__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.planner-stop__heading,
.stop-item__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.planner-stop__meta {
  font-size: 0.75rem;
  color: #888;
}

.planner-stop__actions {
  display: flex;
  gap: 0.25rem;
}

.planner-stop__btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.planner-stop__btn:hover {
  color: #e53e3e;
}

.planner-add-stop {
  width: 100%;
  padding: 0.6rem;
  background: transparent;
  border: 1px dashed #cbd5e0;
  border-radius: 8px;
  color: #888;
  font-size: 0.825rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.25rem;
}

.planner-add-stop:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================
   DETAIL (destra)
   ============================================ */

.planner-detail {
  overflow-y: auto;
  background: white;
}

.planner-detail__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #aaa;
  text-align: center;
  padding: 3rem;
}

.planner-detail__placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.planner-detail__content {
  padding: 2rem;
}

.itinerary-guide {
  position: sticky;
  top: 1rem;
  align-self: start;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fbfcfd;
  color: #1a1a2e;
  padding: 1.1rem;
}

.itinerary-side-panel {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
  align-self: start;
}

.itinerary-side-panel .itinerary-guide {
  position: static;
}

.itinerary-map {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fbfcfd;
  color: #1a1a2e;
  padding: 1rem;
}

.itinerary-map--detail {
  margin-bottom: 1.25rem;
}

.itinerary-map__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.itinerary-map__title {
  margin: 0;
  color: #1a1a2e;
  font-family: var(--font-heading);
  font-size: 1rem;
  line-height: 1.25;
}

.itinerary-map__link {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.42rem 0.55rem;
  text-decoration: none;
  white-space: nowrap;
}

.itinerary-map__link:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  text-decoration: none;
}

.itinerary-map__link.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.itinerary-map__canvas {
  display: grid;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #eef2f7;
}

.itinerary-map__canvas iframe {
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: 0;
}

.itinerary-map__empty {
  display: grid;
  gap: 0.35rem;
  place-content: center;
  min-height: 220px;
  padding: 1rem;
  text-align: center;
}

.itinerary-map__empty strong {
  color: #1a1a2e;
  font-size: 0.86rem;
}

.itinerary-map__empty span {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.itinerary-map__stops {
  display: grid;
  gap: 0.55rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.itinerary-map__stops li {
  display: grid;
  grid-template-columns: 1.45rem 1fr;
  gap: 0.55rem;
  align-items: start;
  color: #334155;
  font-size: 0.8rem;
  line-height: 1.35;
}

.itinerary-map__stops li.is-muted {
  color: #7c8a9f;
}

.itinerary-map__pin {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fbfcfd;
  font-size: 0.68rem;
  font-weight: 800;
}

.itinerary-map__stop-text {
  min-width: 0;
}

.itinerary-map__stop-text strong,
.itinerary-map__stop-text small {
  display: block;
}

.itinerary-map__stop-text strong {
  overflow-wrap: anywhere;
}

.itinerary-map__stop-text small {
  margin-top: 0.12rem;
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
}

.itinerary-guide--embedded {
  position: static;
  border: none;
  background: transparent;
  padding: 0;
}

.itinerary-guide__section + .itinerary-guide__section {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid #e2e8f0;
}

.itinerary-guide__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--color-primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.itinerary-guide__title {
  margin: 0 0 0.55rem;
  color: #1a1a2e;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  line-height: 1.25;
}

.itinerary-guide__text {
  margin: 0;
  color: #475569;
  font-size: 0.86rem;
  line-height: 1.6;
}

.itinerary-guide__text--spaced {
  margin-top: 0.6rem;
}

.itinerary-guide__list {
  margin: 0;
  padding-left: 1.05rem;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.55;
}

.itinerary-guide__list li + li {
  margin-top: 0.45rem;
}

.itinerary-day-advice-btn,
.stop-flash-btn {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.42rem 0.55rem;
  white-space: nowrap;
}

.itinerary-day-advice-btn:hover,
.stop-flash-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.planner-day__header .itinerary-day-advice-btn {
  margin-left: auto;
}

.stop-flash-btn {
  padding: 0.36rem 0.48rem;
}

.itinerary-guide__day,
.itinerary-guide__tip {
  padding: 0.75rem 0;
}

.itinerary-guide__day + .itinerary-guide__day,
.itinerary-guide__tip + .itinerary-guide__tip {
  border-top: 1px solid #eef2f7;
}

.itinerary-guide__day h3 {
  margin: 0 0 0.25rem;
  color: #1a1a2e;
  font-size: 0.88rem;
  line-height: 1.35;
}

.itinerary-guide__day p {
  margin: 0;
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.55;
}

.itinerary-guide__tip strong {
  display: block;
  color: #1a1a2e;
  font-size: 0.83rem;
  line-height: 1.35;
  margin-bottom: 0.2rem;
}

.itinerary-guide__tip span {
  display: block;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.5;
}

.itinerary-guide__micro {
  display: block;
  margin-top: 0.35rem;
  color: #334155;
  font-size: 0.72rem;
  line-height: 1.45;
}

.itinerary-guide__micro--muted {
  color: #7c8a9f;
}

.itinerary-advice__loading {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.85rem;
  align-items: start;
}

.itinerary-advice__spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid #dbe3ef;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: itinerary-advice-spin 0.85s linear infinite;
}

.itinerary-advice__error {
  border: 1px solid #f1c7c7;
  border-radius: 10px;
  background: #fff8f8;
  padding: 1rem;
}

.itinerary-advice__retry {
  margin-top: 0.85rem;
  border: 1px solid #d2dae8;
  border-radius: 8px;
  background: #ffffff;
  color: #1a1a2e;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

.itinerary-advice__retry:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

@keyframes itinerary-advice-spin {
  to {
    transform: rotate(360deg);
  }
}

.advice-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
}

.advice-modal.is-open {
  display: block;
}

.advice-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.advice-modal__dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 2rem));
  max-height: min(720px, calc(100vh - 2rem));
  overflow-y: auto;
  transform: translate(-50%, -50%);
  border-radius: 12px;
  background: #fbfcfd;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 1.35rem;
}

.advice-modal__close {
  float: right;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.6rem;
}

.advice-modal__title {
  margin: 0 0 0.65rem;
  color: #1a1a2e;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.25;
  padding-right: 4.5rem;
}

.advice-modal__text {
  margin: 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.65;
}

.advice-modal__stack {
  margin-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.advice-modal__item {
  padding: 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.advice-modal__item strong,
.advice-modal__callout strong {
  display: block;
  color: #1a1a2e;
  font-size: 0.84rem;
  margin-bottom: 0.25rem;
}

.advice-modal__item span,
.advice-modal__callout span {
  display: block;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.55;
}

.advice-modal__callout {
  margin-top: 1rem;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f6faff;
  padding: 0.85rem;
}

.advice-modal__callout--quiet {
  border-color: #e2e8f0;
  background: #f8fafc;
}

/* ============================================
   PLANNER ACTIONS
   ============================================ */

.planner-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8f9fa;
  flex-wrap: wrap;
}

/* ============================================
   TRIP LIST — "I miei Viaggi" (restyle Figma)
   ============================================ */

.trip-list {
  --trip-accent: #E5326E;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.trip-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.trip-list__title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  color: #1a2336;
}

.trip-list__subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  color: #6b7689;
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.trip-card {
  position: relative;
  background: #fff;
  border: 1px solid #e7ebf2;
  border-radius: 18px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.trip-card:hover {
  box-shadow: 0 16px 38px rgba(20,30,60,0.1);
  transform: translateY(-2px);
  text-decoration: none;
}

.trip-card__banner {
  position: relative;
  height: 170px;
  overflow: hidden;
  background: linear-gradient(115deg, #16223f 0%, #2f63d8 130%);
  display: flex;
  align-items: flex-end;
  padding: 0.85rem 1.35rem;
}

/* Foto riempie il banner (crop centrato), sotto badge e velo. */
.trip-card__banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
}

/* Velo scuro in basso per tenere leggibile la pill data sulla foto. */
.trip-card__banner--photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(10,15,30,0) 45%, rgba(10,15,30,0.55) 100%);
}

.trip-card__day-badge {
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,0.92);
  color: #20304f;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trip-card__body {
  padding: 1.25rem 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.trip-card__title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.55rem;
  color: #1a2336;
  line-height: 1.3;
}

.trip-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #6b7689;
}

.trip-card__meta-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.trip-card__meta-row svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--trip-accent);
}

.trip-card__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.trip-card__open {
  flex: 1;
  text-align: center;
  background: #1b2540;
  color: #fff;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}

.trip-card__open:hover { background: #0f1830; color: #fff; text-decoration: none; }

.trip-card__delete {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #e7ebf2;
  background: #fff;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
}

.trip-card__delete:hover { border-color: #e53e3e; color: #e53e3e; background: #fff5f5; }
.trip-card__delete svg { width: 17px; height: 17px; }

.trip-list .empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  border: 1.5px dashed #d7deea;
  border-radius: 20px;
  color: #6b7689;
  background: linear-gradient(120deg, #f8fafc, #eef1f8);
}

.trip-list .pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
}

.trip-list .pagination__info { font-size: 0.85rem; color: #6b7689; }

/* Trip new form */
.trip-new {
  max-width: 700px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.trip-new__title {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 2rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Sotto 920px le due colonne diventano troppo strette: colonna singola */
@media (max-width: 920px) {
  .planner-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .planner-detail {
    display: block;
    order: -1;
    border-bottom: 1px solid #e2e8f0;
  }

  .planner-detail.is-visible {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
  }

  .itinerary-guide {
    position: static;
  }

  .itinerary-side-panel {
    position: static;
  }
}
