/* =========================
   📁 calendar_base.css
   カレンダー本体・帯構造・共通スロット・日付表示
========================= */

.calendar {
  table-layout: fixed;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  box-sizing: border-box;

  border: 2px solid #f9c;
  border-radius: 12px;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
  background-color: #fffafc;

  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.calendar-cell-date {
  display: block;
  background-color: #fff;
  border: 2px solid #ff99cc;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: bold;
  color: #b03060;
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 3;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.calendar td[data-date] {
  position: relative;
  overflow: visible;
  height: 160px;
  padding-top: 6px;
  padding-bottom: 80px;
  vertical-align: top;
  box-sizing: border-box;
  border: 1px solid rgba(255, 192, 203, 0.5);
  text-align: left;
}

.calendar td:not([data-date]) {
  height: auto;
  position: relative;
  overflow: visible;
  vertical-align: top;
  box-sizing: border-box;
  border: 1px solid rgba(255, 192, 203, 0.5);
  text-align: left;
  padding: 0;
  margin: 0;
}

.calendar tr {
  height: auto !important;
}

.event-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-height: 16px;
  width: 100% !important;
  max-width: none !important;
  font-size: 11px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  overflow: visible !important;
  white-space: nowrap !important;
  text-overflow: ellipsis;
  box-sizing: border-box;
  z-index: 10000;
  pointer-events: auto;
}

.event-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: inherit;
  z-index: -1;
}

.event-bar::after {
  content: '';
  flex-grow: 1;
}

.event-bar.opt-strike {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 0px,
    rgba(255, 255, 255, 0.15) 4px,
    transparent 4px,
    transparent 8px
  );
  background-blend-mode: overlay;
}

.event-bar.opt-red {
  color: #b00020;
  border: 1px solid #ff6666;
  background-color: #fff0f0;
}

.event-bar.opt-outline {
  outline: 2px solid #3399ff;
  outline-offset: 2px;
  box-shadow: 0 0 5px #99ccff80;
}

.calendarx-label.no-link {
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.calendarx-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
  color: #000;
  pointer-events: none;

  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;

  height: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}

.calendarx-slots {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1;
}

.calendarx-slot {
  height: 16px;
  width: 100%;
  position: relative;
}

.calendarx-bar {
  position: absolute;
  height: 100%;
  --bar-color: #f9c;
  background-color: transparent;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 10px;
  padding: 0 4px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: ellipsis;
  box-sizing: border-box;
  pointer-events: auto !important;
  z-index: 10001 !important;
  position: relative;
}

.calendarx-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  background-color: var(--bar-color);
  border-radius: inherit;
  z-index: -1;
}

.calendarx-bar.selected {
  outline: 2px solid red;
  outline-offset: 1px;
  opacity: 1;
}

.calendarx-bar.opt-strike {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 0px,
    rgba(255, 255, 255, 0.15) 4px,
    transparent 4px,
    transparent 8px
  );
  background-blend-mode: overlay;
}

.calendarx-bar.opt-red {
  color: #b00020;
  border: 1px solid #ff6666;
  background-color: #fff0f0;
}

.calendarx-bar.opt-outline {
  outline: 2px solid #3399ff;
  outline-offset: 2px;
  box-shadow: 0 0 5px #99ccff80;
}

.calendarx-label.has-link span {
  pointer-events: auto;
}

.calendarx-bar.opt-strike::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bar-color);
  background-image: repeating-linear-gradient(
    45deg,
    var(--strike-color, #ffe5f0) 0px,
    var(--strike-color, #ffe5f0) 2px,
    transparent 2px,
    transparent 22px
  );
  background-blend-mode: normal;
  background-repeat: repeat;
}

.calendarx-label.has-link {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  width: 100%;
  height: 100%;
}

.calendarx-label.has-link span:first-child {
  justify-self: start;
}

.calendarx-label.has-link span:last-child {
  justify-self: center;
}

.calendar thead tr {
  border: 2px solid #f9c;
  border-radius: 8px;
  background-color: #fffafc;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
}

.calendar thead th:first-child {
  border-top-left-radius: 8px;
}

.calendar thead th:last-child {
  border-top-right-radius: 8px;
}

.calendar th {
  background-color: #ffe0f5;
  color: #b03060;
  padding: 6px;
  border: 1px solid #ddd;
  font-weight: bold;
}

.calendar .sunday {
  background-color: #fff0f5;
  color: #d33;
}

.calendar .saturday {
  background-color: #e6f0ff;
  color: #339;
}

@keyframes flash {
  0%, 100% { background-color: #fff0f8; }
  50% { background-color: #ffccdd; }
}

.calendar td.today-highlight {
  animation: flash 1.2s ease-in-out 3;
  box-shadow: 0 0 0 3px #ff66aa inset;
  position: relative;
}

/* 🌸 挿絵画像用 */
.calendar-illust {
  object-fit: contain;
  object-position: center;
  display: block;
  width: 100%;
  max-height: 160px;
  height: 100%;
}

.calendar td img,
.calendar-illust {
  max-height: 160px;
  width: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
}
