/* 作業カレンダー（resources/views/work_calendar/index.blade.php） */

.work-calendar {
    --wc-hour-px: 48px;
    --wc-time-col: 56px;
    --wc-day-col-min: 140px;
    --wc-week-col-min: 120px;
    --wc-head-h: 48px;
    --wc-grid-line: #e9ecef;
    --wc-grid-line-strong: #dee2e6;
}
@media (max-width: 767.98px) {
    .work-calendar { --wc-day-col-min: 120px; }
}

/* ヘッダー */
.work-calendar .wc-title { min-width: 12em; }
.work-calendar .wc-date-picker { position: relative; overflow: hidden; }
.work-calendar .wc-date-picker input[type="date"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.work-calendar .wc-legend-item { margin-right: .75rem; white-space: nowrap; }
.work-calendar .wc-legend-box {
    display: inline-block;
    width: 1.4em;
    height: .9em;
    margin-right: .25em;
    vertical-align: -.1em;
    border-radius: 2px;
}
.work-calendar .wc-legend-photo { background: #1e88e5; }
.work-calendar .wc-legend-daily {
    background: rgba(30, 136, 229, .15);
    border: 1px solid #1e88e5;
    border-left-width: 4px;
}
.work-calendar .wc-legend-ongoing {
    background-color: #1e88e5;
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .45) 0 3px, transparent 3px 6px);
}
.work-calendar .wc-legend-stale { border: 2px dashed #1e88e5; background: rgba(30, 136, 229, .15); }

/* 週表示の従業員選択 */
.work-calendar .wc-employee-list {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    max-height: 8.5rem;
    overflow-y: auto;
}
.work-calendar .wc-employee-option {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    cursor: pointer;
    white-space: nowrap;
}
.work-calendar .wc-employee-option .form-check-input { margin-top: 0; }
.work-calendar .wc-employee-option.is-disabled { opacity: .45; cursor: not-allowed; }
.work-calendar .wc-swatch {
    display: none;
    width: .9rem;
    height: .9rem;
    border-radius: 2px;
}
.work-calendar .wc-swatch.is-active { display: inline-block; }

/* カレンダー本体 */
.work-calendar .wc-calendar-wrap { position: relative; min-height: 8rem; }
.work-calendar .wc-scroll {
    overflow: auto;
    max-height: calc(100vh - 220px);
    min-height: 20rem;
    background: #fff;
    border: 1px solid var(--wc-grid-line-strong);
    border-radius: .375rem;
    -webkit-overflow-scrolling: touch;
}
.work-calendar .wc-scroll:empty { display: none; }
.work-calendar .wc-grid {
    display: grid;
    grid-template-rows: var(--wc-head-h) auto;
    min-width: 100%;
    width: max-content;
}
.work-calendar .wc-grid.is-week { width: 100%; }

/* 左上の角・列見出し（上端に固定） */
.work-calendar .wc-corner,
.work-calendar .wc-colhead {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8f9fa;
    border-bottom: 1px solid var(--wc-grid-line-strong);
}
.work-calendar .wc-corner { left: 0; z-index: 4; border-right: 1px solid var(--wc-grid-line-strong); }
.work-calendar .wc-colhead {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 .25rem;
    border-left: 1px solid var(--wc-grid-line);
    font-size: .85rem;
    line-height: 1.2;
    overflow: hidden;
}
.work-calendar .wc-colhead > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-calendar .wc-colhead .wc-colhead-sub { font-weight: bold; }
.work-calendar .wc-colhead.is-today { background: #e3f2fd; color: #0d47a1; }
.work-calendar .wc-colhead.is-saturday { color: #1565c0; }
.work-calendar .wc-colhead.is-sunday { color: #c62828; }

/* 時間の目盛り列（左端に固定） */
.work-calendar .wc-timecol {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f8f9fa;
    border-right: 1px solid var(--wc-grid-line-strong);
}
.work-calendar .wc-hour-label {
    position: absolute;
    right: .35rem;
    transform: translateY(-50%);
    font-size: .75rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 0 .1rem;
}
.work-calendar .wc-hour-label:first-child { transform: none; }

/* 列（1時間ごとの横線・30分の点線） */
.work-calendar .wc-col {
    position: relative;
    border-left: 1px solid var(--wc-grid-line);
    background-image:
        repeating-linear-gradient(to bottom, var(--wc-grid-line-strong) 0 1px, transparent 1px var(--wc-hour-px)),
        repeating-linear-gradient(to bottom, transparent 0 calc(var(--wc-hour-px) / 2), #f1f3f5 calc(var(--wc-hour-px) / 2) calc(var(--wc-hour-px) / 2 + 1px), transparent calc(var(--wc-hour-px) / 2 + 1px) var(--wc-hour-px));
}
.work-calendar .wc-col.is-today { background-color: #f5fbff; }

/* 現在時刻の線 */
.work-calendar .wc-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px solid #e53935;
    z-index: 1;
    pointer-events: none;
}
.work-calendar .wc-now::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e53935;
}

/* バー */
.work-calendar .wc-bar {
    position: absolute;
    box-sizing: border-box;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: .75rem;
    line-height: 14px;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, .7);
}
.work-calendar .wc-bar:hover,
.work-calendar .wc-bar.is-active { z-index: 2; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.work-calendar .wc-bar-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.work-calendar .wc-bar-line.is-title { font-weight: bold; }
.work-calendar .wc-bar.is-narrow .wc-bar-line,
.work-calendar .wc-bar.is-narrow .wc-bar-tag { display: none; }

/* 案件日報：塗りつぶし・白文字 */
.work-calendar .wc-bar.is-photo { color: #fff; }

/* 通常日報：淡色の地・左帯・枠線・濃い文字 */
.work-calendar .wc-bar.is-daily {
    color: #212529;
    border-width: 1px 1px 1px 4px;
    border-style: solid;
}
.work-calendar .wc-bar-tag {
    position: absolute;
    top: 1px;
    right: 2px;
    padding: 0 3px;
    font-size: .625rem;
    line-height: 12px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .85);
    color: #495057;
}
.work-calendar .wc-bar.is-daily .wc-bar-line.is-title { padding-right: 2.2em; }

/* 作業中：斜線 */
.work-calendar .wc-bar.is-ongoing.is-photo {
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .28) 0 6px, transparent 6px 12px);
}
.work-calendar .wc-bar.is-ongoing.is-daily {
    background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, .08) 0 6px, transparent 6px 12px);
}

/* 終了未確認：点線の枠 */
.work-calendar .wc-bar.is-stale { border-style: dashed; border-width: 2px; }
.work-calendar .wc-bar.is-stale.is-daily { border-left-width: 4px; }

/* 表示時間帯の外へ続く印 */
.work-calendar .wc-bar-cont {
    display: block;
    text-align: center;
    font-size: .625rem;
    line-height: 10px;
    opacity: .9;
}

/* 範囲外 N 件 */
.work-calendar .wc-outside {
    position: absolute;
    left: 2px;
    right: 2px;
    z-index: 2;
    padding: 0 4px;
    font-size: .6875rem;
    line-height: 16px;
    text-align: center;
    color: #495057;
    background: #fff3cd;
    border: 1px solid #ffda6a;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.work-calendar .wc-outside.is-top { top: 2px; }
.work-calendar .wc-outside.is-bottom { bottom: 2px; }

/* メッセージ・読み込み中 */
.work-calendar .wc-message {
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
    background: #fff;
    border: 1px solid var(--wc-grid-line-strong);
    border-radius: .375rem;
}
.work-calendar .wc-message.is-error { color: #b02a37; background: #f8d7da; border-color: #f1aeb5; }
.work-calendar .wc-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
    background: rgba(255, 255, 255, .6);
    font-weight: bold;
    color: #495057;
}

/* 詳細表示（Popover） */
.wc-popover { max-width: 340px; }
.wc-popover .popover-body { font-size: .8125rem; }
.wc-popover .wc-detail-line { margin-bottom: .15rem; }
.wc-popover .wc-detail-list { margin: 0; padding-left: 1.1rem; }
