﻿.wfTimeline {
    font-family: Arial, sans-serif;
    border: 1px solid #ddd;
    width: 100%;
    background: #fff;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 50%;
    --wfTimelineMonthHeaderH: 34px;
    --wfTimelineDayHeaderH: 34px;
    
    --wfTimelineRowMinH: 48px;
    --wfTimelineRowLabelW: 240px;
    --wfTimelineDayW: 100px;
}

/* Layout */
.wfTimeline__top {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.wfTimeline__topLeft {
    width: var(--wfTimelineRowLabelW);
    min-width: var(--wfTimelineRowLabelW);
    border-right: 1px solid #e5e7eb;
}

.wfTimeline__topRight {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

.wfTimeline__topLeft,
.wfTimeline__leftBody {
    width: var(--wfTimelineRowLabelW);
    min-width: var(--wfTimelineRowLabelW);    
}

.wfTimeline__body {
    display: flex;
    flex: 1 1 auto;
    overflow-y: auto;
}

.wfTimeline__leftBody {
    width: var(--wfTimelineRowLabelW);
    min-width: var(--wfTimelineRowLabelW);
    border-right: 1px solid #e5e7eb;
    overflow: auto;
    /* solo verticale */
    overflow-x: hidden;
}

.wfTimeline__rightBody {
    flex: 1;
    overflow: auto;
    /* verticale + orizzontale */
    background: #fff;
}

/* Header left */
.wfTimeline__monthCorner,
.wfTimeline__rowCorner {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-weight: 700;
    white-space: nowrap;
}

.wfTimeline__monthCorner {
    height: var(--wfTimelineMonthHeaderH);
    background: #e5e7eb;
    border-bottom: 1px solid #d1d5db;
}

.wfTimeline__rowCorner {
    height: var(--wfTimelineDayHeaderH);
    background: #f5f5f5;
}

/* Header right */
.wfTimeline__monthRow,
.wfTimeline__dayRow {
    display: flex;
    width: max-content;
}

.wfTimeline__monthHeaderCell {
    height: var(--wfTimelineMonthHeaderH);
    width: calc(var(--wfTimelineSpan, 1) * var(--wfTimelineDayW));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-weight: 700;
    background: #f3f4f6;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.wfTimeline__dayHeaderCell {
    height: var(--wfTimelineDayHeaderH);
    width: var(--wfTimelineDayW);
    min-width: var(--wfTimelineDayW);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-weight: 600;
    background: #fafafa;
    border-right: 1px solid #eee;
    white-space: nowrap;
}

/* Left labels (height sync via JS) */
.wfTimeline__rowLabel {
    min-height: var(--wfTimelineRowMinH);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    background: #fff;
    font-weight: 600;
    font-size: 1.2em;
}

/* Right grid rows (auto height) */
.wfTimeline__gridRow {
    display: flex;
    width: max-content;
    align-items: stretch;
}

.wfTimeline__cell {
  box-sizing: border-box;
  width: var(--wfTimelineDayW);      
  min-width: var(--wfTimelineDayW);  
  min-height: var(--wfTimelineRowMinH);
  padding: 5px 4px;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  background: #fff;
  align-self: stretch;
}

.wfTimeline__cellContent {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-content: flex-start;
}

/* Item */
.wfTimeline__item {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 18px;
    background: #e8eefc;
    border: 1px solid #d3dcfb;
    cursor: grab;
    user-select: none;
    max-width: 100%;
}

.wfTimeline__item:active {
    cursor: grabbing;
}

/* Non draggable */
.wfTimeline__item--locked {
    cursor: auto;    
}

/* Esempi classi custom */
.wfTimelineItem--red {
    background: #fee2e2;
    border-color: #fecaca;
}

.wfTimelineItem--green {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.wfTimelineItem--blue {
    background: #dbeafe;
    border-color: #bfdbfe;
}

/* Weekend */
.wfTimeline__isSaturday {
    background: #f9fafb;
}

.wfTimeline__isSunday {
    background: #fef2f2;
}

.wfTimeline__dayHeaderCell.wfTimeline__isSaturday,
.wfTimeline__dayHeaderCell.wfTimeline__isSunday {
    font-weight: 700;
}

.wfTimeline__cell.wfTimeline__isSaturday {
    background: #fcfcfd;
}

.wfTimeline__cell.wfTimeline__isSunday {
    background: #fff7f7;
}

/* Drag feedback */
.wfTimeline__dragOver {
    outline: 2px dashed #9ca3af;
    outline-offset: -2px;
}

.wfTimeline__dragging {
    opacity: 0.6;
}

/* Tooltip (HTML custom) */
.wfTimeline__tooltip {
    position: fixed;
    z-index: 99999;
    max-width: 360px;
    background: #cacaca;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    pointer-events: auto;    
}

.wfTimeline__tooltip a {
    color: #93c5fd;
    text-decoration: underline;
}

.wfTimeline__tooltipTitle {
    font-weight: 700;
    margin-bottom: 4px;
}



#timelineContainer .wfTimeline {
    --wfTimelineDayW: 140px;
}

@media (max-width: 1200px) {
    #timelineContainer .wfTimeline {
        --wfTimelineDayW: 110px;
        --wfTimelineRowLabelW: 200px;
    }
}

@media (max-width: 800px) {
    #timelineContainer .wfTimeline {
        --wfTimelineDayW: 90px;
        --wfTimelineRowLabelW: 160px;
    }
}