/* ===== 全站基本 ===== */
body {
  font-family: system-ui, sans-serif;
  max-width: 720px;
  margin: 40px auto;
  padding: 0 20px;
  line-height: 1.7;
  background: #f7f7f5;
  color: #333;
}

h1 {
  color: #c0392b;
  padding-bottom: 8px;
}

a {
  color: #2c7be5;
}

/* hidden 屬性一定要隱藏 */
[hidden] {
  display: none !important;
}

.note {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #888;
}

.empty {
  color: #888;
}

/* ===== 左上：漢堡按鈕 ===== */
.menu-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  z-index: 1001;
}

.menu-btn span {
  display: block;
  height: 3px;
  background: #333;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.menu-btn.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.menu-btn.open span:nth-child(2) { opacity: 0; }
.menu-btn.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ===== 右上：登入按鈕 ===== */
.login-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 8px 20px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: bold;
  z-index: 1001;
  transition: background 0.2s;
}

.login-btn:hover {
  background: #a93226;
}

/* ===== 側邊選單（從左邊滑出） ===== */
.menu {
  position: fixed;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: 240px;
  height: 100vh;
  padding: 80px 24px;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  transform: translateX(-100%);
  transition: transform 0.3s;
  z-index: 1000;
}

.menu.open {
  transform: translateX(0);
}

.menu a {
  color: #333;
  text-decoration: none;
  font-size: 1.1rem;
}

.menu a:hover {
  color: #c0392b;
}

.menu .sub {
  padding-left: 16px;
  font-size: 0.95rem;
}

.menu .menu-title {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
  font-size: 0.85rem;
  font-weight: bold;
  color: #999;
  cursor: default;
}

/* ===== 依登入狀態顯示 ===== */
.member-only {
  display: none !important;
}

.logged-in .member-only {
  display: block !important;
}

.admin-only {
  display: none !important;
}

.is-admin .admin-only {
  display: block !important;
}

/* 確認登入／管理者身分前先隱藏 */
body[data-protected]:not(.auth-checked),
body[data-admin]:not(.auth-checked) {
  visibility: hidden;
}

/* ===== 共用排版與按鈕 ===== */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.submit-btn {
  padding: 8px 24px;
  background: #c0392b;
  color: #fff;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

.submit-btn:disabled {
  background: #ccc;
  cursor: default;
}

.sub-btn {
  padding: 2px 10px;
  background: #fff;
  color: #333;
  border: 1px solid #999;
  cursor: pointer;
}

.cancel-btn {
  margin-left: 8px;
  padding: 2px 10px;
  background: #fff;
  color: #c0392b;
  border: 1px solid #c0392b;
  cursor: pointer;
}

/* ===== 切換按鈕（種類、清單） ===== */
.switch {
  display: flex;
  margin: 8px 0;
}

.switch button {
  flex: 1;
  padding: 8px;
  background: #fff;
  border: 1px solid #ccc;
  cursor: pointer;
}

.switch button + button {
  border-left: none;
}

.switch button.active {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

.switch button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== 登入表單 ===== */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px;
}

.login-form input {
  padding: 10px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

.login-form button {
  padding: 10px;
  background: #c0392b;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

.login-form button:hover {
  background: #a93226;
}

/* ===== 單列表單（輸入框＋按鈕） ===== */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-form input {
  flex: 1;
  min-width: 140px;
  padding: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

.inline-form button {
  padding: 6px 14px;
  background: #c0392b;
  color: #fff;
  border: none;
  cursor: pointer;
}