/**
 * admin.css — 台北通後台自訂樣式
 * Bootstrap 5.3.8 底層，本地化載入
 */

/* ── 根變數 ─────────────────────────────────────── */
:root {
    --tp-sidebar-width: 260px;
    --tp-sidebar-bg: #1a2236;
    --tp-sidebar-text: #c8d0e0;
    --tp-sidebar-active: #4f8ef7;
    --tp-topbar-height: 58px;
    --tp-primary: #4f8ef7;
    --tp-body-bg: #f0f2f5;
}

/* ── 整體 ────────────────────────────────────────── */
body {
    background-color: var(--tp-body-bg);
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    font-size: 0.9rem;
}

input[type="radio"] {
    border: 1px solid #c0c0c0;
}

/* ── 側邊欄 ─────────────────────────────────────── */
#sidebar {
    width: var(--tp-sidebar-width);
    height: 100vh;
    background: var(--tp-sidebar-bg);
    color: var(--tp-sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
    overflow: hidden;
}

#sidebar ul.nav {
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 1;
    min-height: 0;       /* flex child 必須設此值才能觸發 overflow 捲動 */
    flex-wrap: nowrap;   /* 防止 Bootstrap .nav 預設 flex-wrap:wrap 把項目折到第二欄 */
    scrollbar-width: none;        /* Firefox：完全隱藏捲軸 */
    -ms-overflow-style: none;     /* IE / Edge */
}
/* Chrome / Safari：完全隱藏捲軸 */
#sidebar ul.nav::-webkit-scrollbar {
    display: none;
}

#sidebar .sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
}

#sidebar .nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    padding: .75rem 1.5rem .25rem;
}

#sidebar .nav-link {
    color: var(--tp-sidebar-text);
    padding: .55rem 1.5rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    transition: background .15s, color .15s;
    font-size: .88rem;
}

#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background: rgba(79, 142, 247, .12);
    color: #fff;
}

#sidebar .nav-link.active {
    border-left: 3px solid var(--tp-sidebar-active);
    padding-left: calc(1.5rem - 3px);
    color: #fff;
    font-weight: 600;
}

#sidebar .nav-link i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
    opacity: .75;
}

#sidebar .nav-link.active i,
#sidebar .nav-link:hover i {
    opacity: 1;
}

/* ── 頂部導覽 ───────────────────────────────────── */
#topbar {
    height: var(--tp-topbar-height);
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    position: fixed;
    top: 0;
    left: var(--tp-sidebar-width);
    right: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

/* ── 主內容區 ────────────────────────────────────── */
#main-content {
    margin-left: var(--tp-sidebar-width);
    margin-top: var(--tp-topbar-height);
    padding: 1.75rem;
    min-height: calc(100vh - var(--tp-topbar-height));
}
/* 大於 lg 時讓內容區推開側欄 */
@media (min-width: 992px) {
    #page-content-wrapper {
        margin-left: var(--tp-sidebar-width);
    }
}

/* ── 統計卡片 ────────────────────────────────────── */
.stat-card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.stat-card .icon-box {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

/* ── DataTables 自訂 ─────────────────────────────── */
table.dataTable > thead > tr > th {
    font-weight: 600;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: .3rem .75rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: .25rem .5rem;
}

/* ── 卡片 ────────────────────────────────────────── */
.card {
    border-radius: 10px;
}

.card-header {
    border-bottom: 1px solid rgba(0,0,0,.06);
}

/* ── 按鈕 ────────────────────────────────────────── */
.btn-primary {
    background-color: var(--tp-primary);
    border-color: var(--tp-primary);
}

.btn-primary:hover {
    background-color: #3a75e0;
    border-color: #3a75e0;
}

/* ── Badge ──────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: .75rem;
    letter-spacing: .01em;
}

/* ── Flash 訊息 ─────────────────────────────────── */
#flash-container {
    position: fixed;
    top: calc(var(--tp-topbar-height) + .75rem);
    right: 1.25rem;
    z-index: 9999;
    max-width: 360px;
}

/* ── 刪除確認按鈕游標 ────────────────────────────── */
.btn-delete { cursor: pointer; }

/* ── 側邊欄使用者資訊 ────────────────────────────── */
.sidebar-user {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.06);
    margin-top: auto;
    font-size: .8rem;
    color: rgba(255,255,255,.5);
}

.sidebar-user strong {
    color: rgba(255,255,255,.85);
    display: block;
    font-size: .88rem;
}

/* ── 行動版側欄遮罩 ─────────────────────────────── */
#sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1040;
    cursor: pointer;
}
#sidebar-backdrop.show {
    display: block;
}
body.sidebar-open {
    overflow: hidden;
}

/* Loading overlay（AJAX 全域遮罩）────────────────────── */
#loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
#loading-overlay.active { display: flex; }

/* ── 響應式 ─────────────────────────────────────── */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
        z-index: 1045;
        height: 100%;
    }
    #sidebar.show {
        transform: translateX(0);
    }
    #page-content-wrapper {
        margin-left: 0;
    }
}
