/* ============================================================
   Quintara Service — 登入／預訂／後台頁共用樣式
   ============================================================ */

/* ---------- 登入頁 ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: var(--navy); }
.auth-card {
  width: min(420px, 100%); background: var(--surface); border-radius: var(--radius);
  padding: 2.6rem 2.4rem; box-shadow: var(--shadow-lg);
}
.auth-card .brand { margin-bottom: 1.5rem; }
.auth-card h1 { font-size: 1.6rem; font-weight: 900; }
.auth-sub { color: var(--ink-soft); font-size: 0.92rem; margin: 0.4rem 0 1.6rem; }
.auth-foot { margin-top: 1.2rem; text-align: center; font-size: 0.9rem; color: var(--ink-soft); }
.auth-foot a { color: var(--primary); font-weight: 700; }

/* ---------- 頁首標題 ---------- */
.page-head { margin-bottom: 2rem; }
.page-title { font-size: 1.9rem; font-weight: 900; }
.page-sub { color: var(--ink-soft); margin-top: 0.3rem; }

/* ---------- 日期選擇 ---------- */
.date-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.date-bar label { font-weight: 700; }
.date-bar input[type="date"] {
  padding: 0.55rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.98rem; color: var(--ink); background: #fff;
}
.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-soft); margin-left: auto; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend .lg-free { background: #eaf6f2; border: 1px solid #bcded4; }
.legend .lg-booked { background: #eceff4; border: 1px solid #cfd6e0; }
.legend .lg-mine { background: var(--primary-soft); border: 1px solid var(--primary); }
.legend .lg-past { background: #f3f1ee; border: 1px solid #e2ded7; }

/* ---------- 時段表 ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid-table { border-collapse: collapse; width: 100%; min-width: 480px; }
.grid-table th, .grid-table td { padding: 0.6rem; text-align: center; border: 1px solid var(--line); }
.grid-table thead th { background: var(--navy); color: #fff; font-weight: 700; }
.grid-table .hour-col { background: var(--bg-alt); font-weight: 700; color: var(--ink-soft); white-space: nowrap; width: 70px; position: sticky; left: 0; z-index: 1; }
.cell { cursor: pointer; user-select: none; transition: background 0.15s ease; font-size: 0.85rem; }
.cell.free { background: #eaf6f2; color: transparent; }
.cell.free:hover { background: #cfe9df; }
.cell.booked { background: #eceff4; color: #9aa2b1; cursor: not-allowed; }
.cell.mine { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.cell.past { background: #f3f1ee; color: #c6c1b8; cursor: not-allowed; }
.cell.selected { background: var(--primary); color: #fff; font-weight: 700; }

/* ---------- 確認面板 ---------- */
.confirm-panel {
  margin-top: 1.4rem; padding: 1.4rem; background: var(--surface);
  border: 1px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow);
}
.confirm-panel strong { color: var(--primary); }
.confirm-actions { display: flex; gap: 0.8rem; margin-top: 0.9rem; }

/* ---------- 我的預訂 / 資料表 ---------- */
.my-bookings { margin-top: 2.5rem; }
.my-bookings h2, .panel h2 { font-size: 1.3rem; font-weight: 900; margin-bottom: 1rem; }
.booking-list { display: grid; gap: 0.8rem; }
.booking-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.2rem;
}
.booking-item .bi-main strong { font-size: 1.05rem; }
.booking-item .bi-main span { color: var(--ink-soft); font-size: 0.9rem; }
.empty { color: var(--ink-soft); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 1.6rem; text-align: center; }

/* ---------- 後台分頁 ---------- */
.tabs { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--line); margin-bottom: 1.6rem; flex-wrap: wrap; }
.tab {
  padding: 0.6rem 1.2rem; font-weight: 700; color: var(--ink-soft); cursor: pointer;
  border: 0; background: none; font-family: inherit; font-size: 0.98rem;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.panel { background: var(--surface); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); margin-bottom: 1.6rem; }
.panel h3 { font-size: 1.1rem; font-weight: 900; margin-bottom: 1rem; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 0.65rem 0.8rem; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.data-table th { color: var(--ink-soft); font-weight: 700; }
.data-table .role-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.role-admin { background: var(--primary-soft); color: var(--primary-dark); }
.role-member { background: #eef1f6; color: #4a5266; }
.row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* 建立表單（後台） */
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; align-items: end; }
.inline-form .form-group { margin-bottom: 0; }

/* ---------- 週曆 ---------- */
.week-bar { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.week-label { font-weight: 700; font-size: 1.05rem; min-width: 170px; text-align: center; }
.week-table { border-collapse: collapse; width: 100%; min-width: 760px; }
.week-table th, .week-table td { border: 1px solid var(--line); text-align: center; vertical-align: top; }
.week-table thead th { background: var(--navy); color: #fff; padding: 0.6rem 0.4rem; }
.week-table .room-col { background: var(--bg-alt); color: var(--ink-soft); font-weight: 700; width: 120px; position: sticky; left: 0; z-index: 1; }
.room-cap { display: block; font-size: 0.75rem; font-weight: 500; color: var(--ink-soft); }
.week-table .day-head { display: flex; flex-direction: column; gap: 0.1rem; }
.week-table .day-head .wd { font-size: 0.85rem; font-weight: 700; }
.week-table .day-head .dt { font-size: 0.75rem; color: rgba(255, 255, 255, 0.72); }
.week-table .day-head.today { background: var(--primary); }
.day-cell { padding: 0.6rem; min-height: 96px; cursor: pointer; transition: background 0.15s ease; }
.day-cell:hover { background: #fdf4e6; }
.day-cell.past { background: #f3f1ee; cursor: not-allowed; }
.slots { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.5rem; }
.slot { display: block; font-size: 0.78rem; padding: 0.15rem 0.3rem; border-radius: 6px; }
.slot.booked { background: #eceff4; color: #7a8292; }
.slot.mine { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.slot.none { background: #eaf6f2; color: #4a9c86; }
.book-hint { font-size: 0.78rem; color: var(--primary); font-weight: 700; }
.day-cell.past .book-hint { color: #c6c1b8; }

/* ---------- 日期分頁 ---------- */
.day-tabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.5rem; margin-bottom: 1rem; }
.day-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
  min-height: 60px; padding: 0.5rem 0.25rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-family: inherit; transition: all 0.15s ease;
}
.day-tab .wd { font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.day-tab .dt { font-size: 0.75rem; color: var(--ink-soft); }
.day-tab .today-pill { font-size: 0.62rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 0 0.4rem; border-radius: 999px; line-height: 1.5; }
.day-tab:hover { border-color: var(--primary); }
.day-tab.active { background: var(--navy); border-color: var(--navy); }
.day-tab.active .wd { color: #fff; }
.day-tab.active .dt { color: rgba(255, 255, 255, 0.72); }
.day-tab.active .today-pill { background: rgba(255, 255, 255, 0.2); color: #f0d9a8; }
.day-tab.past { opacity: 0.55; }

/* ---------- 預訂彈窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(13, 54, 116, 0.5); display: grid; place-items: center; z-index: 200; padding: 1.5rem; }
.modal[hidden] { display: none; }
.modal-box { position: relative; width: min(520px, 100%); background: var(--surface); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 0.8rem; right: 0.8rem; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink-soft); }
.modal-box h3 { font-size: 1.3rem; font-weight: 900; }
.modal-sub { color: var(--ink-soft); font-size: 0.92rem; margin: 0.3rem 0 1rem; }
.hour-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 0.5rem; }
.hour-chip { padding: 0.55rem 0.4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); font-family: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer; color: var(--ink); }
.hour-chip.free { background: #eaf6f2; border-color: #bcded4; }
.hour-chip.free:hover { background: #cfe9df; }
.hour-chip.booked { background: #eceff4; color: #9aa2b1; cursor: not-allowed; }
.hour-chip.past { background: #f3f1ee; color: #c6c1b8; cursor: not-allowed; }
.hour-chip.sel-start { background: var(--primary); color: #fff; border-color: var(--primary); }
.hour-chip.sel-range { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.hour-hint { margin-top: 0.8rem; font-size: 0.9rem; color: var(--primary-dark); font-weight: 700; min-height: 1.4em; }

/* ---------- 雙擊預訂彈窗 ---------- */
.bk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.8rem; margin-top: 0.4rem; }

/* 時段矩形（rowspan 預訂格） */
.grid-table td { height: 44px; vertical-align: middle; }
.cell.booking { cursor: default; padding: 0.3rem 0.5rem; }
.cell.booking .bk-title { display: block; font-weight: 700; font-size: 0.85rem; line-height: 1.3; }
.cell.booking .bk-meta { display: block; font-size: 0.72rem; opacity: 0.75; }
.cell.booking.mine { background: var(--primary-soft); color: var(--primary-dark); }
.cell.booking.booked { background: #eceff4; color: #9aa2b1; }

/* ---------- 響應式 ---------- */
@media (max-width: 640px) {
  .date-bar { gap: 0.6rem; }
  .legend { margin-left: 0; }
  .app-header-inner { height: 56px; }
  .inline-form { grid-template-columns: 1fr; }
  .panel { overflow-x: auto; }
  .data-table { min-width: 520px; }
  .confirm-actions { flex-direction: column; }
  .day-tab { min-height: 54px; padding: 0.4rem 0.12rem; }
  .day-tab .wd { font-size: 0.75rem; }
  .day-tab .dt { font-size: 0.66rem; }
}
