/* ============================================================
   年間ビュー：左ミニカレンダー ＋ 右祝日サイドバー
   ============================================================ */
#view-year {
  padding: 12px 12px 32px;
}

.year-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================================
   ミニカレンダーグリッド（左）
   ============================================================ */
.year-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ============================================================
   ミニ月カレンダー本体
   ============================================================ */
.mini-month {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: box-shadow 0.15s;
}

.mini-month:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.13);
}

.mini-month-title {
  background: var(--color-header-bg);
  color: var(--color-header-text);
  text-align: center;
  padding: 9px 0 7px;
  font-size: 1rem;
  font-weight: bold;
  text-decoration: none;
  display: block;
  transition: background 0.15s;
  letter-spacing: 0.06em;
}

.mini-month-title:hover {
  background: var(--color-btn-primary);
}

/* 曜日ヘッダー */
.mini-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #555;
}

.mini-dow {
  text-align: center;
  font-size: 0.72rem;
  padding: 4px 0;
  color: #ddd;
  font-weight: 500;
}

.mini-dow.sun { color: #ff8a80; }
.mini-dow.sat { color: #82b1ff; }

/* ============================================================
   日付セル（大きめ・見やすい）
   ============================================================ */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.mini-cell {
  text-align: center;
  padding: 5px 2px 3px;
  position: relative;
  min-height: 44px;
  border-bottom: 1px solid #f0f0f0;
  border-right: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
}

.mini-cell:nth-child(7n) {
  border-right: none;
}

.mini-cell.empty {
  background: #fafafa;
}

/* 日付数字 */
.mini-cell .mini-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  flex-shrink: 0;
}

.mini-cell.sunday .mini-num,
.mini-cell.holiday .mini-num {
  color: var(--color-sun);
}

.mini-cell.saturday .mini-num {
  color: var(--color-sat);
}

.mini-cell.today .mini-num {
  background: var(--color-today-border);
  color: white;
  font-weight: bold;
}

.mini-cell.sunday,
.mini-cell.holiday {
  background: var(--color-holiday-bg);
}

.mini-cell.saturday {
  background: var(--color-sat-bg);
}

/* 祝日名ラベル（短縮形） */
.mini-holiday-name {
  display: block;
  font-size: 0.55rem;
  color: var(--color-sun);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 1px;
}

/* 年間ビューでは六曜非表示 */
.mini-rk { display: none; }

/* ============================================================
   祝日サイドバー（右・スティッキー）
   ============================================================ */
.year-holidays {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.year-holidays::-webkit-scrollbar { width: 4px; }
.year-holidays::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.yl-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-header-bg);
  color: var(--color-header-text);
  padding: 9px 12px 7px;
}

.yl-title {
  font-size: 0.88rem;
  font-weight: bold;
}

.yl-summary {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.72);
  margin-top: 2px;
  line-height: 1.3;
}

/* 月カードリスト（縦1列） */
.yl-grid { display: block; padding: 4px 0 8px; }

.yl-card { border-bottom: 1px solid #f0f0f0; }
.yl-card:last-child { border-bottom: none; }

.yl-card-title {
  display: block;
  background: #f5f5f5;
  color: #333;
  font-size: 0.78rem;
  font-weight: bold;
  padding: 5px 12px;
  text-decoration: none;
  border-left: 3px solid var(--color-header-bg);
  transition: background 0.12s;
}

.yl-card-title:hover { background: #ebebeb; }

.yl-card-title.no-holiday {
  border-left-color: #ddd;
  color: #aaa;
}

.yl-none {
  font-size: 0.7rem;
  color: #bbb;
  padding: 3px 12px 5px 15px;
}

.yl-list { list-style: none; padding: 2px 0 4px; }

.yl-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 10px 3px 15px;
  border-bottom: 1px solid #f8f8f8;
}
.yl-item:last-child { border-bottom: none; }

.yl-date {
  white-space: nowrap;
  font-size: 0.68rem;
  min-width: 60px;
}

.yl-date.sun { color: var(--color-sun); font-weight: bold; }
.yl-date.sat { color: var(--color-sat); }
.yl-date.wday { color: #666; }

.yl-name {
  color: #333;
  font-size: 0.7rem;
  line-height: 1.3;
}

/* ============================================================
   印刷スタイル
   ============================================================ */
@media print {
  html, body { background: white; font-size: 9pt; }
  .nav-controls, .screen-only { display: none !important; }

  #view-year { padding: 4mm; }
  .year-layout { display: block; }

  .year-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4mm;
  }

  .year-grid::before {
    content: attr(data-year) '年 年間カレンダー';
    display: block;
    grid-column: 1 / -1;
    text-align: center;
    font-size: 16pt;
    font-weight: bold;
    padding-bottom: 3mm;
  }

  .mini-month { border: 1px solid #ccc; break-inside: avoid; box-shadow: none; }

  .mini-month-title {
    background: #444 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .mini-dow-row {
    background: #555 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .mini-cell.sunday, .mini-cell.holiday {
    background: #fff5f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .mini-cell.saturday {
    background: #f0f4ff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .mini-cell.today .mini-num { background: white !important; color: inherit !important; }
  .year-holidays, .no-print { display: none !important; }

  @page { size: A4 portrait; margin: 10mm; }
}

/* ============================================================
   レスポンシブ
   ============================================================ */

/* 縦型モニタ・タブレット（≤1000px）：サイドバーを下に */
@media (max-width: 1000px) {
  .year-layout { flex-direction: column; }

  .year-grid { grid-template-columns: repeat(3, 1fr); }

  .year-holidays {
    width: 100%;
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .yl-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0;
  }

  .yl-card {
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
  }

  .yl-card:nth-child(4n) { border-right: none; }
}

/* スマホ（≤600px） */
@media (max-width: 600px) {
  #view-year { padding: 8px 8px 16px; }

  .year-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  .mini-cell { min-height: 36px; padding: 4px 1px 2px; }

  .mini-cell .mini-num { width: 22px; height: 22px; font-size: 0.8rem; }

  .mini-holiday-name { font-size: 0.5rem; }

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

@media (max-width: 380px) {
  .year-grid { grid-template-columns: 1fr; }
  .yl-grid { grid-template-columns: 1fr; }
}
