/* 引入基礎樣式 */
@import url('base.css');

/* 全局樣式 */
body {
    background-color: var(--bg-primary);
    padding-top: 60px; /* 為固定導航欄預留空間 */
}

/* 導航欄樣式 */
.main-navbar {
    background: var(--nav-bg) !important;
    transition: all 0.3s ease;
}

.main-navbar.fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px var(--shadow-color);
    animation: slideDown 0.3s ease-out;
}

.main-navbar.navbar-hidden {
    transform: translateY(-100%);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.main-navbar .navbar-brand,
.main-navbar .nav-link {
    color: var(--nav-text) !important;
    font-weight: 500;
    padding: 0.8rem 1.2rem;
    transition: all 0.3s ease;
}

.main-navbar .nav-link:hover,
.main-navbar .nav-link.active {
    background: var(--nav-hover-bg);
    color: var(--nav-text-hover) !important;
}

.main-navbar .navbar-brand {
    font-size: 1.5rem;
    padding: 0.8rem 1rem;
}

/* 內容區域樣式 */
.content-wrapper {
    background-color: #fff;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 70px;
    min-height: calc(100vh - 180px);
}

/* 表格樣式 */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
}

.table td {
    vertical-align: middle;
}

/* 按鈕樣式 */
.btn-sm {
    padding: 0.25rem 1.5rem;
    margin: 0 0.2rem;
}

.btn-warning {
    color: #fff;
    background-color: #f39c12;
    border-color: #f39c12;
}

.btn-warning:hover {
    color: #fff;
    background-color: #e67e22;
    border-color: #e67e22;
}

/* 表單樣式 */
.form-control:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* 不排班狀態的樣式 */
.table td:nth-child(6),
.table td:nth-child(7),
.table td:nth-child(8) {
    color: #666;
}

.table td:nth-child(6):contains('不排班'),
.table td:nth-child(7):contains('不排班'),
.table td:nth-child(8):contains('不排班') {
    color: #999;
    font-style: italic;
}

/* 優先權選擇下拉選單樣式 */
.form-select option[value="0"] {
    color: #999;
    font-style: italic;
}

.modal-lg {
    max-width: 900px;
}

.filter-form {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.btn-filter {
    height: 38px;
    margin-top: 32px;
}

/* 搜尋結果高亮 */
.highlight {
    background-color: yellow;
    padding: 2px;
}

/* 系統設定頁面樣式 */
.setting-card {
    height: 100%;
}

.alert-info {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

.form-label {
    font-weight: 500;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.setting-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.calculation-detail {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Footer 樣式 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.footer .text-muted {
    color: #6c757d !important;
    font-size: 0.9rem;
}

/* 版本標示樣式 */
.version-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.version-badge {
    font-size: 0.65rem;
    padding: 1px 4px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: text-top;
}

/* 修改網站標題樣式 */
.navbar-brand {
    font-size: 1.3rem !important;
    font-weight: 500 !important;
    display: flex;
    align-items: center;
}

/* 班表表格通用樣式 */
.schedule-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
    background-color: #fff;
    border: 2px solid #dee2e6 !important;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    text-align: center;
    vertical-align: middle;
    min-width: 40px;
    height: 40px;
    position: relative;
}

/* 固定寬度的欄位 */
.schedule-table th:nth-child(1),
.schedule-table td:nth-child(1) { 
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    padding: 0.5rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #f8f9fa;
    border-right: 2px solid #adb5bd !important;
}

.schedule-table th:nth-child(2),
.schedule-table td:nth-child(2) { 
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    padding: 0.5rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #f8f9fa;
    border-right: 2px solid #adb5bd !important;
}

/* 固定表頭和左側欄位 */
.schedule-table thead th {
    font-weight: 500;
    border-bottom: 2px solid #adb5bd !important;
}

/* 一般表頭背景色 */
.schedule-table thead th:not(.weekend) {
    background-color: #f8f9fa;
}

/* 週末和假日樣式 */
.schedule-table th.weekend {
    background-color: #ffe7d9 !important;
    color: #d63939 !important;
}

/* 週末單元格背景色 */
.schedule-table td[data-weekend="true"] {
    background-color: #fff5f5 !important;
}

/* 日期欄位 */
.schedule-table th[data-date] {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    padding: 0.5rem 0.25rem !important;
    white-space: nowrap;
    font-size: 0.85rem;
    background-color: #f8f9fa;
    border-bottom: 2px solid #adb5bd !important;
}

/* 表格容器 */
.table-responsive {
    overflow: visible;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border: none !important;
    padding: 1px;
}

/* 每日需求列 */
.schedule-table tr.daily-requirements td {
    background-color: #f8f9fa;
    font-size: 0.85rem;
    padding: 0.25rem !important;
    height: auto;
    white-space: nowrap;
    border-bottom: 2px solid #adb5bd !important;
    font-weight: 500;
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
}

/* 每日需求列的第一列和第二列保持原有寬度 */
.schedule-table tr.daily-requirements td:nth-child(1) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.schedule-table tr.daily-requirements td:nth-child(2) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

/* 每日需求的數值樣式 */
.schedule-table tr.daily-requirements td:not(:first-child):not(:nth-child(2)) {
    font-family: monospace;
    letter-spacing: -0.5px;
    line-height: 1.2;
    padding: 4px 2px !important;
}

/* 相鄰天數之間的分隔線 */
.schedule-table th:not(:first-child):not(:nth-child(2)),
.schedule-table td:not(:first-child):not(:nth-child(2)) {
    border-left: 1px solid #dee2e6;
}

/* 圖例專用的班別樣式 */
.legend-cell {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 35px !important;
    height: 35px !important;
    font-weight: bold;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.1);
}

/* 圖例容器樣式 */
.shift-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
}

.legend-item span {
    margin-left: 0.5rem;
    font-size: 14px;
    line-height: 35px;
}

/* 確保圖例容器有正確的樣式 */
#shiftLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 響應式調整 */
@media (max-width: 768px) {
    .schedule-cell,
    .legend-cell {
        width: 25px !important;
        height: 25px !important;
        font-size: 0.8rem;
    }
    
    .legend-item {
        padding: 0.35rem 0.5rem;
        height: 35px;
    }
    
    .legend-item span {
        font-size: 0.8rem;
        line-height: 30px;
    }
} 

/* 假日標記 */
.holiday-mark {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 12px;
    color: #dc3545;
    font-weight: bold;
    background-color: rgba(220, 53, 69, 0.1);
    padding: 1px 4px;
    border-radius: 2px;
}

/* 假日和週末的樣式 */
.schedule-table th.weekend {
    background-color: #fff3cd;
    color: #856404;
    position: relative;
}

.schedule-table td[data-date$="0"] th.weekend,
.schedule-table td[data-date$="6"] th.weekend {
    background-color: rgba(255, 243, 205, 0.5);
} 

/* 顏色預覽樣式 */
.color-preview {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-align: center;
    min-width: 60px;
    display: inline-block;
    font-weight: 500;
    margin: 0 auto;
}

/* Tab 樣式 */
.nav-tabs .nav-link {
    color: #495057;
    font-weight: 500;
    padding: 0.8rem 1.5rem;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: #007bff;
}

.nav-tabs .nav-link.active {
    color: #007bff;
    background: transparent;
    border-bottom: 2px solid #007bff;
}

/* 表格樣式 */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.table td {
    vertical-align: middle;
}

/* 按鈕間距 */
.btn + .btn {
    margin-left: 0.5rem;
}

/* 模態框樣式 */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.modal-header .modal-title {
    font-weight: 500;
    color: #495057;
}

.modal-body .form-label {
    font-weight: 500;
    color: #495057;
}

/* 顏色選擇器樣式 */
input[type="color"] {
    height: 38px;
    padding: 2px;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
} 

/* 月曆視圖樣式 */
.calendar-container {
    width: 100%;
    overflow: auto;
}

.calendar-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

/* 設定欄位寬度 */
.calendar-table .col-sunday,
.calendar-table .col-saturday {
    width: 14.28%;
    background-color: #fff3cd;
    color: #856404;
}

.calendar-table .col-weekday {
    width: 14.28%;
}

.calendar-table th {
    background-color: var(--table-header-bg);
    padding: 10px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--table-border);
}

.calendar-table td {
    border: 1px solid var(--table-border);
    height: 100px;
    vertical-align: top;
    padding: 5px;
    position: relative;
    width: 14.28%;
}

.calendar-table td.empty {
    background-color: var(--bg-secondary);
}

.calendar-table td.today {
    background-color: var(--bg-hover);
}

.calendar-table td.weekend {
    background-color: #fff3cd40;
}

.calendar-day {
    cursor: pointer;
    transition: background-color 0.2s;
}

.calendar-day:hover {
    background-color: var(--bg-hover);
}

.date-number {
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.holiday-mark {
    background-color: #dc3545;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
}

.daily-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 0.8em;
    color: #666;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

.daily-count:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #0056b3;
}

.daily-count:hover i {
    color: #fff;
}

.daily-count i {
    margin-right: 3px;
    color: #007bff;
}

/* 備註樣式 */
.schedule-note {
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
    line-height: 1.2;
    max-height: 2.4em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    padding: 0 2px;
}

.schedule-note:hover {
    max-height: none;
    -webkit-line-clamp: unset;
    background-color: rgba(255, 255, 255, 0.9);
    position: absolute;
    z-index: 1;
    left: 5px;
    right: 5px;
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 假別選擇器樣式 */
.leave-type-item {
    cursor: pointer;
    transition: transform 0.2s;
}

.leave-type-item:hover {
    transform: translateY(-2px);
}

.leave-types-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.leave-types-container .form-check {
    margin-bottom: 10px;
} 

.holiday-mark {
    background-color: #dc3545;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
}

.holiday-name {
    font-size: 0.8em;
    color: #dc3545;
    margin-top: 2px;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}

.holiday-name:hover {
    white-space: normal;
    word-wrap: break-word;
    position: relative;
    z-index: 1;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 3px;
    padding: 2px 4px;
}

/* 預班人員詳細資訊樣式 */
.staff-details {
    margin: 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    font-family: var(--bs-font-sans-serif);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
} 

.schedule-history-modal {
    font-size: 14px;
}

.schedule-history .staff-info {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.schedule-history .table {
    margin-bottom: 0;
}

.schedule-history .table th {
    background-color: #f1f1f1;
    font-weight: 600;
    text-align: center;
}

.schedule-history .table td {
    vertical-align: middle;
    text-align: center;
}

.schedule-history .badge {
    font-size: 12px;
    padding: 5px 8px;
}

.schedule-history .text-muted {
    font-size: 12px;
    color: #666;
}

.history-table-container {
    border: 1px solid #dee2e6;
    border-radius: 5px;
}

/* 自定義捲軸樣式 */
.history-table-container::-webkit-scrollbar {
    width: 8px;
}

.history-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.history-table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
} 


td.work-count-cell.holiday,
td.leave-count-cell.holiday,
td.requirement-cell.holiday {
    background: #ffecec !important;
    color: red !important;
}