/* ====== Wrapper ====== */
.crb-wrap {
  max-width: 760px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #0b1b33;
}

/* ====== Header (month nav) ====== */
.crb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 6px;
}

.crb-title {
  font-size: 22px;
  font-weight: 650;
}

.crb-nav {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: #eef4ff;
  cursor: pointer;
  font-size: 22px;
  color: #0b1b33;
}

.crb-nav:hover {
  background: #e2ecff;
}

/* ====== Days of week ====== */
.crb-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 8px 6px;
  font-weight: 600;

  justify-items: center;  /* centrerar texten i varje kolumn */
  align-items: center;
  text-align: center;
}

.crb-dow > div {
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .85;
  line-height: 1;
}
/* ====== Calendar grid ======
   Viktigt för runda dagar:
   - vi centrerar items i grid
   - varje dag är en "cirkel" med aspect-ratio 1/1
*/
.crb-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 6px;
  justify-items: center; /* centrerar varje cell-innehåll */
  align-items: center;
}

/* Tom-celler före månadens första dag */
.crb-day.is-out {
  width: 100%;
  max-width: 64px;
  aspect-ratio: 1 / 1;
  opacity: .25;
  pointer-events: none;
}

/* Själva dag-cirkeln */
.crb-day {
  width: 100%;
  max-width: 64px;          /* cirkelstorlek desktop */
  aspect-ratio: 1 / 1;      /* håller den 100% rund */
  border-radius: 999px;     /* extra säkerhet */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  background: transparent;
}

/* Siffran */
.crb-day .num {
  font-size: 18px;
  font-weight: 650;
  color: #0b1b33;
}

/* Lediga dagar = ljust blå bubble */
.crb-day.is-available {
  background: #e9f1ff;
}

.crb-day.is-available .num {
  color: #1166ff;
}

/* Ej bokningsbar/fullbokad = “neutral” look */
.crb-day.is-full {
  background: transparent;
}

.crb-day.is-full .num {
  opacity: .55;
}

/* Hover */
.crb-day:not(.is-out):hover {
  filter: brightness(0.98);
}

/* Legend */
.crb-legend {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 10px 8px;
  opacity: .8;
  font-size: 13px;
}

.crb-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 6px;
}

.crb-dot-available { background: #cfe2ff; }
.crb-dot-full { background: #cfd6e6; }

/* ====== Modal ====== */
.crb-modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 27, 51, .35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.crb-modal.is-open {
  display: flex;
}

.crb-modal-card {
  width: min(820px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
  overflow: hidden;
}

.crb-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid #eef1f6;
}

.crb-modal-title {
  font-size: 18px;
  font-weight: 700;
}

.crb-modal-sub {
  font-size: 13px;
  opacity: .75;
  margin-top: 2px;
}

/* Runda knappar i modal (stäng + dagpil) */
.crb-close {
  border: 0;
  background: #f3f6fb;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0b1b33;
}

.crb-close:hover {
  background: #eaf0fb;
}

/* ====== Times (slots) ====== */
.crb-times {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 18px;

  /* Viktigt för drag på mobil */
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.crb-slot {
  border: 1px solid #e6ecf7;
  background: #fff;
  border-radius: 12px;
  padding: 10px 10px;
  cursor: pointer;
  text-align: center;
  color: #0b1b33;
  font-weight: 650;
}

.crb-slot:hover {
  filter: brightness(0.99);
}

.crb-slot.is-busy {
  opacity: .45;
  cursor: not-allowed;
  text-decoration: line-through;
}

.crb-slot.is-selected {
  background: #e9f1ff;
  border-color: #cfe2ff;
  color: #1166ff;
}

/* ====== Form ====== */
.crb-form {
  padding: 0 18px 18px;
}

.crb-selected {
  padding: 10px 0 8px;
  font-weight: 650;
}

.crb-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.crb-fields label {
  font-size: 13px;
  opacity: .85;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crb-fields input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e6ecf7;
  outline: none;
}

.crb-fields input:focus {
  border-color: #cfe2ff;
  box-shadow: 0 0 0 4px rgba(17, 102, 255, .10);
}

.crb-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 12px;
}

.crb-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  background: #1166ff;
  color: #fff;
}

.crb-btn:hover {
  filter: brightness(0.98);
}

.crb-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.crb-btn-secondary {
  background: #f3f6fb;
  color: #0b1b33;
}

.crb-msg {
  margin-top: 10px;
  font-size: 13px;
  opacity: .85;
}

/* ====== Responsive ====== */
@media (max-width: 640px) {
  .crb-title { font-size: 20px; }

  .crb-nav {
    width: 40px;
    height: 40px;
  }

  .crb-day,
  .crb-day.is-out {
    max-width: 52px;  /* mindre cirklar på mobil */
  }

  .crb-day .num {
    font-size: 16px;
  }

  .crb-times {
    grid-template-columns: repeat(2, 1fr);
  }

  .crb-fields {
    grid-template-columns: 1fr;
  }
}