/* ============================================
   SUBTASK SYSTEM STYLES
   Hierarchical Task Display & Interaction
   ============================================ */

/* Subtask Wrapper */
.kanban-task-wrapper {
    position: relative;
    transition: margin-left 0.2s ease;
}

/* Collapse Button */
.subtask-collapse-btn {
    position: absolute;
    left: -20px;
    top: 8px;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #b0b0b0;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.subtask-collapse-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #6366f1;
    transform: scale(1.1);
}

/* Subtask Card Styling */
.kanban-task-card.is-subtask {
    background: linear-gradient(to right, 
        rgba(99, 102, 241, 0.15) 0%, 
        rgba(99, 102, 241, 0.08) 8%,
        transparent 8%,
        transparent 100%
    );
    border-left: 4px solid rgba(99, 102, 241, 0.6);
    font-size: 13px;
    opacity: 0.95;
    margin-left: 24px;
    position: relative;
}

/* Daha derin seviyeler için daha koyu mor */
.kanban-task-card.is-subtask[data-level="2"] {
    border-left-color: rgba(139, 92, 246, 0.7);
    box-shadow: -8px 0 12px -8px rgba(139, 92, 246, 0.5) inset;
}

.kanban-task-card.is-subtask[data-level="3"] {
    border-left-color: rgba(168, 85, 247, 0.8);
    box-shadow: -8px 0 12px -8px rgba(168, 85, 247, 0.6) inset;
}

/* Subtask connection line */
.kanban-task-card.is-subtask::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 0;
    bottom: 50%;
    width: 2px;
    background: rgba(99, 102, 241, 0.3);
}

/* Subtask horizontal line */
.kanban-task-card.is-subtask::after {
    content: '';
    position: absolute;
    left: -22px;
    top: 50%;
    width: 18px;
    height: 2px;
    background: rgba(99, 102, 241, 0.3);
}

.kanban-task-card.is-subtask:hover {
    background: rgba(99, 102, 241, 0.15);
    border-left-color: rgba(99, 102, 241, 0.8);
    transform: translateX(3px);
    transition: all 0.2s ease;
}

.kanban-task-card.is-subtask:hover::before,
.kanban-task-card.is-subtask:hover::after {
    background: rgba(99, 102, 241, 0.5);
}

/* ============================================
   TASK-CARD SPLIT-ZONE DRAG & DROP (ClickUp Style)
   Sol yarı: Normal sıralama | Sağ yarı: Subtask
   ============================================ */

/* Task card split zones */
.task-item {
    position: relative;
}

/* Left zone (Normal sorting) - 50% */
.task-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    background: transparent;
    border-right: 2px dashed transparent;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

/* Right zone (Subtask) - 50% */
.task-item::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    background: transparent;
    border-left: 2px dashed transparent;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

/* Show zones when dragging over */
body.is-dragging-task .task-item::before,
body.is-dragging-task .task-item::after {
    opacity: 1;
}

/* Left zone hover - GREEN */
.task-item.drag-over-left::before {
    background: linear-gradient(to right, 
        rgba(34, 197, 94, 0.2),
        rgba(34, 197, 94, 0.05)
    );
    border-right-color: rgba(34, 197, 94, 0.6);
    opacity: 1;
    animation: pulse-zone 0.6s ease-in-out infinite;
}

/* Right zone hover - PURPLE */
.task-item.drag-over-right::after {
    background: linear-gradient(to left, 
        rgba(99, 102, 241, 0.2),
        rgba(99, 102, 241, 0.05)
    );
    border-left-color: rgba(99, 102, 241, 0.6);
    opacity: 1;
    animation: pulse-zone 0.6s ease-in-out infinite;
}

/* Drop zone indicators (icons) */
.task-item.drag-over-left::before {
    content: '↕';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(34, 197, 94, 0.9);
    font-weight: bold;
}

.task-item.drag-over-right::after {
    content: '↳';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(99, 102, 241, 0.9);
    font-weight: bold;
}

/* Animations */
@keyframes pulse-zone {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Smooth collapse/expand animation */
@keyframes collapse-fade {
    from {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
}

/* Subtask collapse animation */
.kanban-task-card.is-subtask {
    animation: collapse-fade 0.3s ease-in-out forwards;
}

/* Parent with collapsed subtasks */
.kanban-task-card.has-collapsed-subtasks {
    position: relative;
}

.kanban-task-card.has-collapsed-subtasks::after {
    content: attr(data-subtask-count);
    position: absolute;
    top: -8px;
    right: -8px;
    background: #fbbf24;
    color: #000;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    animation: bounce-badge 0.4s ease-out;
}

@keyframes bounce-badge {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Kanban task-item subtask styling */
.task-item.is-subtask {
    background: linear-gradient(to right,
        rgba(99, 102, 241, 0.12) 0%,
        rgba(99, 102, 241, 0.06) 6%,
        transparent 6%,
        transparent 100%
    ) !important;
    padding-left: 12px;
    border-left: 3px solid rgba(99, 102, 241, 0.5);
}

.task-item.is-subtask:hover {
    background: linear-gradient(to right,
        rgba(99, 102, 241, 0.18) 0%,
        rgba(99, 102, 241, 0.09) 6%,
        transparent 6%,
        transparent 100%
    ) !important;
    border-left-color: rgba(99, 102, 241, 0.7);
}

/* Nested subtask indicators */
.task-item.is-subtask[data-level="2"],
.task-item.is-subtask[data-level="3"],
.task-item.is-subtask[data-level="4"] {
    border-left-color: rgba(139, 92, 246, 0.6);
}

.task-item.is-subtask[data-level="2"],
.task-item.is-subtask[data-level="3"],
.task-item.is-subtask[data-level="4"] {
    background: linear-gradient(to right,
        rgba(139, 92, 246, 0.12) 0%,
        rgba(139, 92, 246, 0.06) 6%,
        transparent 6%,
        transparent 100%
    ) !important;
}

/* Kanban display subtask card styling (already defined) */
/* .kanban-task-card.is-subtask - defined earlier in this file */
    .task-item::before,
    .task-item::after {
        font-size: 16px;
    }


/* Drop Indicator */
.subtask-drop-indicator {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 2px dashed rgba(99, 102, 241, 0.6);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #6366f1;
    z-index: 100;
    pointer-events: none;
    gap: 8px;
}

.subtask-drop-indicator i {
    font-size: 16px;
}

/* Hover Target State */
.subtask-hover-target {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
    transform: scale(1.02);
}

/* Dragging State */
.dragging-subtask {
    opacity: 0.5;
    cursor: grabbing;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.pulse-animation {
    animation: pulse 1s ease-in-out infinite;
}

/* Subtask Count Badge */
.subtask-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Collapse Badge (when collapsed) - shows subtask count */
.subtask-collapse-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    border: 1px solid rgba(234, 179, 8, 0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { 
        opacity: 0.8; 
        transform: scale(1); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.05); 
    }
}

/* Dragging with parent visual indicator */
.dragging-with-parent {
    opacity: 0.5;
    background: rgba(99, 102, 241, 0.15) !important;
    border-left: 3px dashed rgba(99, 102, 241, 0.7) !important;
    animation: pulse-drag 0.6s ease-in-out infinite;
}

@keyframes pulse-drag {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.7; }
}

/* Collapse Badge (when collapsed) */
.subtask-collapse-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    border: 1px solid rgba(234, 179, 8, 0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Level Indicators */
.task-level-0 {
    font-weight: 600;
}

.task-level-1 {
    font-weight: 500;
    opacity: 0.95;
}

.task-level-2 {
    font-weight: 400;
    opacity: 0.9;
}

/* Gantt Subtask Styles */
.gantt-bar.is-subtask {
    opacity: 0.85;
    height: 24px;
}

.gantt-task-row.is-subtask {
    background: rgba(255, 255, 255, 0.02);
}

.gantt-task-row.is-subtask .gantt-task-name-col {
    padding-left: 32px;
    font-size: 13px;
}

.gantt-task-row.is-subtask::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(99, 102, 241, 0.2);
}

/* List View Subtask */
.list-task-item.is-subtask {
    padding-left: 40px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid rgba(99, 102, 241, 0.3);
}

/* Calendar Subtask */
.calendar-event.is-subtask {
    opacity: 0.85;
    font-size: 12px;
    padding-left: 24px;
}

.calendar-event.is-subtask::before {
    content: '└';
    position: absolute;
    left: 8px;
    color: rgba(99, 102, 241, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .subtask-collapse-btn {
        left: -18px;
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
    
    .subtask-drop-indicator {
        font-size: 11px;
    }
}

/* Accessibility */
.subtask-collapse-btn:focus {
    outline: 2px solid rgba(99, 102, 241, 0.6);
    outline-offset: 2px;
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .kanban-task-card.is-subtask {
        background: rgba(0, 0, 0, 0.2);
    }
    
    .subtask-drop-indicator {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.1) 100%);
    }
}
