/* ============================================================================
   Bootstrap 表格樣式相容層 (Bootstrap Table Compatibility Layer)
   ============================================================================
   用於 Tailwind CSS 環境中重現 Bootstrap 5.3 表格樣式
   Created: 2025-12-17
   Purpose: 確保表格在移除 Bootstrap CSS 後保持視覺一致性
   ============================================================================ */

/* 基礎表格樣式 */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    vertical-align: top;
    border-color: #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
}

.table tbody td {
    border-bottom-width: 1px;
}

.table> :not(caption)>*>* {
    padding: 0.5rem 0.5rem;
    background-color: var(--bs-table-bg);
    border-bottom-width: 1px;
    box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);
}

.table>tbody {
    vertical-align: inherit;
}

.table>thead {
    vertical-align: bottom;
}

/* 條紋樣式 */
.table-striped>tbody>tr:nth-of-type(odd)>* {
    --bs-table-accent-bg: rgba(0, 0, 0, 0.05);
}

/* Hover 效果 */
.table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: rgba(0, 0, 0, 0.075);
}

/* 淺色表頭 */
.table-light {
    --bs-table-bg: #f8f9fa;
    --bs-table-striped-bg: #ecedee;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #dfe0e1;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #e5e6e7;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #c8c9ca;
}

/* 深色表頭 */
.table-dark {
    --bs-table-bg: #212529;
    --bs-table-striped-bg: #2c3034;
    --bs-table-striped-color: #fff;
    --bs-table-active-bg: #373b3e;
    --bs-table-active-color: #fff;
    --bs-table-hover-bg: #323539;
    --bs-table-hover-color: #fff;
    color: #fff;
    border-color: #373b3e;
}

/* 響應式表格容器 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 邊框樣式 */
.table-bordered> :not(caption)>* {
    border-width: 1px 0;
}

.table-bordered> :not(caption)>*>* {
    border-width: 0 1px;
}

.table-borderless> :not(caption)>*>* {
    border-bottom-width: 0;
}

/* 緊湊表格 */
.table-sm> :not(caption)>*>* {
    padding: 0.25rem 0.25rem;
}

/* 表格對齊 */
.align-middle {
    vertical-align: middle !important;
}

/* Bootstrap 按鈕樣式 (用於表格中的操作按鈕) */
.btn-info {
    color: #fff;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
        border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-info:hover {
    color: #fff;
    background-color: #31d2f2;
    border-color: #25cff2;
}

/* 表單控制項 */
.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    appearance: none;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Margin 工具類別 */
.mb-0 {
    margin-bottom: 0 !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* ============================================================================
   深色模式支援 (Dark Mode Support)
   ============================================================================ */

/* 深色模式表格 */
.dark .table {
    color: #e5e7eb;
    border-color: #374151;
}

.dark .table thead th {
    border-bottom-color: #4b5563;
    background-color: #1f2937;
    color: #f3f4f6;
}

.dark .table tbody td {
    border-bottom-color: #374151;
}

.dark .table>:not(caption)>*>* {
    background-color: #111827;
    box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);
}

/* 深色模式條紋 */
.dark .table-striped>tbody>tr:nth-of-type(odd)>* {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.05);
}

/* 深色模式 Hover */
.dark .table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.1);
}

/* 深色模式淺色表頭 */
.dark .table-light {
    --bs-table-bg: #374151;
    --bs-table-hover-bg: #4b5563;
    color: #f3f4f6;
    border-color: #4b5563;
}

/* 深色模式表單 */
.dark .form-control {
    color: #f3f4f6;
    background-color: #374151;
    border-color: #4b5563;
}

.dark .form-control:focus {
    color: #f3f4f6;
    background-color: #374151;
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.dark .form-control::placeholder {
    color: #9ca3af;
}

/* 深色模式按鈕 */
.dark .btn-info {
    background-color: #0ea5e9;
    border-color: #0ea5e9;
}

.dark .btn-info:hover {
    background-color: #38bdf8;
    border-color: #38bdf8;
}