@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap");

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Noto Sans JP", sans-serif;
  background-color: #f4f6f8;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

/* ログインコンテナ */
#login-container {
  background-color: white;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 360px;
  box-sizing: border-box;
  text-align: center;
}

/* タイトル */
#login-container h2 {
  margin-bottom: 0.3rem;
  font-size: 1.8rem;
  color: #333;
}

.login-sub {
  font-size: 0.95rem;
  color: #777;
  margin-bottom: 1.5rem;
}

/* 入力欄 */
#login-container input {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  box-sizing: border-box;
}

/* ログインボタン */
#login-container button {
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
  background-color: #2d89ef;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

#login-container button:hover {
  background-color: #1a66cc;
}

/* エラーメッセージ */
.error-message {
  color: #d00;
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* メインカード */
#converter {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  width: 100%;
  max-width: 360px; /* PCなどで広がりすぎないように制限 */
  box-sizing: border-box;
  overflow-x: auto;
}

/* 時間 */
#time {
  font-size: 3rem;
  font-weight: bold;
  margin: 1rem 0;
  font-family: "Courier New", Courier, monospace;
  font-variant-numeric: tabular-nums;
  min-width: 6ch;
  display: inline-block;
}

/* ユーザー名 */
#display-username {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: #333;
}

/* メモ欄 */
#memo {
  width: 100%;
  padding: 0.6rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  box-sizing: border-box;
  margin-bottom: 1rem;
}

/* ボタン類 */
#button {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#button button {
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 0.5rem;
  background-color: #2d89ef;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

#button button:hover {
  background-color: #1a66cc;
}

/* ボタンが無効なときの見た目 */
#button button:disabled {
  background-color: #ccc; /* グレーに */
  color: #888; /* 薄い文字色 */
  cursor: not-allowed; /* カーソル変化 */
  opacity: 0.7; /* 少し透ける */
}

#button button:disabled:hover {
  background-color: #ccc; /* hoverでも色変わらないように */
}

.link-button {
  background: none;
  color: #666;
  border: none;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin: 0 0.5rem;
}

.link-button:hover {
  color: #000;
}

.link-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* バージョン */
#version {
  font-size: 0.75rem;
  color: #999;
  margin-top: 1rem;
}

/* トースト通知の基本スタイル */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: #323232;
  color: white;
  padding: 0.75rem 1.2rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, bottom 0.3s ease;
  z-index: 9999;
}

#toast.show {
  opacity: 1;
  bottom: 2.5rem;
}

/* ローディング中のボタンスタイル */
#button button.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

#button button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1em;
  height: 1em;
  margin: -0.5em 0 0 -0.5em;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* 打刻一覧コンテナ */
#attendance-list-container {
  max-width: 100%;
}

/* テーブルラッパー - 横スクロール対応 */
#attendance-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch; /* 慣性スクロール（iOS等） */
}

#attendance-table-wrapper table {
  border-collapse: collapse;
  width: auto; /* 内容に応じて横幅を拡張 */
  min-width: 100%; /* ラッパー幅より小さくならない */
  margin-top: 0.5rem;
  table-layout: auto; /* メモ列が自動幅で伸縮できるように */
}

#attendance-table-wrapper th,
#attendance-table-wrapper td {
  border: 1px solid #ddd;
  padding: 0.3rem;
  text-align: center;
}

/* 日付列 */
#attendance-table-wrapper th:nth-child(1),
#attendance-table-wrapper td:nth-child(1) {
  width: 75px;
}

/* 時刻列 */
#attendance-table-wrapper th:nth-child(2),
#attendance-table-wrapper td:nth-child(2) {
  width: 50px;
}

/* 区分列 */
#attendance-table-wrapper th:nth-child(3),
#attendance-table-wrapper td:nth-child(3) {
  width: 45px;
}

/* メモ列 - 左寄せ・自動幅 */
#attendance-table-wrapper th:nth-child(4),
#attendance-table-wrapper td:nth-child(4) {
  text-align: left;
  width: auto;
  white-space: nowrap;
}

#attendance-table-wrapper th {
  background-color: #f0f0f0;
  font-weight: bold;
}

/* 一覧表示ボタン（セカンダリボタン） */
.secondary-button {
  background-color: #e0e0e0;
  color: #333;
  border: none;
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background-color 0.2s;
}

.secondary-button:hover {
  background-color: #d0d0d0;
}

/* フィルター行の共通設定 */
.filter-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.filter-row label {
  width: 60px;
  font-weight: bold;
}

.filter-row input[type="text"],
.filter-row input[type="date"],
.filter-row select {
  width: 120px;
  flex: unset;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  border: 1px solid #ccc;
  border-radius: 0.3rem;
  box-sizing: border-box;
}

/* 通常状態 */
#prev-page,
#next-page,
#export {
  background-color: #1976d2;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 1;
  transition: background 0.2s, opacity 0.2s;
}

/* 押せない（disabled）状態 */
#prev-page:disabled,
#next-page:disabled,
#export:disabled {
  background-color: #bdbdbd;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 読み込み中のボタン見た目 */
#prev-page.loading,
#next-page.loading,
#export.loading {
  position: relative;
  opacity: 0.8;
}

#prev-page.loading::after,
#next-page.loading::after,
#export.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1em;
  height: 1em;
  margin: -0.5em 0 0 -0.5em;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
}

#export {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#password-change,
#password-cancel {
  margin-top: 8px;
}

/* ローディングオーバーレイ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(2px);
}

.loading-overlay.show {
  display: flex;
}

.loading-overlay .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

.loading-overlay p {
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  margin: 0;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
