/**
 * Gantt Drag-and-Drop Styles
 * Phase 3: Custom Drag-and-Drop Implementation
 */

/* ============================================================================
   CURSOR STYLES
   ============================================================================ */

/* Draggable task bars show grab cursor on hover */
.gantt-task-draggable {
    cursor: grab !important;
}

.gantt-task-draggable:hover {
    opacity: 0.9;
}

/* During active drag, show grabbing cursor */
.gantt-task-dragging {
    cursor: grabbing !important;
    opacity: 0.7;
}

/* Apply grab cursor to jsGantt task bars (parent tasks only) */
.gtaskbar,
.gtaskbarcontainer {
    cursor: grab;
}

/* ============================================================================
   DRAG GHOST ELEMENT
   ============================================================================ */

.gantt-drag-ghost {
    position: fixed;
    opacity: 0.8;
    pointer-events: none;
    background: #4A90E2;
    border: 2px solid #2E5C8A;
    border-radius: 3px;
    padding: 6px 12px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    transform: translate(10px, 10px); /* Offset from cursor */
}

/* ============================================================================
   GRID SNAP INDICATOR
   ============================================================================ */

.gantt-drag-indicator {
    position: absolute;
    width: 2px;
    background: #FF6B6B;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.7;
}

.gantt-drag-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    width: 6px;
    height: 100%;
    background: linear-gradient(to right,
        rgba(255, 107, 107, 0.2),
        rgba(255, 107, 107, 0.6),
        rgba(255, 107, 107, 0.2)
    );
}

/* ============================================================================
   DATE PREVIEW TOOLTIP
   ============================================================================ */

.gantt-drag-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 10000;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.gantt-drag-tooltip .tooltip-dates {
    font-weight: 600;
    margin-bottom: 4px;
}

.gantt-drag-tooltip .tooltip-delta {
    font-size: 10px;
    opacity: 0.8;
    font-style: italic;
}

.gantt-drag-tooltip .tooltip-delta.positive {
    color: #90EE90;
}

.gantt-drag-tooltip .tooltip-delta.negative {
    color: #FFB6B6;
}

/* ============================================================================
   CHILD TASK HIGHLIGHTING
   ============================================================================ */

.gantt-child-highlighted {
    background-color: rgba(74, 144, 226, 0.15) !important;
    transition: background-color 0.2s ease;
    position: relative;
}

.gantt-child-highlighted::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #4A90E2 0%, #2E5C8A 100%);
    box-shadow: 2px 0 6px rgba(74, 144, 226, 0.3);
}

.gantt-child-highlighted .gtaskbar {
    opacity: 0.95;
    box-shadow: 0 0 8px rgba(74, 144, 226, 0.4);
    transition: box-shadow 0.2s ease;
}

/* Add subtle border to highlighted child rows */
.gantt-child-highlighted td {
    border-top: 1px solid rgba(74, 144, 226, 0.4);
    border-bottom: 1px solid rgba(74, 144, 226, 0.4);
}

.gantt-child-highlighted td:first-child {
    border-left: 4px solid rgba(74, 144, 226, 0.6);
    padding-left: 8px;
}

/* Add pulsing animation to child highlights */
@keyframes child-highlight-pulse {
    0%, 100% {
        background-color: rgba(74, 144, 226, 0.15);
    }
    50% {
        background-color: rgba(74, 144, 226, 0.25);
    }
}

.gantt-child-highlighted {
    animation: child-highlight-pulse 2s ease-in-out infinite;
}

/* ============================================================================
   DRAG PREVIEW BARS (Alternative to ghost)
   ============================================================================ */

.gantt-drag-preview-bar {
    position: absolute;
    height: 100%;
    background: #4A90E2;
    opacity: 0.4;
    border: 2px dashed #2E5C8A;
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
    transition: left 0.05s ease-out, width 0.05s ease-out;
}

/* ============================================================================
   DISABLED/READONLY STATE
   ============================================================================ */

.gantt-drag-disabled .gtaskbar,
.gantt-drag-disabled .gtaskbarcontainer {
    cursor: default !important;
}

.gantt-drag-disabled .gtaskbar:hover,
.gantt-drag-disabled .gtaskbarcontainer:hover {
    opacity: 1 !important;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes gantt-pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.gantt-task-dragging {
    animation: gantt-pulse 1s ease-in-out infinite;
}

/* Smooth transitions for ghost movement */
.gantt-drag-ghost {
    transition: none; /* Disable transitions during drag for immediate feedback */
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .gantt-drag-ghost {
        font-size: 11px;
        padding: 4px 8px;
    }

    .gantt-drag-tooltip {
        font-size: 10px;
        padding: 6px 10px;
    }
}

/* ============================================================================
   PHASE 3.9: MULTI-COLORED PARENT TASK BARS (WHEN COLLAPSED)
   ============================================================================ */

/* Container for multi-colored bar */
.gmulticolored {
    overflow: hidden;
    display: flex;
    position: relative;
}

/* Individual segment within multi-colored bar */
.gtasksegment {
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
    transition: filter 0.2s ease-in-out;
}

/* Remove border from last segment */
.gtasksegment:last-child {
    border-right: none;
}

/* Hover effect for segments */
.gtasksegment:hover {
    filter: brightness(1.15);
    cursor: grab;
}

/* During drag, segments maintain grabbing cursor */
.gantt-task-dragging .gtasksegment {
    cursor: grabbing;
}

/* Smooth transition for collapse/expand animations */
.gtaskbarcontainer {
    transition: all 0.2s ease-in-out;
}

/* Ensure segments stay positioned correctly */
.gmulticolored .gtasksegment {
    position: absolute;
    top: 0;
    bottom: 0;
}

/* Responsive adjustments for segments */
@media (max-width: 768px) {
    .gtasksegment {
        border-right-width: 0.5px;
    }
}
