/* css/views.css — additions/overrides for the calendar month view, the
   timeline field reordering, the heatmap mobile transpose, and the rooms
   card layout on narrow screens.
   Kept separate from styles.css by convention for this worktree; only
   rules made obsolete by these changes were removed from styles.css
   itself. Loaded via <link> in index.html (owned by another worker). */

/* ------------------------------------------------------------ heatmap --- */

/* styles.css sets `.heatmap-grid { min-width: 520px }` for the desktop
   24-hour-column layout, so it doesn't squash under its own content. At the
   same breakpoint heatmap.js switches to the narrow "hours × 7 weekdays"
   transposed grid, which only needs ~300px — without this override the
   520px floor forces that narrow grid (and the whole page) to overflow
   horizontally. */
@media (max-width: 599px) {
  .heatmap-grid {
    min-width: 0;
  }
}

/* --------------------------------------------------- rooms: calendar --- */

.calendar-viewer {
  max-width: 420px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-nav-title {
  font-size: 13px;
  font-weight: 700;
}

.calendar-nav-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.calendar-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.calendar-weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  max-width: 420px;
  margin-bottom: 4px;
  font-size: 10.5px;
  color: var(--text-faint);
  text-align: center;
}

/* ------------------------------------------------------ rooms: cards --- */

.room-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
}

.room-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.room-card-head .fav-star {
  font-size: 18px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.room-card-name {
  flex: 1 1 auto;
  min-width: 0;
}

.room-card-hotel {
  font-weight: 600;
  font-size: 13.5px;
}

.room-card-room {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 1px;
}

.room-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 10px 0;
}

.room-card-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 4px;
}

.room-card-stat-label {
  color: var(--text-faint);
}

.room-card-stat-value {
  font-weight: 600;
}

.room-card-hours {
  margin-bottom: 10px;
}

.room-card-toggle {
  width: 100%;
  min-height: 36px;
}

.room-card-calendar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------ timeline --- */

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.timeline-header h2 {
  margin: 0;
}

.timeline-sound-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.timeline-sound-toggle,
.timeline-sound-preview {
  flex: 0 0 auto;
  white-space: nowrap;
}

.timeline-sound-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* 「画面をタップすると通知音が有効になります」ヒント: ONにした/前回のリロード
   で ON が復元されたが、まだユーザー操作（＝AudioContextの解錠）が一度も
   起きていない間だけ表示する。ブラウザの制限で自動再生できないための案内。 */
.timeline-sound-hint {
  flex: 1 1 auto;
  min-width: 180px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.timeline-sound-hint[hidden] {
  display: none;
}

/* 「新着N件」ピル: 自動更新で新規イベントが来たとき、ユーザーがスクロール
   済みでもコンテンツを押し下げず、タップでトップへ戻って反映するための
   フローティングボタン。 */
.timeline-new-pill {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* 自動更新で新規に挿入された行の一時的なハイライト。 */
.timeline-item.is-new {
  animation: timeline-new-flash 1.6s ease-out;
}

@keyframes timeline-new-flash {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}

.timeline-line1,
.timeline-line2 {
  /* Transparent to the parent .timeline-item flexbox on desktop, so items
     still lay out and wrap on one line like before. */
  display: contents;
}

.timeline-stay {
  color: var(--text);
}

.timeline-lead {
  color: var(--text-muted);
}

.badge-outline {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid var(--warn);
  color: var(--warn);
  background: transparent;
}

.timeline-secondary {
  color: var(--text-faint);
  font-size: 11.5px;
}

/* Room name link -> official reservation page. Keeps the same bold look as
   the plain text it replaces (.timeline-room in styles.css sets font-weight);
   padding widens the tap target on phones without disturbing row height. */
.timeline-room-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  padding: 4px 0;
  margin: -4px 0;
}

.timeline-room-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.timeline-room-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (max-width: 599px) {
  .timeline-line1,
  .timeline-line2 {
    /* Force each group onto its own full-width line -> a 2-line card,
       keeping the same field order within each line. */
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 4px 10px;
  }
  .timeline-line2 {
    margin-top: 2px;
    justify-content: space-between;
    align-items: baseline;
  }
}
