/* common.css */

/* 色の変数を定義 */
:root {
  --main-bg-color: #f8f9fa; /* 全体の背景色: よりニュートラルな色に */
  --container-bg-color: #ffffff; /* コンテンツエリアの背景色: 白 */
  --primary-color: #609966; /* メインカラー: 落ち着いた緑 */
  --primary-dark-color: #6b8065; /* ダークカラー: 濃い緑 */
  --primary-light-color: #9dc08b; /* ライトカラー: 明るい緑 */
  --accent-color: #edf1d6; /* アクセントカラー: 淡い黄色がかった緑 */
  --text-color: #333333; /* 基本テキストカラー */
  --text-light-color: #ffffff; /* 明るいテキストカラー */
  --border-color: #e0e0e0; /* 境界線 */
  --header-bg-color: #eef5ee; /* ヘッダー背景 */
  --button-secondary-bg-color: #f0f0f0;
  --button-secondary-hover-bg-color: #e0e0e0;
  --status-off-bg: #fbebeb; /* 退勤中などの背景 */
  --status-off-text: #9a3e3e;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* 全体のスタイル */
body {
  font-family:
    "Helvetica Neue", "Arial", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Meiryo", sans-serif;
  margin: 0;
  background-color: var(--main-bg-color);
  color: var(--text-color);
  font-size: 20px;
}

main {
  max-width: 1800px;
  margin: 0 auto;
}

/* コンテナ */
.page-container {
  background-color: var(--container-bg-color);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

/* ヘッダー */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--header-bg-color);
  padding: 15px;
  margin: -20px -20px 20px -20px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  /* スクロール時にヘッダーを画面上部に固定する */
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm); /* 固定時に影を追加 */
}

h1 {
  margin: 0;
  font-size: 1.8em;
  color: var(--primary-dark-color);
}

h2 {
  color: var(--primary-dark-color);
  border-bottom: 2px solid var(--primary-light-color);
  padding-bottom: 8px;
  margin-top: 25px;
  margin-bottom: 15px;
}

h3 {
  color: var(--primary-dark-color);
}

/* ボタン */
button,
.crud-action-btn {
  background-color: var(--primary-color);
  color: var(--text-light-color);
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: all 0.2s ease-in-out;
  text-decoration: none; /* リンクの下線を消す */
  box-shadow: var(--shadow-sm);
}

/* ボタン内のSVGアイコンのスタイル */
button svg,
.crud-action-btn svg {
  vertical-align: middle;
  margin-right: 5px;
}
button:not(.task-button):hover,
.crud-action-btn:hover {
  background-color: var(--primary-dark-color);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* 戻るボタンなど */
#back-to-list-button,
#back-to-dashboard-from-seat-map-btn,
#back-to-dashboard-from-seat-config-btn,
#back-to-dashboard-from-employee-crud-btn,
#back-to-employee-crud-from-add-btn,
#back-to-employee-crud-from-edit-btn,
#back-to-dashboard-from-task-crud-btn {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}
#back-to-list-button:hover,
#back-to-dashboard-from-seat-map-btn:hover,
#back-to-dashboard-from-seat-config-btn:hover,
#back-to-dashboard-from-employee-crud-btn:hover,
#back-to-employee-crud-from-add-btn:hover,
#back-to-employee-crud-from-edit-btn:hover,
#back-to-dashboard-from-task-crud-btn:hover {
  background-color: var(--accent-color);
}

/* 戻るボタンの共通スタイル */
.back-button {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  text-decoration: none;
}
.back-button:hover {
  background-color: var(--accent-color);
}

/* セカンダリボタン (CSVインポートなど) */
.crud-action-btn.secondary {
  background-color: var(--button-secondary-bg-color);
  color: var(--text-color);
  border: 1px solid #ccc;
}

.crud-action-btn.secondary:hover {
  background-color: var(--button-secondary-hover-bg-color);
}

/* ヘッダー右側のボタングループ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* フォーム要素 */
input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
input[type="color"],
textarea,
select {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1em;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--accent-color);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--primary-dark-color);
}

/* リスト */
.employee-list-ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.employee-list-ul li {
  padding: 18px 15px; /* 上下の余白を広げて行の高さを調整 */
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.employee-list-ul li:hover {
  background-color: var(--accent-color);
}

.employee-list-ul li:last-child {
  border-bottom: none;
}

/* ステータス表示 */
.status-text {
  font-weight: bold;
  padding: 5px 10px;
  border-radius: 15px;
  background-color: var(--status-off-bg);
  color: var(--status-off-text);
}

.status-text.working {
  background-color: var(--primary-light-color);
  color: var(--primary-dark-color);
}

/* テーブル */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

th,
td {
  border: 1px solid var(--border-color);
  padding: 12px;
  text-align: left;
}

thead {
  background-color: var(--header-bg-color);
}

th {
  color: var(--primary-dark-color);
  font-weight: bold;
}

tbody tr:nth-child(even) {
  background-color: #fcfdfc;
}

tbody tr:hover {
  background-color: var(--accent-color);
}

/* その他 */
.hidden {
  display: none !important;
}

/* 印刷時に非表示にするためのクラス */
.hidden-on-screen {
  display: none !important;
}

.crud-action-btn.danger {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}
.crud-action-btn.danger:hover {
  background-color: #f1b0b7;
}

.danger-link {
  color: #dc3545 !important;
  font-weight: bold;
}

.danger-link:hover {
  background-color: #f8d7da;
  color: #721c24 !important;
}

.scrollable-content {
  max-height: 650px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 5px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 20px 0;
}

/* 汎用カードスタイル */
.card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: var(--shadow-sm);
}

.seat-box.unusable {
  background-color: #e9ecef;
  background-image: repeating-linear-gradient(
    45deg,
    #ced4da,
    #ced4da 5px,
    transparent 5px,
    transparent 10px
  );
}

/* モーダル */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--container-bg-color);
  padding: 25px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}

.close-button:hover {
  color: #333;
}

#notification-message {
  font-size: 1.2em;
  margin: 20px 0;
}

/* 座席表用モーダル風コンテナ */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 90%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.modal-container.show {
  opacity: 1;
}

/* 座席表セクションのスタイル調整 */
#staff-seat-map-section {
  display: flex;
  flex-direction: column;
  background-color: var(--container-bg-color);
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 1200px; /* 座席表の最大幅を調整 */
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.3s ease-in-out;
  font-size: large;
}

.seat-map-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* flexアイテムの縮小を許可 */
}

#staff-seat-map-grid {
  flex-grow: 1; /* 利用可能なスペースを埋める */
  overflow-y: auto; /* 内容が多ければスクロール */
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.seat-map-actions {
  margin-top: 15px;
}

.modal-container.show #staff-seat-map-section {
  transform: scale(1);
}

.site-header {
  background-color: var(--primary-dark-color);
  padding: 0 20px;
  color: var(--text-light-color);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  height: 50px; /* ヘッダーの高さを固定 */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* WordPress管理バーが表示されている場合の調整 */
body.logged-in .site-header {
  top: 32px;
}

/* ヘッダーの高さ分、メインコンテンツの開始位置を調整 */
body {
  padding-top: 50px;
}

body.logged-in {
  padding-top: 82px; /* 50px (ヘッダー) + 32px (管理バー) */
}

.main-navigation ul#primary-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.main-navigation .menu-item {
  margin: 0;
}

.main-navigation .menu-item a {
  color: var(--text-light-color);
  text-decoration: none;
  padding: 15px 20px;
  display: block;
  transition: background-color 0.2s ease-in-out;
}

.main-navigation .menu-item a:hover,
.main-navigation .menu-item.current-menu-item > a,
.main-navigation .menu-item.current-menu-ancestor > a {
  background-color: var(--primary-color);
  color: var(--text-light-color);
}

/* Site Branding */
.site-branding {
  display: flex;
  align-items: center;
}

.custom-logo-link {
  margin-right: 15px;
  line-height: 0; /* 画像下の余分なスペースを削除 */
}

.custom-logo {
  max-height: 40px; /* ロゴの高さをヘッダーに合わせて調整 */
  width: auto;
}

.site-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: bold;
}

.site-title a {
  color: var(--text-light-color);
  text-decoration: none;
}

/* --------------------------------------------------------------
## Print Styles
-------------------------------------------------------------- */
@media print {
  body {
    padding-top: 0 !important;
    background-color: #fff;
    font-size: 12px; /* 印刷用にフォントサイズを調整 */
  }

  .site-header,
  .app-sidebar,
  .admin-override-section,
  .controls,
  .manual-seat-assignment,
  .history-filters,
  .history-actions,
  #history-table .edit-record-btn,
  #history-table .delete-record-btn,
  #history-table .save-record-btn,
  #history-table .cancel-edit-btn {
    display: none !important;
  }

  .app-wrapper,
  .content-area,
  #page,
  #content,
  .page-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none;
    border: none;
  }
}

/*--------------------------------------------------------------
## App Sidebar Menu (Button Style)
--------------------------------------------------------------*/
.app-sidebar .main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 10px;
}

.app-sidebar .main-navigation .menu-item a {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  color: #3c434a; /* 少し濃いめのテキストカラー */
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 5px;
  transition: all 0.2s ease-in-out;
  font-weight: 500;
}

.app-sidebar .main-navigation .menu-item a:hover {
  background-color: var(--accent-color);
  color: var(--primary-dark-color);
}

.app-sidebar .main-navigation .menu-item.current-menu-item > a,
.app-sidebar .main-navigation .menu-item.current-menu-ancestor > a {
  background-color: var(--primary-color);
  color: var(--text-light-color);
  font-weight: bold;
  box-shadow: var(--shadow-sm);
}
