/* ================================================
   安居管理系統 — 全域自訂樣式
   Bootstrap 5 + 自訂補充
   ================================================ */

/* ── 側邊欄 ─────────────────────────────────── */
#sidebarCollapse {
  min-height: calc(100vh - 56px); /* 56px = navbar 高度 */
}

#sidebarCollapse .nav-link {
  border-radius: 0.375rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

#sidebarCollapse .nav-link.active {
  background-color: rgba(13, 110, 253, 0.1);
}

/* ── 行動版側邊欄（Drawer 滑入） ──────────────── */
@media (max-width: 767.98px) {
  #sidebarCollapse {
    display: none;
    position: fixed !important;
    top: 56px;
    left: 0;
    z-index: 1045;
    width: 80%;
    max-width: 280px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    min-height: unset;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
  }
  #sidebarCollapse.show {
    display: block !important;
  }
}

/* ── 主內容區 ────────────────────────────────── */
main {
  min-height: calc(100vh - 56px);
}

/* ── 表格 ────────────────────────────────────── */
.table th {
  white-space: nowrap;
  font-size: 0.85rem;
  background-color: #f8f9fa;
}

.table td {
  vertical-align: middle;
  font-size: 0.875rem;
}

/* ── 操作按鈕群組（表格內） ──────────────────── */
.btn-action {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
}

/* ── Badge 狀態 ─────────────────────────────── */
.badge-active   { background-color: #198754; }
.badge-inactive { background-color: #6c757d; }
.badge-overdue  { background-color: #dc3545; }
.badge-pending  { background-color: #fd7e14; }

/* ── 卡片統計（儀表板） ─────────────────────── */
.stat-card {
  border-left: 4px solid;
  border-radius: 0.375rem;
}

.stat-card.primary  { border-color: #0d6efd; }
.stat-card.success  { border-color: #198754; }
.stat-card.warning  { border-color: #ffc107; }
.stat-card.danger   { border-color: #dc3545; }

/* ── 響應式字體 ─────────────────────────────── */
@media (max-width: 767.98px) {
  h1.h3 { font-size: 1.2rem; }
  .table { font-size: 0.8rem; }
}
/* ── 導覽列 Dropdown 定位修正 ─────────────────────
   Bootstrap 5 的 dropdown-menu-end 需 [data-bs-popper]
   屬性才套用 right:0，但自訂 JS 不呼叫 Popper，故在此
   直接指定正確定位，z-index 1051 高於 sticky navbar 的 1020
   ────────────────────────────────────────────────── */
.navbar .dropdown-menu.show {
  display: block;
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  z-index: 1051;
  min-width: 15rem;
  margin-top: 2px;
}