/* cronograma.css - Estilos para o Gráfico de Gantt do Cronograma Macro */

.cronograma-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px); /* Adjust based on navbar/footer */
    min-height: 600px;
    border: 1px solid #dee2e6;
    background: #fff;
    overflow: hidden;
    position: relative;
}

.cronograma-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.cronograma-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* WBS Sidebar */
.cronograma-sidebar {
    width: 350px;
    min-width: 350px;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    background: #fdfdfd;
    z-index: 10;
}

.cronograma-sidebar-header {
    height: 60px;
    border-bottom: 1px solid #dee2e6;
    background: #f4f6f9;
    font-weight: bold;
    display: flex;
    align-items: center;
    padding-left: 10px;
}

.cronograma-sidebar-rows {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.wbs-row {
    height: 40px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    user-select: none;
}

.wbs-row:hover {
    background: #f1f3f5;
}

.wbs-row.selected {
    background: #e7f1ff;
}

.wbs-color-box {
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 2px;
}

.wbs-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wbs-progress {
    width: 40px;
    text-align: right;
    font-size: 11px;
    color: #6c757d;
    margin-right: 10px;
}

/* Gantt Area */
.cronograma-gantt-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto; /* Both X and Y scrolling */
    position: relative;
}

.gantt-header {
    display: flex;
    flex-direction: column;
    background: #f4f6f9;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 5;
}

.gantt-months {
    display: flex;
    border-bottom: 1px solid #e9ecef;
}

.gantt-month {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 0;
    border-right: 1px solid #e9ecef;
}

.gantt-days {
    display: flex;
}

.gantt-day {
    text-align: center;
    font-size: 10px;
    border-right: 1px solid #e9ecef;
    box-sizing: border-box;
}

.gantt-day.weekend {
    background: #f8f9fa;
    color: #adb5bd;
}

.gantt-grid {
    position: relative;
}

.gantt-row {
    height: 40px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    box-sizing: border-box;
}

/* Today line */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: rgba(220, 53, 69, 0.5);
    z-index: 2;
    pointer-events: none;
}

/* Gantt Bars */
.gantt-bar-wrapper {
    position: absolute;
    height: 24px;
    top: 8px;
    border-radius: 3px;
    cursor: grab;
    z-index: 3;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.gantt-bar-wrapper:hover, .gantt-bar-wrapper.selected {
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.gantt-bar-wrapper:active {
    cursor: grabbing;
}

.gantt-bar-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: rgba(0,0,0,0.2);
    border-radius: 3px 0 0 3px;
    pointer-events: none;
}

.gantt-bar-label {
    position: absolute;
    left: 100%;
    margin-left: 8px;
    white-space: nowrap;
    font-size: 11px;
    color: #495057;
    pointer-events: none;
}

.gantt-bar-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
    z-index: 4;
}

.gantt-bar-resize-handle:hover {
    background: rgba(255,255,255,0.3);
}

/* Summary Bars (Systems/Processes) */
.gantt-bar-wrapper.summary {
    height: 12px;
    top: 14px;
    border-radius: 0;
    background: #343a40 !important; /* Overridden if has color, but shape differs */
}
.gantt-bar-wrapper.summary::before, .gantt-bar-wrapper.summary::after {
    content: '';
    position: absolute;
    top: 0;
    border: 6px solid transparent;
}
.gantt-bar-wrapper.summary::before {
    left: 0;
    border-top-color: inherit;
    border-left-color: inherit;
}
.gantt-bar-wrapper.summary::after {
    right: 0;
    border-top-color: inherit;
    border-right-color: inherit;
}

/* Milestones */
.gantt-bar-wrapper.milestone {
    width: 20px !important;
    height: 20px;
    top: 10px;
    background: #dc3545 !important;
    transform: rotate(45deg);
    border-radius: 2px;
}
.gantt-bar-wrapper.milestone .gantt-bar-progress {
    display: none;
}
.gantt-bar-wrapper.milestone .gantt-bar-resize-handle {
    display: none;
}
.gantt-bar-wrapper.milestone .gantt-bar-label {
    transform: rotate(-45deg);
    left: 20px;
    top: -5px;
}

/* Dependency SVG Overlay */
.gantt-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.gantt-dependency-line {
    fill: none;
    stroke: #ff9800;
    stroke-width: 1.5;
    opacity: 0.7;
}

.gantt-dependency-arrow {
    fill: #ff9800;
    opacity: 0.7;
}

/* Right Editor Panel */
.cronograma-editor-panel {
    position: absolute;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 20;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cronograma-editor-panel.open {
    right: 0;
}

.editor-header {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.editor-footer {
    padding: 15px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Indicators */
.gantt-indicators {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.gantt-indicator-card {
    flex: 1;
    background: #fff;
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #007bff;
    display: flex;
    flex-direction: column;
}
.gantt-indicator-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}
.gantt-indicator-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
}
