/* Calendario demo n8n: CSS propio (no depender de Tailwind en JS). */
.n8n-demo-calendar-root {
  width: 100%;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.n8n-demo-cal-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 1.25rem 1.75rem;
  width: 100%;
}

.n8n-demo-cal-month {
  width: 300px;
  min-width: 260px;
  max-width: 100%;
  flex: 0 0 auto;
  border: 1px solid rgb(226 232 240);
  border-radius: 0.625rem;
  background: #fff;
  padding: 0.65rem 0.65rem 0.55rem;
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.06);
}

.n8n-demo-cal-month-title {
  margin: 0 0 0.45rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  color: #1e293b;
  text-transform: capitalize;
}

.n8n-demo-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.n8n-demo-cal-wd {
  margin: 0;
  padding: 0.2rem 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
  color: #94a3b8;
}

.n8n-demo-cal-cell {
  margin: 0;
  aspect-ratio: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.35rem;
  border: 1px solid rgb(241 245 249);
  background: rgb(248 250 252);
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #1e293b;
}

.n8n-demo-cal-cell--empty {
  border-color: transparent;
  background: transparent;
  pointer-events: none;
}

/* Días con cita: color fuerte + clickable */
button.n8n-demo-cal-cell {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  cursor: pointer;
  width: 100%;
  padding: 0;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

button.n8n-demo-cal-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgb(13 148 136 / 0.25);
}

button.n8n-demo-cal-cell:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

.n8n-demo-cal-cell--event {
  border-color: #0f766e;
  background: linear-gradient(145deg, rgba(13, 148, 136, 0.22) 0%, rgba(20, 184, 166, 0.18) 100%);
  color: #0f172a;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.35);
}

/* Solo citas persistidas en BD (GET) */
.n8n-demo-cal-cell--event.n8n-demo-cal-cell--event-db {
  border-style: dashed;
  border-width: 2px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.16) 0%, rgba(13, 148, 136, 0.14) 100%);
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.n8n-demo-cal-cell--selected.n8n-demo-cal-cell--event {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #0d9488,
    inset 0 0 0 1px rgba(13, 148, 136, 0.45);
  transform: scale(1.02);
}

.n8n-demo-cal-cell--selected.n8n-demo-cal-cell--event-db {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #2563eb,
    inset 0 0 0 1px rgba(37, 99, 235, 0.35);
}

/* Panel detalle bajo el calendario */
.n8n-calendar-detail {
  margin-top: 1.25rem;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1.1rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(203 213 225);
  background: #fff;
  box-shadow: 0 4px 14px rgb(15 23 42 / 0.07);
}

.n8n-calendar-detail[hidden] {
  display: none !important;
}

.n8n-calendar-detail__kicker {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: none;
  color: #64748b;
}

.n8n-calendar-detail__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.n8n-calendar-detail__list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  list-style: disc;
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.5;
}

.n8n-calendar-detail__list li {
  margin-bottom: 0.45rem;
}

.n8n-calendar-detail__list .n8n-cal-src {
  display: block;
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.n8n-calendar-detail__event .n8n-cal-src {
  margin-top: 0.35rem;
}

.n8n-calendar-detail__placeholder {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.45;
}

.n8n-calendar-detail__placeholder[hidden] {
  display: none;
}

.n8n-calendar-detail__note {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid rgb(241 245 249);
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* Pestañas Chat / Calendario (cabecera demo) */
.n8n-demo-tab {
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
}
.n8n-demo-tab:hover:not(:disabled) {
  color: #0f766e;
  background: rgba(255, 255, 255, 0.6);
}
.n8n-demo-tab--active {
  color: #0f766e !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.12);
}
.n8n-demo-tab:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* Chat demo + calendario: misma altura de interacción; scroll interno (no depende de Tailwind JIT). */
#n8n-chat-screen.n8n-demo-chat-panel,
#n8n-demo-calendar-stage {
  display: flex;
  flex-direction: column;
  height: min(78vh, 48rem);
  max-height: min(78vh, 48rem);
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

#n8n-demo-calendar-scroll {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#n8n-messages-container {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Aviso de cita guardada (respuesta JSON save_appointment) */
.n8n-msg-appointment {
  max-width: min(100%, 28rem);
  border-radius: 0.75rem;
  border: 1px solid rgb(234 179 8 / 0.55);
  background: linear-gradient(to bottom right, rgb(254 252 232), rgb(255 251 235));
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: rgb(69 26 3);
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.08);
}
.n8n-msg-appointment__title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0.06em;
  color: rgb(146 64 14);
}
.n8n-msg-appointment__line {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: rgb(120 53 15);
}
.n8n-msg-appointment__meta {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  color: rgb(87 83 78);
}
.n8n-msg-appointment__desc {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  color: rgb(68 64 60);
}
.n8n-msg-appointment__foot {
  margin: 0;
  font-size: 0.75rem;
  color: rgb(120 113 108);
  border-top: 1px solid rgb(254 240 138 / 0.6);
  padding-top: 0.5rem;
}

/* Fecha recién registrada en esta sesión (solo memoria JS; se pierde al recargar la página) */
.n8n-demo-cal-cell--session-highlight {
  outline: 3px solid #dc2626 !important;
  outline-offset: 2px;
  position: relative;
  z-index: 2;
}
button.n8n-demo-cal-cell--session-highlight:focus-visible {
  outline: 3px solid #dc2626 !important;
  outline-offset: 2px;
}

.n8n-msg-appointment__cal-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: #0d9488;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.n8n-msg-appointment__cal-link:hover {
  color: #0f766e;
}
.n8n-msg-appointment__cal-link:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
  border-radius: 2px;
}
.n8n-msg-appointment__cal-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Burbujas de chat: texto largo o sin espacios no desborda */
.n8n-msg-user,
.n8n-msg-bot {
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* Solo "Asistente" y nombre de sector en blanco */
#n8n-demo-assistant-bar .n8n-demo-assistant-text {
  color: #ffffff;
}

/* Pestañas en la barra oscura del chat (junto al asistente) */
.n8n-demo-tabs--on-dark .n8n-demo-tab {
  color: #ffffff;
}
.n8n-demo-tabs--on-dark .n8n-demo-tab:hover:not(:disabled) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}
.n8n-demo-tabs--on-dark .n8n-demo-tab--active {
  color: #0f766e !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.2);
}
.n8n-demo-tabs--on-dark .n8n-demo-tab:disabled {
  color: rgba(255, 255, 255, 0.55);
}

.n8n-calendar-detail__event {
  margin-bottom: 0.65rem;
}

.n8n-calendar-detail__summary {
  font-weight: 600;
  color: #1e293b;
}

.n8n-calendar-detail__extra {
  margin: 0.4rem 0 0;
  padding: 0.45rem 0.55rem;
  border-radius: 0.4rem;
  background: rgb(248 250 252);
  border: 1px solid rgb(226 232 240);
}

.n8n-calendar-detail__extra-kicker {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.n8n-calendar-detail__extra-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #334155;
  white-space: pre-wrap;
}

.n8n-calendar-detail__note-asterisk {
  flex-shrink: 0;
  font-weight: 700;
  color: #94a3b8;
  line-height: 1.4;
}

.n8n-calendar-detail__note-text {
  flex: 1;
  min-width: 0;
}
