/* 全站樣式設計(包含RWD)和各項UI風格 */
/* 針對AttendanceAdjustmentRequest/Index的設計改進 */

/* ========== 基本設定 ========== */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    /* 確保html不產生滾動條 */
    overflow-x: hidden;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    font-family: 'Microsoft JhengHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    /* ?保body是唯一的滾動容器 */
    overflow-x: hidden;
    overflow-y: auto;
}

/* ========== jQuery UI DateTimePicker 樣式優化 ========== */
/* 統一定位策略：所有 DateTimePicker 固定顯示在螢幕中央，距離頂部 1% */
#ui-datepicker-div,
.ui-datepicker {
    width: auto !important;
    padding: 0.5rem !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    background: white !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    z-index: 10000 !important;
    
    /* ★★★ 關鍵：統一固定定位在螢幕中央偏上方 (距離頂部 1%) ★★★ */
    position: fixed !important;
    left: 50% !important;
    top: 1% !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    
    /* 確保 DatePicker 不會超出視窗 */
    max-width: calc(100vw - 2rem) !important;
    max-height: calc(100vh - 2rem) !important;
    overflow: auto !important;
}

/* 小螢幕優化 */
@media (max-width: 768px) {
    #ui-datepicker-div,
    .ui-datepicker {
        max-width: calc(100vw - 1rem) !important;
        font-size: 0.8rem !important;
        padding: 0.25rem !important;
        /* 確保小螢幕也固定在中央偏上方 */
        left: 50% !important;
        top: 1% !important;
        transform: translateX(-50%) !important;
    }
    
    .ui-datepicker-calendar td a {
        padding: 0.3rem !important;
        font-size: 0.85rem !important;
    }
    
    .ui-timepicker-div {
        padding: 0.25rem !important;
    }
    
    .ui-timepicker-div dl dt {
        font-size: 0.85rem !important;
    }
}

/* 極小螢幕優化 */
@media (max-width: 576px) {
    #ui-datepicker-div,
    .ui-datepicker {
        width: calc(100vw - 1rem) !important;
        font-size: 0.75rem !important;
        /* 確保極小螢幕也固定在中央偏上方 */
        left: 50% !important;
        top: 1% !important;
        transform: translateX(-50%) !important;
    }
    
    .ui-datepicker-header {
        font-size: 0.85rem !important;
    }
    
    .ui-datepicker-calendar th,
    .ui-datepicker-calendar td {
        padding: 0.2rem !important;
    }
    
    .ui-datepicker-calendar td a {
        padding: 0.25rem !important;
        font-size: 0.8rem !important;
    }
    
    .ui-timepicker-div dl dt {
        font-size: 0.8rem !important;
        margin-bottom: 0.15rem !important;
    }
    
    .ui-timepicker-div .ui-slider-handle {
        width: 0.9rem !important;
        height: 0.9rem !important;
    }
}

/* 確保 DatePicker 在 Modal 中正確顯示 - 也使用固定定位 */
.modal-open #ui-datepicker-div,
.modal-open .ui-datepicker {
    z-index: 10000 !important;
    position: fixed !important;
    left: 50% !important;
    top: 1% !important;
    transform: translateX(-50%) !important;
}

/* 防止 DatePicker 被遮擋 */
.ui-datepicker-div {
    z-index: 10000 !important;
    position: fixed !important;
    left: 50% !important;
    top: 1% !important;
    transform: translateX(-50%) !important;
}

.ui-datepicker .ui-datepicker-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 0.25rem !important;
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

.ui-datepicker .ui-datepicker-title {
    color: white !important;
    font-weight: 600 !important;
}

.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
    top: 0.5rem !important;
    width: 1.5rem !important;
    height: 1.5rem !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 0.25rem !important;
    cursor: pointer !important;
}

.ui-datepicker .ui-datepicker-prev:hover,
.ui-datepicker .ui-datepicker-next:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
    border: none !important;
    background: rgba(255, 255, 255, 0.3) !important;
}

.ui-datepicker .ui-datepicker-calendar {
    border-collapse: separate !important;
    border-spacing: 2px !important;
}

.ui-datepicker .ui-datepicker-calendar th {
    background: #f8f9fa !important;
    color: #495057 !important;
    font-weight: 600 !important;
    text-align: center !important;
    padding: 0.5rem !important;
    border: none !important;
    border-radius: 0.25rem !important;
}

.ui-datepicker .ui-datepicker-calendar td {
    border: none !important;
    padding: 1px !important;
}

.ui-datepicker .ui-datepicker-calendar td a {
    border: 1px solid transparent !important;
    background: white !important;
    color: #495057 !important;
    text-align: center !important;
    display: block !important;
    padding: 0.5rem !important;
    border-radius: 0.25rem !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.ui-datepicker .ui-datepicker-calendar td a:hover {
    background: #e9ecef !important;
    border-color: #667eea !important;
}

.ui-datepicker .ui-datepicker-calendar td .ui-state-highlight {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

.ui-datepicker .ui-datepicker-calendar td .ui-state-active {
    background: #667eea !important;
    color: white !important;
    border-color: #667eea !important;
}

.ui-datepicker .ui-datepicker-other-month {
    color: #6c757d !important;
}

/* DateTimePicker 特定樣式 */
.ui-timepicker-div {
    padding: 0.5rem !important;
    border-top: 1px solid #dee2e6 !important;
    margin-top: 0.5rem !important;
}

.ui-timepicker-div .ui-widget-header {
    background: #f8f9fa !important;
    color: #495057 !important;
    border: none !important;
    margin-bottom: 0.5rem !important;
    padding: 0.25rem !important;
    border-radius: 0.25rem !important;
    font-weight: 600 !important;
}

.ui-timepicker-div dl {
    text-align: left !important;
    margin: 0 !important;
}

.ui-timepicker-div dl dt {
    height: auto !important;
    margin-bottom: 0.25rem !important;
    font-weight: 600 !important;
    color: #495057 !important;
}

.ui-timepicker-div dl dd {
    margin: 0 0 0.5rem 0 !important;
}

.ui-timepicker-div .ui-slider {
    background: #e9ecef !important;
    border: none !important;
    height: 0.5rem !important;
    border-radius: 0.25rem !important;
}

.ui-timepicker-div .ui-slider .ui-slider-handle {
    background: #667eea !important;
    border: 2px solid white !important;
    border-radius: 50% !important;
    width: 1rem !important;
    height: 1rem !important;
    top: -0.25rem !important;
}

.ui-timepicker-div .ui-slider-horizontal {
    height: 0.5rem !important;
}

/* 按鈕樣式 */
.ui-datepicker .ui-datepicker-buttonpane {
    background: #f8f9fa !important;
    border: none !important;
    padding: 0.5rem !important;
    border-radius: 0 0 0.25rem 0.25rem !important;
    margin-top: 0.5rem !important;
}

.ui-datepicker .ui-datepicker-buttonpane button {
    background: #667eea !important;
    color: white !important;
    border: none !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 0.25rem !important;
    cursor: pointer !important;
    margin-right: 0.25rem !important;
    font-size: 0.8rem !important;
}

.ui-datepicker .ui-datepicker-buttonpane button:hover {
    background: #5a67d8 !important;
}

/* 確保 DatePicker 在 Modal 中正確顯示 */
.modal .ui-datepicker {
    z-index: 9999 !important;
}

/* ========== 基本設定 ========== */
.layout-container {
    width: 100%;
    min-height: 100vh;
    /* 移除容器滾動，讓body處理 */
    overflow: visible;
}

.layout-flex {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: calc(100vh - 60px);
    transition: all 0.3s ease;
    /* 確保不產生額外滾動條 */
    overflow: visible;
}

.side-area {
    width: 220px;
    background: #f8f9fa;
    padding: 30px 10px 10px 10px;
    border-right: 1px solid #ddd;
    transition: all 0.3s ease;
    opacity: 1;
    /* 側邊欄不需要滾動條，內容應該自適應 */
    overflow: visible;
    position: relative;
    flex-shrink: 0;
}

.side-area.hide {
    margin-left: -220px;
    opacity: 0;
    pointer-events: none;
}

.side-area .nav-link {
    margin-bottom: 10px;
    font-size: 1.1em;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.side-area .nav-link:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.main-content {
    flex: 1 1 auto;
    padding: 30px 20px;
    transition: all 0.3s ease;
    min-width: 0; /* 防止flex item溢出 */
    /* 主內容區域不產生滾動條，讓body處理所有滾動 */
    overflow: visible;
}

/* ========== 小螢幕頂部功能選單 ========== */
.mobile-menu-area {
    display: none;
    background: #ffffff;
    border-bottom: 2px solid #e9ecef;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
    /* 手機版選單不產生滾動條 */
    overflow: visible;
}

.mobile-menu-area h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

.mobile-menu-area .nav-link {
    margin-bottom: 8px;
    font-size: 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    padding: 10px 15px;
}

.mobile-menu-area .nav-link:hover {
    background-color: #e9ecef;
    color: #495057;
}

.mobile-menu-area .nav-link.active {
    background-color: #007bff !important;
    color: white !important;
    font-weight: 600;
}

.mobile-controller-title {
    padding: 12px 15px;
    font-weight: 600;
    color: #6c757d;
    background: #f8f9fa;
    margin-bottom: 5px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-controller-title:hover {
    background: #e9ecef;
    color: #495057;
}

.mobile-controller-title[aria-expanded="true"] {
    background-color: #007bff !important;
    color: white !important;
}

/* ========== 導航欄中的選單按鈕 ========== */
.menu-toggle-btn {
    display: none !important;
    position: relative;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.menu-toggle-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.menu-toggle-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.menu-toggle-btn.btn-close {
    background: #dc3545;
}

.menu-toggle-btn.btn-close:hover {
    background: #c82333;
}

/* ========== 功能選單響應式設計 - 平板和手機 ========== */
@media (max-width: 991.98px) {
    .layout-flex {
        flex-direction: column;
    }
    
    /* 隱藏桌面版側邊選單 */
    .side-area {
        display: none !important;
    }
    
    /* 顯示頂部選單按鈕 */
    .menu-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* 顯示手機版頂部選單 */
    .mobile-menu-area {
        display: block;
    }
    
    .mobile-menu-area.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 15px 10px !important;
        width: 100% !important;
    }
    
    /* 手機版選單項目間距調整 */
    .mobile-menu-area .nav {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .mobile-menu-area .mb-2 {
        margin-bottom: 15px !important;
    }
}

@media (max-width: 576px) {
    .mobile-menu-area {
        padding: 15px;
    }
    
    .mobile-menu-area h4 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .mobile-menu-area .nav-link {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .mobile-controller-title {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .menu-toggle-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .main-content {
        padding: 10px 5px !important;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

/* ========== 大螢幕確保正常顯示 ========== */
@media (min-width: 992px) {
    .side-area {
        display: block !important;
    }
    
    .mobile-menu-area {
        display: none !important;
    }
    
    .menu-toggle-btn {
        display: none !important;
    }
    
    .layout-flex {
        flex-direction: row;
    }
    
    .main-content {
        margin-left: 0;
        padding: 30px 20px;
    }
}

/* ========== 卡片和容器風格 - 針對AttendanceAdjustmentRequest設計 ========== */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-header h5 {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h5 i {
    font-size: 1.1em;
}

.card-body {
    padding: 1.5rem;
}

/* ========== 表格響應式設計 ========== */
.table-responsive {
    border-radius: 12px;
    box-shadow: 0.125rem 0.25rem 0.5rem rgba(0, 0, 0, 0.075);
    border: 1px solid #dee2e6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* 移除表格容器的最大高度和垂直滾動條，讓頁面統一滾動 */
    /* max-height: calc(100vh - 300px); */
    /* overflow-y: auto; */
}

.table {
    margin-bottom: 0;
    font-size: 1rem; /* 調整為與Modal內容相同的字體大小 */
}

.table th {
    border-top: none;
    font-weight: 600;
    font-size: 1rem; /* 統一調整字體大小 */
    background-color: #343a40;
    color: white;
    white-space: nowrap;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

.table td {
    vertical-align: middle;
    font-size: 1rem; /* 統一調整字體大小 */
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f1f3f4;
}

/* 表格響應式 - 手機版本 */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.9rem; /* 手機版稍微縮小但仍然保持可讀性 */
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.9rem; /* 手機版統一字體大小 */
    }
    
    /* 隱藏某些不重要的欄位 */
    .table .d-none-mobile {
        display: none !important;
    }
    
    /* 按鈕群組調整 */
    .btn-group {
        flex-direction: column;
        gap: 2px;
    }
    
    .btn-group .btn {
        font-size: 0.8rem; /* 手機版按鈕字體大小 */
        padding: 0.2rem 0.4rem;
    }
}

/* ========== 按鈕風格 ========== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* 批量操作按鈕 */
#batchApprovalBtn,
#batchCancelBtn,
#btnApprove,
#btnReject,
#btnDelete {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#batchApprovalBtn:not(:disabled):hover,
#batchCancelBtn:not(:disabled):hover,
#btnApprove:not(:disabled):hover,
#btnReject:not(:disabled):hover,
#btnDelete:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#batchApprovalBtn:disabled,
#batchCancelBtn:disabled,
#btnApprove:disabled,
#btnReject:disabled,
#btnDelete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== 徽章風格 ========== */
.badge {
    display: inline-block;
    padding: 0.4em 0.8em;
    font-size: 0.9rem; /* 稍微調整徽章字體大小，保持比例 */
    font-weight: 600;
    color: #fff;
    border-radius: 8px;
    vertical-align: baseline;
    line-height: 1;
    text-transform: none;
}

.badge-warning {
    background: linear-gradient(135deg, #ffc107, #ff8800);
    color: #212529;
}

.badge-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.badge-danger {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.badge-secondary {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.badge-light {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}

.badge-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.badge-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

/* ========== 表單風格 ========== */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    max-width: none;
    font-size: 1rem; /* 與Modal內容統一字體大小 */
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-label.fw-bold { 
    font-weight: 700; 
}

.form-control[readonly], 
.form-control.bg-light { 
    background-color: #f8f9fa !important; 
    border-color: #dee2e6;
    color: #6c757d;
}

.form-select[disabled] {
    background-color: #f8f9fa !important;
    border-color: #dee2e6;
    color: #6c757d;
}

/* 表單響應式調整 */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 0.9rem; /* 手機版稍微縮小但保持可讀性 */
        padding: 0.4rem 0.6rem;
    }
    
    .form-label {
        font-size: 0.9rem; /* 手機版標籤字體統一 */
    }
    
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    /* 手機版清單項目調整 */
    .list-group-item {
        font-size: 0.9rem;
    }
    
    .dropdown-menu {
        font-size: 0.9rem;
    }
    
    .dropdown-item {
        font-size: 0.9rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
    }
}

/* ========== Modal 風格 - 確保Modal只有一個滾動條 ========== */
.modal-lg {
    max-width: 900px;
}

.modal-xl {
    max-width: 1200px;
}

/* Modal對話框設定 */
.modal-dialog {
    /* 確保Modal不超出視窗高度 */
    max-height: calc(100vh - 2rem);
    margin: 1rem auto;
    display: flex;
    flex-direction: column;
}

.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    /* 讓Modal內容可以伸縮 */
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    /* 固定高度，不參與滾動 */
    flex-shrink: 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    /* Modal body是唯一的滾動區域 */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
    font-size: 1rem;
    /* 讓內容可以伸縮 */
    flex: 1 1 auto;
    /* 設定最小高度以避免內容過少時的顯示問題 */
    min-height: 0;
}

.modal-footer {
    /* 固定在底部，不參與滾動 */
    flex-shrink: 0;
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

/* Modal內的表格響應式處理 */
.modal-body .table-responsive {
    /* Modal內的表格不要有自己的滾動條 */
    overflow: visible;
    max-height: none;
    border: 1px solid #dee2e6;
}

/* 響應式Modal */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-xl,
    .modal-lg {
        max-width: 100%;
    }
}

/* ========== 彈出訊息風格 ========== */
.alert {
    border: none;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert.position-fixed {
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 400px;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* ========== 頭像和用戶資訊 ========== */
.avatar-sm {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* ========== 統計卡片 ========== */
.stats-card {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stats-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== 功能區域風格 ========== */
.function-area {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ========== 搜尋區域 ========== */
.search-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

.search-section .form-control,
.search-section .form-select {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    font-size: 1rem; /* 統一字體大小 */
}

.search-section .form-control:focus,
.search-section .form-select:focus {
    background: white;
}

.search-section .form-label {
    font-size: 1rem; /* 統一標籤字體大小 */
}

.search-section .btn {
    font-size: 1rem; /* 統一按鈕字體大小 */
}

/* ========== 審核頁面相關樣式 ========== */
.approval-table {
    font-size: 0.9rem;
}

.approval-table th,
.approval-table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

.approval-actions .btn {
    margin-right: 0.25rem;
}

.approval-actions .btn:last-child {
    margin-right: 0;
}

.batch-approval-modal .form-check-input {
    margin-top: 0.125rem;
}

/* ========== 擴展樣式 ========== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* 表格響應式改進 */
@media (max-width: 768px) {
    .approval-table {
        font-size: 0.8rem;
    }
    
    .approval-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .stats-card .stats-number {
        font-size: 2rem;
    }
}

/* 載入動畫 */
.spinner-border {
    color: #007bff;
}

/* 表單驗證樣式 */
.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid {
    border-color: #28a745;
}

/* 提示框位置調整 */
.alert.position-fixed {
    max-width: 400px;
    z-index: 9999;
}

/* Checkbox 樣式改進 */
.form-check-input:checked {
    background-color: #007bff;
    border-color: #007bff;
}

.form-check-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 搜尋條件摺疊動畫 */
#searchFormContainer {
    transition: all 0.3s ease-in-out;
}

/* 卡片陰影效果 */
.card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
}

.card:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}

/* 按鈕群組樣式 */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* 工具提示改進 */
[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* 表格行選擇效果 */
.table tbody tr.selected {
    background-color: rgba(102, 126, 234, 0.1);
}

/* 批次操作區域 */
.batch-operations {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

/* 搜尋切換按鈕 */
.search-toggle {
    background: none;
    border: none;
    color: #667eea;
    font-size: 1.1rem;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.search-toggle:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: #5a67d8;
}

/* 無資料顯示 */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-data i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 固定提示訊息位置 */
.position-fixed {
    position: fixed !important;
}

/* 表格文字對齊 */
.text-center {
    text-align: center !important;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

/* ========== 特殊容器滾動條處理 ========== */
/* 如果某些特殊情況需要容器滾動條，使用這個類別 */
.scrollable-container {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 400px;
}

/* 移除所有可能產生多重滾動條的設定 */
.container,
.container-fluid,
.row,
.col,
[class*="col-"] {
    overflow: visible;
}

/* 確保所有卡片內容不產生滾動條 */
.card-body {
    overflow: visible;
}

/* 修正下拉選單可能的滾動問題 */
.dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

/* ========== 進階滾動條控制 ========== */
/* 確保沒有任何元素意外創建滾動容器 */
.layout-container,
.layout-flex,
.main-content,
.side-area {
    /* 明確防止這些容器產生滾動條 */
    overflow: visible !important;
}

/* 專門處理可能的問題元素 */
.navbar,
.nav,
.navbar-nav {
    overflow: visible;
}

/* 確保搜尋表單和功能區域不會產生滾動條 */
.search-form,
.function-area {
    overflow: visible;
}

/* 處理可能有大量內容的區域 */
.approval-table,
.stats-card {
    overflow: visible;
}

/* 特殊處理：如果內容確實需要滾動的容器 */
.force-scroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* 確保 Modal backdrop 不會干擾滾動 */
.modal-backdrop {
    overflow: hidden;
}

/* 當 Modal 開啟時防止 body 滾動 */
.modal-open {
    overflow: hidden !important;
}

/* 修正可能的邊距問題 */
.modal-open .main-content {
    padding-right: 0 !important;
}

/* 確保內容區域在所有情況下都正確顯示 */
@media (min-width: 992px) {
    .main-content {
        /* 桌面版確保主內容區域正確顯示 */
        overflow: visible !important;
    }
}

@media (max-width: 991.98px) {
    .main-content {
        /* 手機版確保主內容區域正確顯示 */
        overflow: visible !important;
    }
}

/* Request Details Modal Attachments */
.attachment-item {
    transition: all 0.2s ease;
    border: 1px solid #dee2e6 !important;
}

.attachment-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-color: #0d6efd !important;
}

.attachment-item .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

.attachment-item .fas {
    width: 20px;
    text-align: center;
}

/* Timeline styles for approval history */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline-item, .timeline-item-last {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 25px;
    width: 2px;
    height: calc(100% + 10px);
    background-color: #dee2e6;
}

.timeline-marker {
    position: absolute;
    left: -25px;
    top: 15px;
    width: 12px;
    height: 12px;
    background-color: #0d6efd;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-marker .fas {
    font-size: 6px;
    color: white;
}

.timeline-content {
    margin-left: 15px;
}

/* Badge improvements */
.badge {
    font-size: 0.75em;
}

/* Card improvements */
.card {
    border: 1px solid #dee2e6;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Button improvements */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Stats card improvements */
.stats-card .stats-number {
    font-size: 2rem;
    font-weight: bold;
}

.stats-card .stats-label {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Quick actions list */
.quick-actions li {
    margin-bottom: 0.5rem;
}

.quick-actions .fas {
    width: 20px;
    margin-right: 8px;
}

/* Approval table improvements */
.approval-table th {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-weight: 600;
}

.approval-actions .btn {
    margin-right: 2px;
}

/* Modal improvements */
.modal-lg {
    max-width: 900px;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Search form improvements */
#searchFormContainer {
    transition: all 0.3s ease;
}

/* Batch approval modal */
.batch-approval-modal .modal-body {
    padding: 1.5rem;
}

/* File type specific colors */
.text-pdf {
    color: #dc3545 !important;
}

.text-word {
    color: #0d6efd !important;
}

.text-excel {
    color: #198754 !important;
}

.text-image {
    color: #0dcaf0 !important;
}

.text-archive {
    color: #ffc107 !important;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .attachment-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .attachment-item .btn {
        margin-top: 0.5rem;
        margin-right: 0;
        margin-bottom: 0.25rem;
    }
    
    .timeline {
        padding-left: 20px;
    }
    
    .timeline-marker {
        left: -15px;
    }
    
    .timeline-content {
        margin-left: 10px;
    }
}

/* Loading states */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Alert positioning */
.alert.position-fixed {
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Table responsive improvements */
.table-responsive {
    border-radius: 0.375rem;
}

/* Form improvements */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Search toggle button */
#toggleSearchBtn {
    border: none;
    background: none;
    color: #6c757d;
}

#toggleSearchBtn:hover {
    color: #0d6efd;
}

/* Checkbox improvements */
.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Additional attachment styles */
.attachment-section {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
}

.no-attachments {
    color: #6c757d;
    font-style: italic;
}

/* File icon colors */
.file-icon-pdf { color: #d63384; }
.file-icon-word { color: #0d6efd; }
.file-icon-excel { color: #198754; }
.file-icon-image { color: #20c997; }
.file-icon-archive { color: #fd7e14; }
.file-icon-text { color: #6c757d; }
.file-icon-default { color: #495057; }