﻿body {
  font-family: "Helvetica Neue", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background-color: #f5f5f5;
  font-size: 13px;
  color: #333;
}

/* -------------------------
   Sidebar
------------------------- */
.sidebar {
  width: 240px;
  height: 100vh;
  background-color: #ffffff;
  position: fixed;
  left: 0;
  top: 0;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.sidebar a {
  text-decoration: none;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 28px;
}

.logo-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 8px;
  flex-shrink: 0;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4CAF50;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.logo-title i {
  font-size: 14px;
  display: flex;
  align-items: center;
  transform: translateY(-1px);
}

.logo-title span {
  display: inline-block;
  line-height: 1;
}

.sidebar-user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
}

.login-user {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.sidebar-logout-button {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 12px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
}

.sidebar-logout-button:hover {
  background: #f0f0f0;
}

.menu-section {
  margin-bottom: 28px;
}

.menu-label {
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-divider {
  margin: 8px 0 14px 0;
  border: none;
  border-top: 1px solid #ddd;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.nav-item:hover {
  color: #4CAF50;
}

.nav-item i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: #e53935;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

.nav-badge.hide {
  display: none;
}

/* -------------------------
   Main
------------------------- */
.main {
  margin-left: 260px;
  padding: 30px;
  box-sizing: border-box;
}

.country-top-bar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  padding: 6px 16px;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.country-top-bar.visible {
  transform: translateY(0);
  pointer-events: auto;
}

.content-wrapper {
  padding: 3%;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

/* -------------------------
   Buttons
------------------------- */
.search-buttons,
.export-buttons {
  cursor: pointer;
  user-select: none;
  min-width: 62px;
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #cfcfcf;
  background-color: #f8f8f8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  white-space: nowrap;
  transition: background-color 0.2s ease, transform 0.06s ease, opacity 0.06s ease;
  margin: 2px 4px;
  font-size: 14px;
}

.search-buttons:hover,
.export-buttons:hover {
  background-color: #f8f5f0;
  border-color: #d8c3a5;
  box-shadow: 0 0 4px rgba(216, 195, 165, 0.3);
}

.search-buttons:active,
.export-buttons:active {
  transform: translateY(1px);
  opacity: 0.9;
}


.export-buttons.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.form-select {
  min-width: 78px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background-color: #fff;
  font-size: 14px;
  color: #333;
}

/* -------------------------
   Page Title
------------------------- */
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1.5px solid #4CAF50;
  margin-bottom: 20px;
  background-color: #FFE8CC;
  border-radius: 8px 8px 0 0;
}

.page-title-icon {
  width: 32px;
  height: 32px;
  background: #f0faf0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4CAF50;
  font-size: 16px;
  flex-shrink: 0;
}

.page-title-text {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;   /* 狭い画面で「従業員 詳細」が1文字ずつ縦に折り返していた（2026/10/19。前・後ボタンを足したため） */
}

/* 狭い画面では、入りきらない右側（日付・ログアウト）やボタンを次の行へ送る（2026/10/19） */
.page-title {
  flex-wrap: wrap;
  row-gap: 8px;
}

.page-title-badge {
  font-size: 11px;
  font-weight: 500;
  color: #4CAF50;
  background: #f0faf0;
  border: 1px solid #b6deb7;
  border-radius: 99px;
  padding: 3px 10px;
  letter-spacing: .04em;
  flex-shrink: 0;
}

.page-title-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}

#current-time {
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  font-weight: 600;
}

.page-title-clock-sep {
  color: #bbb;
}

.page-title-logout-button {
  padding: 3px 10px;
  font-size: 12px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  color: #555;
}

.page-title-logout-button:hover {
  background: #f0f0f0;
}

/* -------------------------
   Content Box
------------------------- */
.content-box {
  margin: 0 auto;
  padding: 20px;
  border: 1px solid #ccc;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: auto;
  box-sizing: border-box;
}

/* -------------------------
   Table
------------------------- */
.table-body {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.table-body thead th {
  border: 1px solid #ccc;
  padding: 8px 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: #E8F0FE;
}

.table-body td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: #fff;
}

.table-body tbody tr {
  transition: background-color 0.12s ease;
}

.table-body tbody tr:hover td {
  background-color: #f0f0f0 !important;
  cursor: pointer;
}

/* -------------------------
   Export Buttons
------------------------- */
.export-buttons {
  margin: 0.2%;
  padding: 0.2% 1%;
  border: 1px solid #ccc;
  background-color: #E8F0FE;
}

/* -------------------------
   App Button
------------------------- */
.app-button {
  padding: 8px 20px;
  border: 2px solid #4CAF50;
  background-color: #ffffff;
  color: #4CAF50;
  font-weight: bold;
  border-radius: 6px;
  margin: 0 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.app-button:hover {
  background-color: #4CAF50;
  color: #fff;
}

/* -------------------------
   Pagination
------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem auto 0 auto;
  width: fit-content;
  padding: 0.5rem 1rem;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-left: calc(50% + 3cm);
  transform: translateX(-50%);
}

.page-button {
  display: inline-block;
  background-color: #ffffff;
  color: #4CAF50;
  border: 2px solid #4CAF50;
  padding: 8px 16px;
  margin: 0 8px;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: bold;
}

.page-button:hover {
  background-color: #4CAF50;
  color: #ffffff;
}

/* -------------------------
   Country Toggle
------------------------- */
/* 見出しの帯ではアイコン（32px 四方）と同じ高さにそろえる（2026/10/23） */
.country-toggle {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* 見出しの帯の中では「管理者」などの札から約 1.3cm あける（帯の gap 10px ＋ 44px。2026/10/23 ユーザー指示「1文字ぶん」→「あと1cm」。1cm＝約38px） */
.country-toggle.is-in-title {
  margin-left: 44px;
}

.country-toggle-btn {
  height: 32px;
  padding: 2px;
  font-size: 0;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  box-sizing: border-box;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.15s, border-color 0.15s;
}

.country-toggle-btn .fi {
  display: block;
  width: 32px;
  height: 24px;
  outline: 1px solid #ccc;
  border-radius: 3px;
}

.country-toggle-btn:hover {
  opacity: 0.7;
}

.country-toggle-btn.active {
  opacity: 1;
  border-color: #4CAF50;
}

/* -------------------------
   Utility
------------------------- */
.hide {
  display: none;
}

.highlight-red {
  color: red;
}

/* readonly 繧定ｦ冶ｦ夂噪縺ｫ蛹ｺ蛻･ */
.form-line input[readonly],
.form-group input[readonly],
.form-group textarea[readonly] {
  background-color: #f5f5f5;
  color: #666;
  cursor: not-allowed;
}

/* -------------------------
   Overlay
------------------------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  z-index: 500;
}

.loading-overlay.hide {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(3px);
}

.loading-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 48px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-width: 180px;
}

/* 笏笏 繧ｹ繝斐リ繝ｼ 笏笏 */
.loading-spinner {
  position: relative;
  width: 64px;
  height: 64px;
}

.loading-arc {
  width: 64px;
  height: 64px;
  animation: loading-rotate 1.2s linear infinite;
}

.loading-arc-track {
  stroke: #e8f5e9;
}

.loading-arc-head {
  stroke: #4CAF50;
  animation: loading-dash 1.2s ease-in-out infinite;
}

.loading-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4CAF50;
  font-size: 20px;
}

/* 笏笏 3轤ｹ繝峨ャ繝・笏笏 */
.loading-dots {
  display: flex;
  gap: 6px;
  margin: 0;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4CAF50;
  animation: loading-bounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

/* -------------------------
   Calendar Holiday List (shared)
------------------------- */
.calendar-holiday-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendar-holiday-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
}

.calendar-holiday-day {
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

.calendar-holiday-national { color: #c0392b; }
.calendar-holiday-national::before { content: "●"; margin-right: 4px; }

.calendar-holiday-company { color: #2e7d32; }
.calendar-holiday-company::before { content: "●"; margin-right: 4px; }

.calendar-holiday-company-china { color: #7a5c00; }
.calendar-holiday-company-china::before { content: "●"; margin-right: 4px; }

.calendar-holiday-china { color: #7a5c00; }
.calendar-holiday-china::before { content: "●"; margin-right: 4px; }

.calendar-holiday-exception { color: #0e7490; }
.calendar-holiday-exception::before { content: "●"; margin-right: 4px; }

.calendar-holiday-paid { color: #1565c0; }
.calendar-holiday-paid::before { content: "●"; margin-right: 4px; }

/* -------------------------
   Calendar Summary
------------------------- */
.calendar-summary {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.calendar-summary-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  padding: 10px 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.calendar-summary-label {
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
}

.calendar-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.calendar-summary-unit {
  font-size: 13px;
  color: #6b7280;
}

/* -------------------------
   Calendar PDF Button
------------------------- */
.calendar-pdf-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #e53935;
  background: #fff;
  color: #e53935;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  position: absolute;
  right: 19mm;
}

.calendar-pdf-button:hover {
  background: #e53935;
  color: #fff;
}

/* -------------------------
   Calendar Print Styles
------------------------- */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  /* 印刷タイトル */
  .main::before {
    content: "テラオエフ " attr(data-print-year) "年 年間カレンダー";
    display: block;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 6px;
  }

  /* サイドバー・ヘッダー・フッター・フィルター・祝日リスト非表示 */
  .sidebar,
  #app-footer,
  .page-title,
  .employee-calendar-search-panel,
  .company-calendar-search-panel,

  #toast-container,
  .loading-overlay,
  .overlay {
    display: none !important;
  }

  /* サイドバー分のマージンを除去してフル幅に */
  .main {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .content-wrapper {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* コンテナの余白を縮小 */
  .employee-calendar-container,
  .company-calendar-container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
  }

  /* 3列×4行、gapを縮小 */
  .employee-calendar-year,
  .company-calendar-year {
    grid-template-columns: repeat(3, 1fr) !important;
    column-gap: 4px !important;
    row-gap: 30px !important;
  }

  /* 月タイトルを小さく */
  .employee-calendar-month h3,
  .company-calendar-month h3 {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  /* 曜日ヘッダーを小さく */
  .employee-calendar-cal .employee-calendar-head div,
  .company-calendar-cal .company-calendar-head div {
    font-size: 9px !important;
    padding: 3px 0 !important;
  }

  /* セル高さを縮小 */
  .employee-calendar-cell,
  .company-calendar-cell {
    min-height: 19px !important;
  }

  /* サマリーをコンパクトに */
  .calendar-summary {
    gap: 6px !important;
    margin-top: 20px !important;
  }

  .calendar-summary-item {
    flex-direction: row !important;
    align-items: baseline !important;
    gap: 4px !important;
    padding: 4px 10px !important;
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 6px !important;
    min-width: unset !important;
  }

  .calendar-summary-label {
    font-size: 8px !important;
  }

  .calendar-summary-value {
    font-size: 13px !important;
  }

  .calendar-summary-unit {
    font-size: 8px !important;
  }

  /* 祝日一覧フォントを縮小・●との間隔を縮小・行間縮小 */
  .calendar-holiday-list {
    gap: 0px !important;
  }

  .calendar-holiday-list-item {
    font-size: 8px !important;
    gap: 0px !important;
    padding: 0 2px !important;
    line-height: 1.1 !important;
  }

  .calendar-holiday-national::before,
  .calendar-holiday-company::before,
  .calendar-holiday-company-china::before,
  .calendar-holiday-exception::before {
    margin-right: 0px !important;
  }

  /* 日付フォントを縮小 */
  .employee-calendar-date,
  .company-calendar-date {
    font-size: 9px !important;
    top: 2px !important;
    left: 4px !important;
  }

  /* 祝日名（セル内）を非表示 */
  .employee-calendar-holiday-name,
  .company-calendar-holiday-name {
    display: none !important;
  }

  /* 列間の縦線を非表示、改ページしない */
  .employee-calendar-month,
  .company-calendar-month {
    border-left: none !important;
    border-right: none !important;
    break-inside: avoid;
  }

  /* 色を印刷に出す */
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* 笏笏 繝｡繝・そ繝ｼ繧ｸ 笏笏 */
#loading-message {
  margin: 0;
  font-size: 13px;
  color: #555;
  letter-spacing: .04em;
  min-height: 18px;
}

/* ローディング枠の外・下に出す薄い案内文 */
.loading-hint {
  margin: 14px auto 0;
  max-width: 540px;
  padding: 6px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: #777;
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 8px;
}

.loading-hint:empty {
  display: none;
}


/* 笏笏 繧｢繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ 笏笏 */
@keyframes loading-rotate {
  to { transform: rotate(360deg); }
}

@keyframes loading-dash {
  0%   { stroke-dasharray:  5 120; stroke-dashoffset:   0; }
  50%  { stroke-dasharray: 80  45; stroke-dashoffset: -30; }
  100% { stroke-dasharray:  5 120; stroke-dashoffset: -125; }
}

@keyframes loading-bounce {
  0%, 80%, 100% { transform: scale(.7); opacity: .5; }
  40%            { transform: scale(1);  opacity: 1;  }
}

/* -------------------------
   App Footer
------------------------- */
#app-footer {
  margin-left: 260px;
  padding: 14px 30px 24px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 12px;
  color: #999;
  letter-spacing: .08em;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* -------------------------
   フォームの操作バー（画面下に固定）

   長いフォームでは、保存ボタンが中ほどにあると「その上だけ保存される」ように見え、
   下まで編集した人がボタンに気付かない（2026/10/02 ユーザー報告・従業員詳細で発生）。
   form の末尾に置いたうえで画面下へ貼り付け、どこまでスクロールしても見えるようにする。
   未保存の表示は unsaved_guard.js が body.has-unsaved を付け外しして切り替える。
-------------------------- */
/* 既定は出さない。保存するものが無いのに常に居座ると、見慣れて誰も見なくなる
   （2026/10/03 ユーザー判断「保存は編集があったときだけ出せばいい」）。
   「閉じる」のような画面移動のボタンはここに置かず、ページタイトル行へ置くこと。 */
.form-action-bar {
  display: none;
  position: sticky;
  bottom: 0;
  z-index: 20;
  align-items: center;   /* display は上の none と body.has-unsaved 側の flex で切り替える */
  justify-content: center;
  gap: 16px;
  margin: 24px -24px 0 -24px;   /* content-wrapper の内側余白ぶん左右へ広げる */
  padding: 14px 24px;
  background-color: #ffffff;
  border-top: 2px solid #4CAF50;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12);
}

/* バーの中はボタン同士の間隔を gap に任せる（.app-button の左右マージンを打ち消す） */
.form-action-bar .app-button {
  margin: 0;
}

/* 保存は主たる操作。枠線だけだと「閉じる」と同じ見た目で埋もれるので塗りつぶす
   （2026/10/02 ユーザー指摘「保存ボタンのバーが気付きにくい」） */
.form-action-bar button[type="submit"] {
  background-color: #4CAF50;
  color: #ffffff;
  padding: 10px 32px;
}

.form-action-bar button[type="submit"]:hover {
  background-color: #3d8b40;
  border-color: #3d8b40;
  color: #ffffff;
}

/* 未保存のときだけ出す。色も変えて、押してほしいことが分かるようにする */
body.has-unsaved .form-action-bar {
  display: flex;
  background-color: #fff8e6;
  border-top-color: #e8a300;
}

/* 未保存のときだけ出る。既定は非表示 */
.form-action-bar-status {
  display: none;
  align-items: center;
  gap: 6px;
  color: #b26a00;
  font-weight: bold;
  font-size: 13px;
}

body.has-unsaved .form-action-bar-status {
  display: inline-flex;
}

/* ページタイトル行の「一覧へ戻る」。画面移動なのでフォームの保存ボタンとは分けている
   （2026/10/03。従業員詳細で使用） */
.page-title-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid #b6deb7;
  border-radius: 6px;
  color: #4CAF50;
  cursor: pointer;
  flex-shrink: 0;
}

.page-title-back-button:hover {
  background: #4CAF50;
  border-color: #4CAF50;
  color: #ffffff;
}
