/* ProjectsGantt — Jira-style global Gantt with drag/resize bars. */

.jira-gantt {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rz-base-300);
    border-radius: 8px;
    background: var(--rz-base-background-color);
    overflow: hidden;
}

.jira-gantt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--rz-base-100);
    border-bottom: 1px solid var(--rz-base-300);
}

.jira-gantt-filter-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.jira-gantt-utility {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--rz-base-300);
    border-radius: 999px;
    background: var(--rz-base-background-color);
}

.jira-gantt-utility.active {
    border-color: rgba(0, 82, 204, 0.35);
    background: rgba(0, 82, 204, 0.08);
}

.jira-gantt-utility-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    line-height: 1.1;
}

.jira-gantt-utility-copy strong {
    font-size: 0.78rem;
    color: var(--rz-text-color);
}

.jira-gantt-utility-copy span {
    font-size: 0.68rem;
    color: var(--rz-text-secondary-color);
}

.jira-gantt-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    white-space: nowrap;
}

.jira-gantt-body {
    display: flex;
    overflow: auto;
    max-height: calc(100vh - 280px);
    -webkit-user-select: none;
    user-select: none;
}

/* Left panel - Fixed columns */
.jira-gantt-left {
    flex-shrink: 0;
    width: 600px;
    border-right: 2px solid var(--rz-base-300);
    background: var(--rz-base-background-color);
    position: sticky;
    left: 0;
    z-index: 10;
}

.jira-gantt-header-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 90px 90px 120px;
    background: var(--rz-base-200);
    border-bottom: 1px solid var(--rz-base-300);
    position: sticky;
    top: 0;
    z-index: 11;
}

.jira-gantt-header-cell {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rz-text-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-right: 1px solid var(--rz-base-300);
}

.jira-gantt-header-cell:last-child { border-right: none; }

.jira-gantt-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 90px 90px 120px;
    border-bottom: 1px solid var(--rz-base-200);
    min-height: 40px;
    align-items: center;
    cursor: pointer;
    transition: background 0.1s ease;
}

.jira-gantt-row:hover { background: var(--rz-base-50); }
.jira-gantt-row.project-row { background: var(--rz-base-100); font-weight: 600; }
.jira-gantt-row.project-row:hover { background: var(--rz-base-200); }
.jira-gantt-row.dragging { background: var(--rz-primary-lighter); }

.jira-gantt-cell {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border-right: 1px solid var(--rz-base-200);
    overflow: hidden;
}

.jira-gantt-cell:last-child { border-right: none; }

.jira-issue-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jira-issue-icon {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.jira-issue-icon.project { background: #6554C0; cursor: pointer; }
.jira-issue-icon.task { background: #4BADE8; }
.jira-issue-icon.epic { background: #6554C0; }

.jira-expand-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    color: var(--rz-text-secondary-color);
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.jira-expand-btn:hover {
    background: var(--rz-base-200);
    color: var(--rz-text-color);
}

.jira-task-count {
    background: var(--rz-base-300);
    color: var(--rz-text-secondary-color);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    flex-shrink: 0;
    margin-left: 0.25rem;
}

.jira-issue-key {
    font-size: 0.75rem;
    color: var(--rz-primary);
    font-weight: 500;
    text-decoration: none;
    flex-shrink: 0;
}

.jira-issue-key:hover { text-decoration: underline; }

.jira-issue-title {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--rz-text-color);
}

.jira-date-cell {
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
    text-align: center;
}

.jira-date-cell.updated {
    color: var(--rz-success);
    font-weight: 600;
}

.jira-status-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.jira-status-badge.todo { background: var(--rz-base-200); color: var(--rz-text-secondary-color); }
.jira-status-badge.in-progress { background: rgba(100, 140, 200, 0.15); color: rgba(100, 140, 200, 0.9); }
.jira-status-badge.in-review { background: rgba(140, 100, 180, 0.12); color: rgba(140, 100, 180, 0.9); }
.jira-status-badge.testing { background: rgba(80, 160, 180, 0.12); color: rgba(80, 160, 180, 0.9); }
.jira-status-badge.done { background: rgba(90, 160, 90, 0.15); color: rgba(90, 160, 90, 0.9); }
.jira-status-badge.blocked { background: rgba(190, 100, 90, 0.15); color: rgba(190, 100, 90, 0.9); }

/* Right panel - Timeline */
.jira-gantt-right {
    flex: 1;
    min-width: 500px;
}

.jira-timeline-header {
    display: flex;
    flex-direction: column;
    background: var(--rz-base-200);
    border-bottom: 1px solid var(--rz-base-300);
    position: sticky;
    top: 0;
    z-index: 9;
}

.jira-timeline-months {
    display: flex;
    border-bottom: 1px solid var(--rz-base-300);
}

.jira-timeline-month {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--rz-text-color);
    padding: 0.375rem 0.5rem;
    border-right: 1px solid var(--rz-base-300);
    text-align: center;
}

.jira-timeline-days {
    display: flex;
}

.jira-timeline-day {
    flex-shrink: 0;
    width: var(--day-width, 32px);
    text-align: center;
    font-size: 0.65rem;
    padding: 0.25rem 0;
    border-right: 1px solid var(--rz-base-200);
    color: var(--rz-text-tertiary-color);
}

.jira-timeline-day.weekend { background: var(--rz-base-100); color: var(--rz-text-tertiary-color); }
.jira-timeline-day.today {
    background: #FFF0B3;
    color: #172B4D;
    font-weight: 700;
}

.jira-timeline-day.today::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100vh;
    background: #FFAB00;
    z-index: 100;
}

.jira-timeline-body { position: relative; }

.jira-bar-row {
    display: flex;
    align-items: center;
    min-height: 40px;
    border-bottom: 1px solid var(--rz-base-200);
    position: relative;
}

.jira-bar-row.project-row { background: var(--rz-base-100); }

.jira-grid-day {
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--day-width, 32px);
    border-right: 1px solid var(--rz-base-200);
}

.jira-grid-day.weekend { background: rgba(0,0,0,0.02); }
.jira-grid-day.today { background: rgba(255, 171, 0, 0.1); }

.jira-bar {
    position: absolute;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 5;
    background: #0052CC;
}

.jira-bar.project-bar { background: #6554C0; height: 24px; }
.jira-bar.task-bar { background: #0052CC; }
.jira-bar.task-bar.done { background: #00875A; opacity: 0.7; }
.jira-bar.task-bar.blocked { background: #DE350B; }
.jira-bar.task-bar.overdue {
    background: #FF5630;
    animation: jira-pulse 2s infinite;
}

.jira-bar.task-bar.draggable {
    cursor: grab;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.jira-bar.task-bar.draggable:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.jira-bar.task-bar.dragging {
    cursor: grabbing;
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 100;
}

.jira-bar.project-bar.draggable {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.jira-bar.project-bar.draggable:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.jira-bar.project-bar.dragging {
    opacity: 0.9;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 100;
}

.jira-bar.project-bar.draggable:hover .jira-bar-handle { opacity: 1; }

.jira-bar-handle {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 14px;
    cursor: ew-resize;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.jira-bar.draggable:hover .jira-bar-handle { opacity: 1; }

.jira-bar-handle-left {
    left: -4px;
    border-radius: 4px 0 0 4px;
    background: linear-gradient(90deg, rgba(0,0,0,0.25) 0%, transparent 100%);
}
.jira-bar-handle-right {
    right: -4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(-90deg, rgba(0,0,0,0.25) 0%, transparent 100%);
}
.jira-bar-handle:hover {
    background: rgba(0,0,0,0.5) !important;
    opacity: 1;
}

.jira-bar-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 10px;
    border-left: 2px solid rgba(255,255,255,0.7);
    border-right: 2px solid rgba(255,255,255,0.7);
}

.jira-bar-label {
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.jira-bar-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}

.jira-bar-arrow-left {
    left: -6px;
    border-width: 6px 6px 6px 0;
    border-color: transparent #0052CC transparent transparent;
}

.jira-bar-arrow-right {
    right: -6px;
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #0052CC;
}

@keyframes jira-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 86, 48, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255, 86, 48, 0); }
}

/* Footer */
.jira-gantt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--rz-base-100);
    border-top: 1px solid var(--rz-base-300);
    font-size: 0.75rem;
}

.jira-gantt-legend {
    display: flex;
    gap: 1.5rem;
}

.jira-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.jira-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.save-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--rz-text-secondary-color);
}

.save-indicator.saving { color: var(--rz-warning); }
.save-indicator.saved { color: var(--rz-success); }
.save-indicator.error { color: var(--rz-danger); }

.jira-gantt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--rz-text-secondary-color);
}
