/*
  Roberta Booking — widget styles.
  Palette: --senape #DCA134, --salvia #7A8B7B, --sabbia #EADBC8, --caffe #4A3B32, --crema #FAF6F0
*/

.rb-widget {
  --rb-senape: #DCA134;
  --rb-senape-dark: #C28A22;
  --rb-salvia: #7A8B7B;
  --rb-salvia-light: #DCE2DD;
  --rb-sabbia: #EADBC8;
  --rb-sabbia-light: #F7EFE6;
  --rb-caffe: #4A3B32;
  --rb-crema: #FAF6F0;
  --rb-radius: 14px;

  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--rb-caffe);
}

/* ---------- progress ---------- */
.rb-progress {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 13px;
}
.rb-progress-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--rb-radius);
  background: var(--rb-sabbia-light);
  color: rgba(74, 59, 50, 0.55);
  font-weight: 500;
  transition: all 0.2s;
}
.rb-progress-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(74, 59, 50, 0.1);
  font-weight: 700;
  font-size: 12px;
}
.rb-progress-step.is-active {
  background: var(--rb-sabbia);
  color: var(--rb-caffe);
}
.rb-progress-step.is-active span {
  background: var(--rb-senape);
  color: var(--rb-caffe);
}
.rb-progress-step.is-done {
  color: var(--rb-salvia);
}
.rb-progress-step.is-done span {
  background: var(--rb-salvia);
  color: white;
}

/* ---------- calendar header ---------- */
.rb-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.rb-cal-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  text-transform: capitalize;
}
.rb-cal-nav {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--rb-sabbia);
  background: white;
  color: var(--rb-caffe);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.rb-cal-nav:hover:not(:disabled) {
  background: var(--rb-senape);
  border-color: var(--rb-senape);
}
.rb-cal-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- weekdays ---------- */
.rb-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: rgba(74, 59, 50, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- grid ---------- */
.rb-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.rb-cal-day {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--rb-caffe);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.rb-cal-day--empty {
  visibility: hidden;
  cursor: default;
}
.rb-cal-day--available {
  background: var(--rb-salvia-light);
  color: var(--rb-caffe);
}
.rb-cal-day--available:hover {
  background: var(--rb-salvia);
  color: white;
  transform: translateY(-1px);
}
.rb-cal-day--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}
.rb-cal-day--today {
  border-color: var(--rb-senape);
  font-weight: 700;
}
.rb-cal-day__dot {
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rb-senape);
}

.rb-loading {
  text-align: center;
  margin-top: 16px;
  color: rgba(74, 59, 50, 0.6);
  font-size: 14px;
}
.rb-legend {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: rgba(74, 59, 50, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.rb-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rb-senape);
  display: inline-block;
}

/* ---------- back button ---------- */
.rb-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  margin-bottom: 16px;
  background: transparent;
  border: none;
  color: var(--rb-salvia);
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}
.rb-back:hover {
  background: var(--rb-sabbia-light);
  color: var(--rb-caffe);
}

.rb-step-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

/* ---------- time slots ---------- */
.rb-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}
.rb-slot {
  padding: 14px 8px;
  background: white;
  border: 1.5px solid var(--rb-sabbia);
  border-radius: var(--rb-radius);
  color: var(--rb-caffe);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  font-size: 15px;
}
.rb-slot:hover {
  border-color: var(--rb-senape);
  background: var(--rb-senape);
  color: var(--rb-caffe);
  transform: translateY(-1px);
}

/* ---------- summary box (form step) ---------- */
.rb-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--rb-sabbia-light);
  border-radius: var(--rb-radius);
  margin-bottom: 20px;
  font-size: 15px;
}
.rb-summary svg {
  color: var(--rb-senape);
  flex-shrink: 0;
}
.rb-summary strong {
  color: var(--rb-caffe);
  font-weight: 600;
}

/* ---------- form ---------- */
.rb-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.rb-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-caffe);
}
.rb-label em {
  color: var(--rb-senape-dark);
  font-style: normal;
}
.rb-input,
.rb-textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--rb-sabbia);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--rb-caffe);
  background: white;
  transition: all 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.rb-input:focus,
.rb-textarea:focus {
  outline: none;
  border-color: var(--rb-senape);
  box-shadow: 0 0 0 3px rgba(220, 161, 52, 0.15);
}
.rb-input--error {
  border-color: #c44545;
}
.rb-textarea {
  resize: vertical;
  min-height: 80px;
}
.rb-counter {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: rgba(74, 59, 50, 0.5);
  background: white;
  padding: 0 4px;
}
.rb-error {
  font-size: 12px;
  color: #c44545;
  margin: 0;
}
.rb-error--general {
  padding: 10px 14px;
  background: rgba(196, 69, 69, 0.08);
  border-radius: 8px;
  margin-top: 8px;
}

/* ---------- checkbox ---------- */
.rb-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: rgba(74, 59, 50, 0.85);
  line-height: 1.5;
  cursor: pointer;
}
.rb-checkbox input {
  margin-top: 3px;
  accent-color: var(--rb-senape);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.rb-checkbox a {
  color: var(--rb-senape-dark);
}

/* ---------- submit ---------- */
.rb-submit {
  padding: 16px 24px;
  background: var(--rb-senape);
  color: var(--rb-caffe);
  border: none;
  border-radius: 100px;
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.rb-submit:hover:not(:disabled) {
  background: var(--rb-senape-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px rgba(220, 161, 52, 0.5);
}
.rb-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---------- honeypot ---------- */
.rb-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

/* ---------- success ---------- */
.rb-success {
  text-align: center;
  padding: 40px 16px;
}
.rb-success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--rb-salvia);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rb-success-title {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--rb-caffe);
  margin: 0 0 12px;
}
.rb-success-text {
  font-size: 17px;
  color: var(--rb-caffe);
  margin: 0 0 12px;
}
.rb-success-note {
  font-size: 14px;
  color: rgba(74, 59, 50, 0.7);
  margin: 0;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- error screen ---------- */
.rb-error-screen {
  text-align: center;
  padding: 40px 16px;
  color: #c44545;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 640px) {

  .rb-widget {
    /* Lo spazio in più viene dal container del tema (p-3) */
    padding: 8px 4px;
  }

  /* Progress: compatto orizzontale, solo numeri + label piccolo */
  .rb-progress {
    gap: 4px;
    margin-bottom: 16px;
  }
  .rb-progress-step {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 4px;
    font-size: 10px;
    line-height: 1.2;
    gap: 4px;
    border-radius: 10px;
  }
  .rb-progress-step span {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  /* Calendar header */
  .rb-cal-title {
    font-size: 18px;
  }
  .rb-cal-nav {
    width: 34px;
    height: 34px;
  }

  /* Calendar grid: gap più piccolo, font giorni leggibile */
  .rb-cal-grid {
    gap: 2px;
  }
  .rb-cal-day {
    font-size: 13px;
    border-radius: 8px;
  }
  .rb-cal-day__dot {
    width: 3px;
    height: 3px;
    bottom: 3px;
  }
  .rb-cal-weekdays {
    font-size: 11px;
    gap: 2px;
  }
  .rb-legend {
    font-size: 11px;
    margin-top: 12px;
  }

  /* Time slots: 3 per riga (era auto-fill 90px → su mobile largo 360px sono 3) */
  .rb-slots {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .rb-slot {
    padding: 12px 4px;
    font-size: 14px;
    border-radius: 10px;
  }

  .rb-step-title {
    font-size: 17px;
    margin-bottom: 12px;
  }
  .rb-back {
    font-size: 13px;
    margin-bottom: 12px;
  }

  /* Form */
  .rb-summary {
    padding: 12px 14px;
    font-size: 13px;
    gap: 8px;
  }
  .rb-input,
  .rb-textarea {
    font-size: 16px; /* iOS evita zoom automatico solo con 16px+ */
    padding: 10px 12px;
  }
  .rb-form {
    gap: 14px;
  }
  .rb-checkbox {
    font-size: 13px;
  }
  .rb-submit {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
  }

  /* Success */
  .rb-success {
    padding: 28px 12px;
  }
  .rb-success-icon {
    width: 64px;
    height: 64px;
  }
  .rb-success-title {
    font-size: 22px;
  }
  .rb-success-text {
    font-size: 15px;
  }
}

/* Smartphone molto piccoli (iPhone SE: 375px viewport, 343px container) */
@media (max-width: 380px) {
  .rb-slots {
    grid-template-columns: repeat(2, 1fr);
  }
  .rb-progress-step {
    font-size: 9px;
  }
}
