// Copyright (c) 2014, 2025, Oracle and/or its affiliates.  Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/

// !!!
// WARNING: do not directly import this file, instead import the
//          version in your theme's directory,
//          for example alta/widgets/_oj.alta.dvt.gantt.scss
// !!!

@import "../../utilities/oj.utilities";

@if $includeGanttClasses != false {
  @include module-include-once("common.gantt") {

    // This is to prevent the flash of unstyled content before the html becomes JET components.
    @if $initialVisibility == hidden {
      oj-gantt:not(.oj-complete) {
        visibility: hidden;
      }
    }

    /* Styling for the gantt widget */
    .oj-gantt {

        animation-duration: $dvtAnimationDuration;
        @include oj-user-select-property(none);

      
      outline: none;
    }

    /* Styling for the container (around time axis and databody) */
    .oj-gantt-container {

        fill: $dvtGanttBgColor;
        stroke: $dvtGanttBorderColor;
        
      // If stroke-width is 1px, then there is 0.5px border on each side of the edge, and because svg is
      // not pixel aware, in cases where the edge is between two pixels (e.g. on resize), the 0.5px doesn't show up, and the
      // entire stroke disappear. Fix is to double up the pixel so there there is always > 0.5px on each side of the edge
      // and use a clippath in gantt to hide the inner half of the stroke to maintain stroke width.
      stroke-width: 2px;
    }

    /* Styling for the empty text */
    .oj-gantt-no-data-message {

        fill: $dvtGanttEmptyTextColor;
        font-size:$dvtNoDataMessageFontSize;

    }

    /* Styling for horizontal grid lines */
    .oj-gantt-horizontal-gridline
    {

        stroke: $dvtGanttHorizontalGridlineColor;

      stroke-width: 1px;
    }

    /* Styling for vertical grid lines */
    .oj-gantt-major-vertical-gridline,
    .oj-gantt-minor-vertical-gridline {
      stroke: $dvtGanttVerticalGridlineColor;
      stroke-dasharray: 5,5;
    }

    /* Styling for all rows */
    .oj-gantt-row {

        fill: $dvtGanttRowBgColor;
        padding-top: 0.3571rem;
        padding-bottom: 0.3571rem;

    }

    /* Styling for row focus highlight */
    .oj-gantt-row.oj-focus-highlight {
      stroke-width: 1px;
      stroke-dasharray: 1 1;
      stroke: $primaryTextColor;
    }

    /* Styling related to rows as drop targets */
    .oj-gantt-row.oj-active-drop {

        fill: $dropTarget1Color;

    }

    /* Styling for all row labels */
    .oj-gantt-row-label {

        color: $headerTextColor;
        font-size: $fontSize;
        padding-left: 0.5714rem;
        padding-right: 0.5714rem;

    }

    /* Styling for all tasks */
    .oj-gantt-task {

        fill: $dvtGanttTaskBgColor;
        filter: url('#ojGanttTaskTintFilter');
        height: 1.5714rem;
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;

    }

    /* Styling for all tasks when hover */
    .oj-gantt-task.oj-hover {
      fill: none;
      filter: none;
      stroke-width: 2;
    }

    /* Styling for all tasks when focus */
    .oj-gantt-task.oj-focus {
      fill: none;
      filter: none;
      stroke-width: 2;
    }

    /* Styling for all tasks when selected */
    .oj-gantt-task.oj-selected {
      fill: none;
      filter: none;
      stroke: $dvtGanttTaskBorderColorSelected;
    }

    /* Styling for all task bars */
    .oj-gantt-task-bar {

        fill: $dvtGanttTaskBgColor;

    }

    /* Styling for all milestone tasks */
    .oj-gantt-task-milestone {

        fill: $dvtGanttMilestoneBgColor;

    }

    /* Styling for all summary tasks */
    .oj-gantt-task-summary {

        fill: $dvtGanttSummaryBgColor;

      filter: none;
    }

    /* Styling related to interactivity */
    .oj-gantt-task.oj-draggable,
    .oj-gantt-task-label.oj-draggable,
    .oj-gantt-task-progress.oj-draggable {
      cursor: move;
    }

    .oj-gantt-task-drag-image {
      fill-opacity: 0;

        stroke: $dvtGanttTaskDragImageBorderColor;

      stroke-width: 1px;
      stroke-dasharray: 5,2;
    }

    .oj-gantt-task-resize-handle {
      opacity: 0;
    }
    
    .oj-gantt-task-resize-handle.oj-draggable {
      cursor: ew-resize;
    }

    /* Styling for all task labels */
    .oj-gantt-task-label {

        color: $primaryTextColor;
        font-size: $smallFontSize;
        margin-left: 0.3571rem;
        margin-right: 0.3571rem;

    }

    /* Styling for all task progress indicators */
    .oj-gantt-task-progress {

        fill: $dvtGanttTaskBgColor;
        border-radius: 0;

    }

    /* Styling for all task overtime bars */
    .oj-gantt-task-overtime {
      fill: $dvtGanttMilestoneBgColor;
    }

    /* Styling for all task downtime bars */
    .oj-gantt-task-downtime {
      fill: $dvtGanttMilestoneBgColor;
      height: 0.25rem;
    }

    /* Styling for all task attribute bars */
    .oj-gantt-task-attribute {
      fill: $accentColorDvt9;
      height: 0.313rem;
    }

    /* Styling for all baseline */
    .oj-gantt-baseline {

        fill: $dvtGanttTaskBgColor;

      filter: url('#ojGanttTaskShadeFilter');
      border-radius: 0;
    }

    /* Styling for all baseline bars */
    .oj-gantt-baseline-bar {

        fill: $dvtGanttTaskBgColor;
        height: 0.4286rem;
        margin-top: 0px;

    }

    /* Styling for all milestone baseline */
    .oj-gantt-baseline-milestone {

          fill: $dvtGanttMilestoneBgColor;

    }

    /* Styling for the major time axis */
    .oj-gantt-major-axis {

          fill: $dvtGanttMajorAxisBgColor;
          stroke: $dvtGanttMajorAxisBorderColor;
          height: 1.6429rem;

    }

    /* Styling for the major time axis labels */
    .oj-gantt-major-axis-label {

          color: $dvtGanttMajorAxisLabelColor;
          font-size: $fontSize;

      font-weight: 500;
    }

    /* Styling for the major time axis separators */
    .oj-gantt-major-axis-separator {

            stroke: $dvtGanttMajorAxisSeparatorColor;

    }

    /* Styling for the minor time axis */
    .oj-gantt-minor-axis {

          fill: $dvtGanttMinorAxisBgColor;
          stroke: $dvtGanttMinorAxisBorderColor;
          height: 1.6429rem;

    }

    /* Styling for the minor time axis labels */
    .oj-gantt-minor-axis-label {

          color: $dvtGanttMinorAxisLabelColor;
          font-size: $smallFontSize;

      font-weight: normal;
    }

    /* Styling for the minor time axis separators */
    .oj-gantt-minor-axis-separator {

          stroke: $dvtGanttMinorAxisSeparatorColor;

    }

    /* Styling for reference object */
    .oj-gantt-reference-object-area {
      fill: $neutralColor17;
      opacity: 0.08;
      shape-rendering: crispEdges;
    }

    .oj-gantt-reference-object-line {
      stroke: $dvtTimelineReferenceObjectColor;
      shape-rendering: crispEdges;
    }

    .oj-gantt-reference-object-inner-line {
      stroke: $neutralColor2;
      shape-rendering: crispEdges;
    }

    /* Styling for the tooltip label */
    .oj-gantt-tooltip-label {

        font-size: $smallFontSize;
        color: $formControlLabelColor;

      padding: 0px 2px;
      white-space: nowrap;

      @include oj-ltr() {
        text-align: right;
      }
      @include oj-rtl() {
        text-align: left;
      }
    }

    /* Styling for the tooltip value */
    .oj-gantt-tooltip-value {

      color: $textColor;

      padding: 0px 2px;

      @include oj-ltr() {
        text-align: left;
      }
      @include oj-rtl() {
        text-align: right;
      }
    }

    /* Styling for the default tabular tooltip */
    .oj-gantt-tooltip-content {
      display: block;
      border-collapse: separate;
      border-spacing: 2px;
      overflow: hidden;
    }

    /* override dvt button styling for backwards variable compatibility */
    .oj-gantt .oj-dvt-button-outlined,
    .oj-gantt .oj-dvt-button-outlined.oj-hover,
    .oj-gantt .oj-dvt-button-outlined.oj-disabled {
      stroke: $dvtPanelBorderColor;
      fill: none;
    }

    .oj-gantt .oj-dvt-button-outlined.oj-active {
      stroke: $dvtIconBorderColorActive;
      fill: $dvtIconBgColorActive;
    }

    .oj-gantt .oj-dvt-button-outlined.oj-active .oj-dvt-icon {
      fill: $dvtIconColorActive;
    }

    /* Styling for all dependency lines */
    .oj-gantt-dependency-line {
      fill:none;

        stroke:$dvtGanttDependencyLineColor;

      stroke-width:1;
      marker-end: url('#ojGanttDependencyMarkerEndTriangle');
    }

    /* Styling for all dependency lines when focus */
    .oj-gantt-dependency-line.oj-focus {
      stroke-width:3;
    }

    /* Styling for all dependency line connectors */
    .oj-gantt-dependency-line-connector {

        fill:$dvtGanttDependencyLineColor;
        stroke:$dvtGanttDependencyLineColor;
      
    }

    /* Styling for custom content containers */
    .oj-gantt-task-custom svg,
    .oj-gantt-dependency-line-custom svg {
      // Apps always provide custom content wrapped inside a <svg> element in their template.
      // However, non-root svgs are overflow hidden as per both the browser's user agent and dvt base style sheets.
      // This has the effect of clipping all custom content's width and height by the width and height of the component's svg container.
      // We never want this overflow hidden behavior in Gantt because the custom content's dimensions can be bigger than the component's width and height,
      // e.g. the custom task content's width can increase past the component's width during horizontal time-based zoom in.
      overflow: visible;
    }

    /* Option defaults */
    $ganttDefaultOptions: ();
    $ganttTaskDefaultsDefaultOptions: ();
    $ganttTaskDefaultsBaselineDefaultOptions: ();
    $ganttTaskDefaultsProgressDefaultOptions: ();

    $ganttTaskDefaultsBaselineDefaultOptions: map-merge($ganttTaskDefaultsBaselineDefaultOptions, (borderRadius: "0"));
    $ganttTaskDefaultsDefaultOptions: map-merge($ganttTaskDefaultsDefaultOptions, (baseline: $ganttTaskDefaultsBaselineDefaultOptions));
    
    $ganttTaskDefaultsProgressDefaultOptions: map-merge($ganttTaskDefaultsProgressDefaultOptions, (borderRadius: "0"));
    $ganttTaskDefaultsDefaultOptions: map-merge($ganttTaskDefaultsDefaultOptions, (progress: $ganttTaskDefaultsProgressDefaultOptions));

    $ganttTaskDefaultsDefaultOptions: map-merge($ganttTaskDefaultsDefaultOptions, (borderRadius: "0"));
    $ganttDefaultOptions: map-merge($ganttDefaultOptions, (taskDefaults: $ganttTaskDefaultsDefaultOptions));

    .oj-gantt-option-defaults {
        font-family: oj-json($ganttDefaultOptions) !important;
    }
  }
}
