/* タスク管理用CSS */
.view-mode-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.view-mode-buttons {
    flex-shrink: 0;
}

.date-selection-form {
    flex-shrink: 0;
}

.task-card {
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.task-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.task-card .card-body {
    padding: 0.75rem;
}

.task-card .card-title {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-card .small {
    font-size: 0.8rem;
    line-height: 1.2;
}

.task-card .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

.task-card .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
}

/* カレンダー表示用CSS */
.task-calendar {
    table-layout: fixed;
    width: 100%;
}

.task-calendar th {
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #f8f9fa;
    padding: 0.3rem;
    width: 14.285714%; /* 7分の1: 正確な固定幅 */
}

.task-calendar-cell {
    vertical-align: top;
    padding: 0 !important; /* padding完全削除 */
    height: 110px; /* タスク5個分の固定高さ */
    width: 14.285714%; /* 7分の1: 正確な固定幅 */
    position: relative;
    border: 1px solid #dee2e6;
    cursor: pointer; /* セル全体クリック可能 */
    overflow: hidden; /* はみ出し防止 */
}

.task-calendar-cell:hover {
    background-color: #f8f9fa;
}

.task-calendar-cell .day-number {
    font-size: 0.75rem;
    color: #333;
    margin: 0;
    padding: 2px 4px;
    font-weight: 600;
    pointer-events: none; /* クリックを親要素に伝える */
}

.task-calendar-cell .task-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    height: 90px; /* 固定高さ：タスク5個分（18px × 5） */
    padding: 0 2px 2px 2px;
}

.task-calendar-cell .task-item {
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 2px;
    background-color: #e9ecef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    height: 18px; /* 固定高さ */
    display: flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    z-index: 1;
    position: relative;
}

.task-calendar-cell .task-item:hover {
    background-color: #dee2e6;
    z-index: 2;
}

.task-status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}

/* 日付ポップアップモーダル用CSS */
.day-tasks-modal .modal-dialog {
    max-width: 600px;
    margin: 1.75rem auto;
}

.day-tasks-modal .task-card-mini {
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.day-tasks-modal .task-card-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.day-tasks-modal .task-card-mini .card-body {
    padding: 0.75rem;
}

.day-tasks-modal .task-card-mini h6 {
    font-size: 0.95rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.day-tasks-modal .task-card-mini .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

.day-tasks-modal .task-card-mini .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

/* モバイル対応: ポップアップ */
@media (max-width: 768px) {
    .day-tasks-modal .modal-dialog {
        max-width: calc(100% - 1rem);
        margin: 0.5rem;
    }
    
    .day-tasks-modal .modal-content {
        max-height: calc(100vh - 1rem);
        display: flex;
        flex-direction: column;
    }
    
    .day-tasks-modal .modal-body {
        overflow-y: auto;
        flex: 1;
    }
    
    .day-tasks-modal .task-card-mini {
        margin-bottom: 0.5rem;
    }
    
    .day-tasks-modal .task-card-mini .card-body {
        padding: 0.5rem;
    }
    
    .day-tasks-modal .task-card-mini h6 {
        font-size: 0.85rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    
    .day-tasks-modal .task-card-mini .small {
        font-size: 0.75rem;
    }
    
    .day-tasks-modal .task-card-mini .btn {
        padding: 0.15rem 0.3rem;
        font-size: 0.7rem;
    }
    
    .day-tasks-modal .task-card-mini .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }
}

/* モバイル対応 */
@media (max-width: 768px) {
    .task-calendar th {
        font-size: 0.65rem;
        padding: 0.2rem;
        width: 14.285714%; /* 7分の1: 正確な固定幅 */
    }
    
    .task-calendar-cell {
        height: 110px; /* タスク5個分の固定高さ */
        padding: 0;
        width: 14.285714%; /* 7分の1: 正確な固定幅 */
    }
    
    .task-calendar-cell .day-number {
        font-size: 0.6rem;
        padding: 1px 2px;
    }
    
    .task-calendar-cell .task-list {
        height: 90px; /* タスク5個分（18px × 5） */
        padding: 0 1px 1px 1px;
    }
    
    .task-calendar-cell .task-item {
        font-size: 0.6rem;
        height: 18px;
        padding: 1px 2px;
    }
    
    .task-status-dot {
        width: 4px;
        height: 4px;
        margin-right: 2px;
    }
}

/* ガントチャート表示用CSS */
.gantt-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    background-color: #fff;
    /* スクロールバーを非表示 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE, Edge */
}

.gantt-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.gantt-content {
    /* PC: 画面幅に収める、モバイル: 固定幅でスクロール */
    min-width: 100%;
    width: 100%;
}

/* ガントチャートヘッダー */
.gantt-header {
    display: flex;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.gantt-task-label-header {
    width: 250px;
    flex-shrink: 0;
    padding: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    border-right: 2px solid #dee2e6;
}

.gantt-timeline-header {
    flex: 1;
    display: flex;
    min-width: 0; /* flexアイテムの縮小を許可 */
}

.gantt-hour-mark {
    flex: 1; /* 均等に配分 */
    min-width: 0; /* 縮小を許可 */
    flex-shrink: 1;
    text-align: center;
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 500;
    padding: 12px 2px;
    border-right: 1px solid #e9ecef;
}

/* ガントチャート本体 */
.gantt-body {
    background-color: #fff;
}

.gantt-row {
    display: flex;
    min-height: 40px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
    transition: background-color 0.2s ease;
}

.gantt-row:hover {
    background-color: #f8f9fa;
}

/* タスク情報（左側固定） */
.gantt-task-label {
    width: 250px;
    flex-shrink: 0;
    padding: 6px 12px;
    border-right: 2px solid #dee2e6;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gantt-task-title {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

/* タイムライン（右側スクロール） */
.gantt-timeline {
    flex: 1;
    position: relative;
    height: 40px;
    min-width: 0; /* flexアイテムの縮小を許可 */
    display: flex;
}

/* グリッド線（24本） */
.gantt-grid-line {
    flex: 1; /* 均等に配分 */
    min-width: 0;
    height: 100%;
    border-right: 1px solid #f0f0f0;
    pointer-events: none;
}

/* タスクバー */
.gantt-bar {
    position: absolute;
    height: 28px;
    top: 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0 10px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    z-index: 1;
}

.gantt-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 5;
}

.gantt-bar-allday {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    border: 1px solid rgba(255,255,255,0.2);
}

.gantt-bar-label {
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* モバイル対応: ガントチャート */
@media (max-width: 768px) {
    /* 表示モード切替のレイアウト調整 */
    .view-mode-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .view-mode-buttons .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .date-selection-form .form-control-sm {
        font-size: 0.8rem;
    }
    
    /* ガントチャート - モバイルは固定幅でスクロール */
    .gantt-content {
        min-width: 1000px; /* モバイル用固定幅 */
        width: 1000px;
    }
    
    .gantt-task-label-header,
    .gantt-task-label {
        width: 150px; /* モバイルでは少し狭く */
    }
    
    .gantt-timeline-header {
        flex: 1;
        display: flex;
        min-width: calc(1000px - 150px);
    }
    
    .gantt-timeline {
        flex: 1;
        min-width: calc(1000px - 150px);
        display: flex;
    }
    
    .gantt-hour-mark {
        flex: 1;
        min-width: 0;
        font-size: 0.65rem;
        padding: 8px 2px;
    }
    
    .gantt-grid-line {
        flex: 1;
        min-width: 0;
    }
    
    .gantt-task-title {
        font-size: 0.75rem;
    }
    
    .gantt-bar {
        height: 26px;
        top: 5px;
        padding: 0 6px;
    }
    
    .gantt-bar-label {
        font-size: 0.65rem;
    }
}

/* 前後月のカレンダーセル */
.task-calendar-cell.other-month-cell {
    background-color: #f8f9fa;
    opacity: 0.7;
}

.task-calendar-cell.other-month-cell .task-item {
    opacity: 0.8;
}

/* 今日の日付 */
.task-calendar-cell.today-cell {
    background-color: #fff8e1;
    border: 2px solid #ffc107 !important;
}

.day-number.today-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #ffc107;
    color: #212529;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.85rem;
}

/* 日時横並びレイアウト */
.datetime-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
}

.datetime-label {
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.85rem;
    min-width: 30px;
    flex-shrink: 0;
}

.datetime-row input[type="date"] {
    min-width: 0;
    width: 130px;
    flex-shrink: 1;
    font-size: 0.8rem;
    padding: 3px 4px;
    height: auto;
}

.datetime-row .time-field {
    flex-shrink: 0;
}

.time-picker-wrapper {
    gap: 2px !important;
}

.time-hour-select,
.time-minute-select {
    width: 52px !important;
    font-size: 0.8rem !important;
    padding: 3px 2px !important;
    height: auto !important;
    text-align: center;
}

/* スマホでも横並びを維持 */
@media (max-width: 576px) {
    .datetime-row input[type="date"] {
        width: 112px;
        font-size: 0.75rem;
        padding: 2px 3px;
    }

    .time-hour-select,
    .time-minute-select {
        width: 44px !important;
        font-size: 0.75rem !important;
        padding: 2px 1px !important;
    }

    .datetime-label {
        font-size: 0.8rem;
        min-width: 26px;
    }
}
