/**
 * 自訂樣式
 */

/* 全域設定 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

/* 導航欄背景顏色 - 由資料庫 system_settings 表動態設定 */
/* 顏色設定位置: 系統設定 > 導航列設定 */
/* 不要在此處硬編碼顏色，應透過系統設定頁面修改 */

/* 主要內容區（已更新為 100% 寬度 - 2025-11-07） */
.main-content {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 10px 20px !important;
    padding-top: 15px !important;
    padding-bottom: 50px !important; /* ⭐ 2025-12-03: 增加底部空間 */
    min-height: calc(100vh - 56px);
    height: auto !important; /* ⭐ 2025-12-03: 確保高度可擴展 */
    overflow: visible !important; /* ⭐ 2025-12-03: 確保內容不被截斷 */
}

/* 減少 breadcrumb 的上方間距 */
.breadcrumb {
    margin-bottom: 1rem !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* 麵包屑導航增強樣式 (2025-12-29) */
.breadcrumb-item a {
    color: var(--ui-primary-color, #0d6efd);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.breadcrumb-item a i {
    font-size: 0.9em;
}

.breadcrumb-item.active {
    color: #6c757d;
    font-weight: 500;
}

/* 分類儀表板卡片 */
.category-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
    border-radius: 12px;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.category-card .card-header {
    border-radius: 12px 12px 0 0;
    border-bottom: none;
}

.category-card .card-body {
    padding: 1.25rem;
}

/* 子分類選單卡片 */
.subcategory-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.subcategory-card:hover {
    background: #fff;
    border-color: var(--ui-primary-color, #0d6efd);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

/* 模組連結列表 */
.module-link-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.module-link-list li {
    border-bottom: 1px solid #f0f0f0;
}

.module-link-list li:last-child {
    border-bottom: none;
}

.module-link-list a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.module-link-list a:hover {
    background-color: #f8f9fa;
    color: var(--ui-primary-color, #0d6efd);
    padding-left: 1.25rem;
}

.module-link-list a i {
    margin-right: 0.75rem;
    color: #6c757d;
    transition: color 0.2s ease;
}

.module-link-list a:hover i {
    color: var(--ui-primary-color, #0d6efd);
}

/* 減少 container-fluid 的頂部間距 */
.main-content .container-fluid {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 確保 main-content-wrapper 沒有額外間距 */
.main-content-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 50px !important; /* ⭐ 2025-12-03: 確保底部有足夠空間 */
    min-height: calc(100vh - 56px); /* ⭐ 保持最小高度 */
}

/* 卡片樣式 */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: none;
}

/* 確保資料顯示區塊的文字可見（2025-11-07 新增）*/
.fw-bold {
    color: #212529 !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.bg-light .fw-bold {
    color: #212529 !important;
}

/* 表格樣式 */
table.dataTable {
    border-collapse: collapse !important;
}

/* 登入頁面 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    max-width: 400px;
    width: 100%;
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   ⚠️ 側邊欄樣式已停用（2025-11-07）
   改用頁首下拉選單（參考 navbar-dropdown.css）
   ========================================== */

/* 固定左側邊欄 - 已停用
.sidebar-fixed {
    width: 280px;
    min-width: 280px;
    height: calc(100vh - 56px);
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: 0;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

側邊欄隱藏狀態 - 已停用
.sidebar-fixed.collapsed {
    display: none;
}

.sidebar-header {
    padding: 1rem;
    font-weight: bold;
}

.sidebar-title {
    margin: 0;
    font-size: 1.1rem;
}

.sidebar-body {
    height: calc(100% - 60px);
    overflow-y: auto;
}

自定義滾動條 - 已停用
.sidebar-fixed::-webkit-scrollbar {
    width: 6px;
}

.sidebar-fixed::-webkit-scrollbar-track {
    background: #2c3034;
}

.sidebar-fixed::-webkit-scrollbar-thumb {
    background: #495057;
    border-radius: 3px;
}

.sidebar-fixed::-webkit-scrollbar-thumb:hover {
    background: #5a6268;
}

.list-group-item:hover {
    background-color: #495057 !important;
}

側邊欄分類按鈕 - 已停用
.sidebar-category-btn {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sidebar-category-btn:hover {
    background-color: #5a6268 !important;
}

.sidebar-category-btn:focus {
    outline: none;
    box-shadow: none;
}

箭頭圖示動畫 - 已停用
.collapse-icon {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-category-btn[aria-expanded="false"] .collapse-icon {
    transform: rotate(-90deg);
}

.sidebar-category-btn[aria-expanded="true"] .collapse-icon {
    transform: rotate(0deg);
}

折疊動畫 - 已停用
.collapse {
    transition: height 0.3s ease;
}

選單項目縮排 - 已停用
.collapse .list-group-item {
    padding-left: 2rem;
    border-left: 3px solid transparent;
}

.collapse .list-group-item:hover {
    border-left-color: #667eea;
}
*/ /* 側邊欄樣式區塊結束 */

/* 按鈕 */
.btn-action {
    margin-right: 5px;
}

/* DataTable 中文化 */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 14px;
}

/* 響應式 */
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }
}

/* ============================================
   日期範圍選擇器樣式 - Date Range Picker Styles
   ============================================ */

/* 日期選擇器容器 - 垂直排列 */
.date-range-picker {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* 日期選擇器容器 - 水平排列 */
.date-range-picker-inline {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* 日期欄位群組 */
.date-field-group {
    flex: 1;
    min-width: 200px;
}

/* 日期範圍分隔符號 */
.date-range-separator {
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #6c757d;
}

/* 日期輸入框樣式 */
.flatpickr-input {
    cursor: pointer;
}

.flatpickr-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* 清除日期按鈕 */
.clear-date-btn {
    border-left: none;
}

.clear-date-btn:hover {
    background-color: #e9ecef;
    color: #dc3545;
}

/* 日期快捷選項 */
.date-range-shortcuts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.date-shortcut {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    transition: all 0.2s ease;
}

.date-shortcut:hover {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* 單一日期選擇器 */
.single-date-picker {
    max-width: 300px;
    margin-bottom: 1rem;
}

/* Flatpickr 客製化樣式 */
.flatpickr-calendar {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #dee2e6 !important;
}

.flatpickr-day.selected {
    background-color: #667eea !important;
    border-color: #667eea !important;
}

.flatpickr-day.selected:hover {
    background-color: #5568d3 !important;
}

.flatpickr-day.today {
    border-color: #667eea !important;
}

.flatpickr-day:hover {
    background-color: #f8f9fa;
}

/* 表單驗證樣式 */
.flatpickr-input.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.flatpickr-input.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .date-range-picker-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .date-range-separator {
        display: none;
    }

    .date-field-group {
        width: 100%;
    }

    .date-range-shortcuts {
        justify-content: center;
    }

    .date-shortcut {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 100px;
    }
}

/* Print 樣式 */
@media print {
    .date-range-shortcuts,
    .clear-date-btn,
    .input-group-text {
        display: none !important;
    }

    .flatpickr-input {
        border: 1px solid #dee2e6 !important;
        background-color: white !important;
    }
}
