/* 排班（主管用）的週表格，pages/hrShifts.js。手機版的卡片排法在 css/mobile.css。 */

.shift-week-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

#shiftPrevWeek,
#shiftNextWeek {
    width: 40px;
    height: 40px;
    padding: 0;
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    font-size: 20px;
    line-height: 1;
}

.shift-week-nav strong {
    min-width: 120px;
    text-align: center;
}

.shift-grid-wrap {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow-x: auto;
}

.shift-grid {
    min-width: 900px;
}

.shift-head-row,
.shift-row {
    display: grid;
    grid-template-columns: 160px repeat(7, minmax(108px, 1fr));
}

.shift-head-row {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.shift-row {
    border-bottom: 1px solid #f3f4f6;
}

.shift-row:last-child {
    border-bottom: none;
}

.shift-head-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    color: #6b7280;
    font-size: 12px;
}

.shift-head-cell strong {
    color: #111827;
    font-size: 18px;
    line-height: 1.3;
}

.shift-head-cell.is-today strong {
    color: var(--primary-color, #2563eb);
}

.shift-name-head {
    align-items: flex-start;
    justify-content: center;
    padding-left: 12px;
}

.shift-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid #f3f4f6;
}

.shift-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    font-weight: 700;
}

.shift-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 一天一格：整格可點（新增），格子裡的班可點（編輯） */
.shift-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 56px;
    padding: 6px;
    border-right: 1px solid #f3f4f6;
    cursor: pointer;
}

.shift-cell:last-child {
    border-right: none;
}

.shift-cell.is-today {
    background: #ecfdf5;
}

.shift-cell:hover {
    background: #f3f4f6;
}

.shift-cell.is-today:hover {
    background: #d1fae5;
}

.shift-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    padding: 4px 8px;
    background: var(--primary-color, #2563eb);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.shift-chip-time {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.shift-chip-note {
    opacity: .85;
}

/* 「＋」：電腦上滑過格子或用鍵盤聚焦才出現，點空白處也一樣能新增 */
.shift-add {
    align-self: center;
    margin-top: auto;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    cursor: pointer;
}

.shift-cell:hover .shift-add,
.shift-add:focus-visible {
    opacity: 1;
}

.shift-grid-empty {
    padding: 28px 16px;
    color: #6b7280;
    text-align: center;
}

/* 草稿（還沒傳送，員工看不到）：虛線外框、淡色底；已傳送：實心 */
.shift-chip.is-draft {
    background: #eff6ff;
    border: 1.5px dashed var(--primary-color, #2563eb);
    color: #1e3a8a;
}

.shift-chip.is-draft .shift-chip-note {
    opacity: 1;
}

.shift-week-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.shift-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    color: #6b7280;
    font-size: 13px;
}

.shift-legend .shift-chip-sample:not(:first-child) {
    margin-left: 10px;
}

.shift-chip-sample {
    display: inline-block;
    width: 22px;
    height: 12px;
    border-radius: 4px;
    background: var(--primary-color, #2563eb);
}

.shift-chip-sample.is-draft {
    background: #eff6ff;
    border: 1.5px dashed var(--primary-color, #2563eb);
}

.shift-status {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    font-size: 14px;
}

.shift-status.is-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* 表格下面的「傳送給團隊」列：這是最重要的按鈕，傳送前員工都看不到班表 */
.shift-publish-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 12px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.shift-publish-note {
    color: #6b7280;
    font-size: 14px;
}

.shift-publish-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.shift-publish-btn:disabled,
.shift-week-actions button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* 「複製上週」「清空這一週」：一般的次要按鈕，文字不折行；清空是紅色警示 */
.shift-week-actions button {
    padding: 8px 14px;
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    font-size: 14px;
    white-space: nowrap;
}

.shift-week-actions button.danger {
    color: #b91c1c;
    border-color: #fecaca;
}
