/* Rådgivning Bokning v3 – fully fluid, never overflows */
.rb-wrap {
  /* Never wider than the container it sits in */
  max-width: 520px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
}
.rb-wrap * { box-sizing: border-box; min-width: 0; }

.rb-panel {
  background: #fff;
  border: 1px solid #e4e4e0;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Header */
.rb-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid #f0f0eb;
  flex-shrink: 0;
}
.rb-title { font-size: 16px; font-weight: 600; margin: 0 0 2px; color: #1a1a1a; }
.rb-sub   { font-size: 12px; color: #aaa; margin: 0; }
.rb-steps { display: flex; gap: 5px; margin-top: 5px; flex-shrink: 0; }
.rb-step-dot { width: 20px; height: 4px; border-radius: 2px; background: #e8e8e4; transition: background .25s; }
.rb-step-dot.rb-active { background: #185FA5; }

/* Slider */
.rb-viewport { overflow: hidden; flex: 1; width: 100%; }
.rb-slider {
  display: flex;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  align-items: flex-start;
  width: 100%;
  will-change: transform;
}
.rb-slide { min-width: 100%; width: 100%; flex-shrink: 0; min-width: 0; }
.rb-inner { padding: 1rem 1.25rem 1rem; overflow-y: auto; width: 100%; }

/* Footer */
.rb-panel-footer {
  display: flex;
  gap: 8px;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid #f0f0eb;
  flex-shrink: 0;
  background: #fff;
}

/* Calendar */
.rb-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; gap: 8px; }
.rb-cal-month  { font-size: 14px; font-weight: 600; color: #1a1a1a; text-align: center; flex: 1; }
.rb-cal-nav    { background: none; border: 1px solid #e8e8e4; border-radius: 7px; width: 28px; height: 28px; min-width: 28px; cursor: pointer; font-size: 16px; color: #666; display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1; flex-shrink: 0; }
.rb-cal-nav:hover { background: #f5f5f0; }

.rb-cal-grid  { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; width: 100%; }
.rb-day-name  { text-align: center; font-size: 10px; color: #bbb; font-weight: 700; padding: 3px 0; }
.rb-cal-cell  { aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center; font-size: 12px; border-radius: 7px; cursor: pointer; transition: background .1s; min-width: 0; width: 100%; }
.rb-cal-cell:hover:not(.rb-disabled):not(.rb-past):not(.rb-selected) { background: #f0f0eb; }
.rb-cal-cell.rb-past     { color: #ddd; pointer-events: none; }
.rb-cal-cell.rb-disabled { color: #ddd; pointer-events: none; }
.rb-cal-cell.rb-today    { font-weight: 700; color: #185FA5; }
.rb-cal-cell.rb-selected { background: #185FA5; color: #fff; font-weight: 600; }
.rb-cal-cell.rb-empty    { pointer-events: none; }

/* Time grid */
.rb-section-label { font-size: 11px; font-weight: 700; color: #aaa; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.rb-time-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; width: 100%; }
.rb-time-slot { border: 1px solid #e8e8e4; border-radius: 8px; padding: 9px 4px; text-align: center; font-size: 13px; cursor: pointer; background: #fff; color: #1a1a1a; transition: all .1s; min-width: 0; }
.rb-time-slot:hover:not(.rb-selected) { background: #f5f5f0; }
.rb-time-slot.rb-selected { background: #185FA5; color: #fff; border-color: #185FA5; }

/* Chip */
.rb-booking-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; background: #EBF3FF; color: #185FA5; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 100px; word-break: break-word; max-width: 100%; }

/* Form */
.rb-form-row   { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.rb-form-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rb-form-group label { font-size: 12px; color: #555; font-weight: 500; }
.rb-form-group input { font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid #e4e4e0; background: #fff; color: #1a1a1a; outline: none; width: 100%; min-width: 0; }
.rb-form-group input:focus { border-color: #185FA5; box-shadow: 0 0 0 3px rgba(24,95,165,.12); }
.rb-owner-note { font-size: 11px; color: #aaa; background: #fafaf8; border-radius: 8px; padding: 7px 10px; margin: 8px 0 0; }
.rb-error { background: #fff0f0; color: #c0392b; border: 1px solid #f5c6c6; border-radius: 8px; padding: 8px 12px; font-size: 12px; margin-top: 8px; }

/* Buttons */
.rb-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; background: #185FA5; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; flex: 1; min-width: 0; }
.rb-btn:hover    { background: #0C447C; }
.rb-btn:disabled { background: #ccc; cursor: default; }
.rb-btn-back { background: #fff; border: 1px solid #e4e4e0; color: #555; flex: 0 0 auto; }
.rb-btn-back:hover { background: #f5f5f0; }

/* Success */
.rb-success      { text-align: center; padding: 1.25rem 0.5rem 0.5rem; }
.rb-success-icon { width: 52px; height: 52px; background: #EAF3DE; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.875rem; font-size: 22px; color: #3B6D11; }
.rb-success h3   { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.rb-success p    { font-size: 13px; color: #555; line-height: 1.6; margin: 0 0 4px; }
.rb-summary      { background: #fafaf8; border: 1px solid #eeeeea; border-radius: 10px; padding: 10px 16px; margin: 0.875rem auto; font-size: 13px; color: #555; line-height: 2; display: inline-block; text-align: left; max-width: 100%; word-break: break-word; }
.rb-summary strong { color: #1a1a1a; font-weight: 600; }
.rb-conf-note    { font-size: 11px !important; color: #bbb !important; }

/* ── Narrow containers & mobile ────────────────────────────────────── */
/* Switch to 1-col form and 3-col times when panel is narrow */
@media (max-width: 400px) {
  .rb-panel-header { padding: 0.75rem 1rem 0.625rem; }
  .rb-inner        { padding: 0.75rem 1rem; }
  .rb-panel-footer { padding: 0.75rem 1rem; }
  .rb-form-row     { grid-template-columns: 1fr; }
  .rb-time-grid    { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Container query fallback: if the card itself is narrow, collapse form */
@supports (container-type: inline-size) {
  .rb-wrap { container-type: inline-size; }

  @container (max-width: 360px) {
    .rb-form-row  { grid-template-columns: 1fr; }
    .rb-time-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rb-panel-header { padding: 0.75rem 0.875rem 0.625rem; }
    .rb-inner        { padding: 0.75rem 0.875rem; }
    .rb-panel-footer { padding: 0.75rem 0.875rem; }
  }
}
