/* ===== タスク一覧画面 ===== */
/* ページ全体のレイアウト */
body {
  font-family: Arial, sans-serif;
  margin: 40px auto;
  background: #f5f5f5;
  padding: 16px;
}

/* アプリ全体のコンテナ */
.container {
  width: 90%;
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
}

/* ヘッダー全体 */
.top-bar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

/* タイトル（中央固定） */
.top-bar h1 {
  margin: 0;
}

/* ログアウトボタン（右上固定） */
#logoutBtn {
  position: absolute;
  right: 0;
  top: 0;
}

/* 入力フォームエリア */
.form-area {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* 入力欄（フォーム専用に限定） */
.form-area input {
  width: 70%;
  padding: 10px;
  font-size: 16px;
}

/* ボタン共通スタイル（グローバルではなく制御） */
.form-area button,
.auth-container button,
.task-actions button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

/* ホバー */
.form-area button:hover,
.auth-container button:hover {
  background: #1d4ed8;
}

button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* ===== タスクカード ===== */
.task-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;

  display: flex;
  flex-direction: column;
  align-items: stretch;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ヘッダー（チェック + タイトル） */
.task-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* チェックボックス（安定版） */
.task-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* タスクタイトル */
.task-title {
  font-size: 16px;
  font-weight: bold;
  overflow-wrap: break-word;
}

/* 作成日時 */
.task-created {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

/* 完了状態 */
.task-completed {
  opacity: 0.6;
  text-decoration: line-through;
}

/* 状態ラベル */
.status {
  font-weight: bold;
}

.completed {
  color: green;
}

.pending {
  color: red;
}

/* ボタンエリア */
.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* 編集・削除 */
.btn-edit {
  background: #2563eb;
}

.btn-edit:hover {
  background: #1d4ed8;
}

.task-actions .btn-delete {
  background: #dc2626;
}

.task-actions .btn-delete:hover {
  background: #b91c1c;
}

/* 状態UI */
.hidden {
  display: none;
}

.loading {
  margin: 10px 0;
  padding: 10px;
  background: #f0f0f0;
  border-radius: 6px;
  font-size: 14px;
}

.error {
  margin: 10px 0;
  padding: 10px;
  background: #ffe0e0;
  color: #b00020;
  border-radius: 6px;
  font-size: 14px;
}

/* ===== ログイン画面 ===== */
.auth-container {
  width: 350px;
  margin: 100px auto;
}

.auth-container h1 {
  text-align: center;
}

.auth-container input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

/* リンク */
a {
  color: #007bff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== スマホ対応 ===== */
@media (max-width: 768px) {
  .form-area {
    flex-direction: column;
  }

  .form-area input {
    width: 100%;
  }

  .form-area button {
    width: 100%;
  }
}
