/* DashGantt.css */

/* #region Base Container Styles
   Main container and root level styling
-------------------------------------------------- */
.dash-gantt {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    font-size: 16px;
    background-color: #ffffff;
}

.dash-gantt-content {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}
/* #endregion */

/* #region Header Styles 
   Contains title and timeline header styling
-------------------------------------------------- */
.dash-gantt-header-container {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    flex-shrink: 0;
    height: 48px;
    position: relative;
    z-index: 10; /* Ensure header stays above content during scroll */
}

.dash-gantt-title {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-right: 1px solid #e2e8f0;
    background-color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: width 0.05s ease-out;
    box-sizing: border-box;
    z-index: 2;
}

.dash-gantt-header-timeline {
    flex-grow: 1;
    overflow: hidden;
}

.dash-gantt-time-cell {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #e2e8f0;
    font-size: 0.875rem;
    background: white;
}
/* #endregion */

/* #region Left Column Job List Styles
   Styles for the fixed left column containing job titles
-------------------------------------------------- */
.dash-gantt-jobs {
    width: 250px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    background: white;
    scrollbar-width: none;
    transition: width 0.05s ease-out;
    z-index: 5;
}

.dash-gantt-job-row {
    height: 48px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
}

.dash-gantt-job-title {
    flex-grow: 1;
    display: flex;
    min-width: 0;
    align-items: center;
    padding: 0 1rem;
    box-sizing: border-box;
    width: 100%;
}

.dash-gantt-job-content {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.dash-gantt-resize-handle {
    width: 4px;
    cursor: col-resize;
    position: absolute;
    top: 0;
    bottom: 0;
    background: transparent;
    transition: background-color 0.2s;
    z-index: 10;
}

.dash-gantt-resize-handle:hover,
.dash-gantt-resize-handle:active {
    background-color: #e2e8f0;
}

.dash-gantt-job-title {
    flex-grow: 1;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-sizing: border-box;
    width: 100%;
    /* white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
    display: inline-block; */
}

.dash-gantt-job-content {
    display: grid;
    grid-template-columns: 24px 1fr; /* Fixed width for caret/placeholder + content */
    align-items: center;
    width: 100%;
    gap: 8px;
}

.dash-gantt-caret-container {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-gantt-job-content-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* Allows text truncation */
}

/* Update indentation to account for grid layout */
.dash-gantt-job-content[data-level="0"] { padding-left: 0; }
.dash-gantt-job-content[data-level="1"] { padding-left: 24px; }
.dash-gantt-job-content[data-level="2"] { padding-left: 48px; }
.dash-gantt-job-content[data-level="3"] { padding-left: 72px; }
.dash-gantt-job-content[data-level="4"] { padding-left: 96px; }
.dash-gantt-job-content[data-level="5"] { padding-left: 120px; }
.dash-gantt-job-content[data-level="6"] { padding-left: 144px; }
.dash-gantt-job-content[data-level="7"] { padding-left: 168px; }
.dash-gantt-job-content[data-level="8"] { padding-left: 192px; }

.dash-gantt-caret {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    color: #666;
    transition: transform 0.2s ease;
}

.dash-gantt-job-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
/* #endregion */

/* #region Timeline Content Styles
   Styles for the main timeline area including grid and items
-------------------------------------------------- */
.dash-gantt-timeline {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.dash-gantt-timeline-scroll {
    overflow: auto;
    height: 100%;
    width: 100%;
    position: relative;
}

.dash-gantt-timeline-wrapper {
    position: relative;
    height: 100%;
    min-width: 100%;
}

.dash-gantt-timeline-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.dash-gantt-timeline-row {
    height: 48px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Current time indicator */
.dash-gantt-current-time {
    position: absolute;
    top: 0;
    bottom: 0;
    height: 100%;
    width: 2px;
    background-color: #ef4444;
    z-index: 3;
    pointer-events: none;
}
/* #endregion */

/* #region Task Bar Styles
   Styles for individual task bars in the timeline
-------------------------------------------------- */
.dash-gantt-task-bar {
    position: absolute;
    height: 32px;
    top: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 30px;
    z-index: 1;
}

.dash-gantt-task-bar:hover {
    opacity: 0.9;
    transform: scale(1.01);
    z-index: 2;
}

.dash-gantt-task-label {
    display: block;
    color: white;
    text-align: center;
    font-size: 12px;
    line-height: 32px;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* #endregion */

/* #region Line Chart Styles
   Styles for line chart visualization in timeline
-------------------------------------------------- */
.dash-gantt-line-chart {
    position: absolute;
    height: 40px;
    top: 4px;
    z-index: 1;
}

.dash-gantt-line-chart:hover {
    z-index: 2;
}
/* #endregion */

/* #region Tooltip Styles
   Custom tooltip styling for task bars and line charts
-------------------------------------------------- */
.dash-gantt {
    --tooltip-bg: rgba(0, 0, 0, 0.8);
}

.dash-gantt-tooltip {
    position: fixed; /* Use fixed positioning to follow cursor */
    background: var(--tooltip-bg);
    color: white;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: pre-line;
    pointer-events: none;
    z-index: 9999; /* Ensure it's above everything */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    word-wrap: break-word;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.dash-gantt-tooltip.visible {
    visibility: visible;
    opacity: 1;
}
/* #endregion */

/* #region Scrollbar Styling
   Custom scrollbar appearance for better UX
-------------------------------------------------- */
.dash-gantt *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dash-gantt *::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dash-gantt *::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dash-gantt *::-webkit-scrollbar-thumb:hover {
    background: #666;
}
/* #endregion */

/* #region Grid Styles
   Background grid lines and row backgrounds
-------------------------------------------------- */
.dash-gantt-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.dash-gantt-grid-row {
    height: 48px;
    border-bottom: 1px solid #f0f0f0;
}

.dash-gantt-grid-row:nth-child(even) {
    background-color: #fafafa;
}

.dash-gantt-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #f0f0f0;
}
/* #endregion */

/* #region Responsive Adjustments
   Media queries and responsive behavior
-------------------------------------------------- */
@media (max-width: 768px) {
    .dash-gantt-job-content[data-level="0"] { padding-left: 16px; }
    .dash-gantt-job-content[data-level="1"] { padding-left: 32px; }
    .dash-gantt-job-content[data-level="2"] { padding-left: 48px; }
    .dash-gantt-job-content[data-level="3"] { padding-left: 64px; }
    .dash-gantt-job-content[data-level="4"] { padding-left: 80px; }
    .dash-gantt-job-content[data-level="5"] { padding-left: 96px; }
    .dash-gantt-job-content[data-level="6"] { padding-left: 112px; }
    .dash-gantt-job-content[data-level="7"] { padding-left: 128px; }
    .dash-gantt-job-content[data-level="8"] { padding-left: 144px; }

    .dash-gantt-title,
    .dash-gantt-jobs {
        width: 200px;
    }

    .dash-gantt-resize-handle {
        left: 200px;
    }
}
/* #endregion */