﻿/* ============================================================
   GANTT DETALLADO + DEPENDENCY SELECTOR + GAUGE WIDGETS
   Extraido de styles.css (L5659-L6498) el 22 Mayo 2026 - DT-004
   ============================================================ */

/* =========================================
   GANTT DETALLADO â€” Diagrama de Gantt
   ========================================= */

/* â”€â”€ Header â”€â”€ */
.gd-header {
    background: var(--white);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.gd-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand);
    display: flex;
    align-items: center;
    gap: 8px;
}

.gd-title-icon { font-size: 1.3rem; }

.gd-controls {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.gd-scale-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.gd-scale-btn {
    background: var(--white);
    border: none;
    padding: 6px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    border-right: 1px solid var(--border-color);
}
.gd-scale-btn:last-child { border-right: none; }
.gd-scale-btn:hover { background: #f1f5f9; color: var(--brand); }
.gd-scale-btn.active {
    background: var(--brand);
    color: #fff;
}

.gd-collapse-group {
    display: flex;
    gap: 6px;
}

.gd-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.68rem;
    color: #64748b;
}

.gd-leg {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gd-leg-bar {
    width: 16px;
    height: 8px;
    border-radius: 3px;
}
.gd-leg-fase { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.gd-leg-task { background: #3b82f6; }
.gd-leg-sub { background: #94a3b8; }
.gd-leg-diamond {
    width: 8px;
    height: 8px;
    background: #d97706;
    transform: rotate(45deg);
    border-radius: 1px;
}
.gd-leg-critical {
    width: 16px;
    height: 0;
    border-top: 3px solid #ef4444;
}
.gd-leg-today {
    width: 14px;
    height: 0;
    border-top: 2px dashed var(--nok);
}

/* â”€â”€ Body: dual panel â”€â”€ */
.gd-body {
    display: flex;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

/* Left panel â€” task list */
.gd-left {
    width: 340px;
    min-width: 340px;
    flex-shrink: 0;
    border-right: 2px solid var(--border-color);
    background: var(--white);
    display: flex;
    flex-direction: column;
}

.gd-left-header {
    display: flex;
    align-items: stretch;
    background: #f1f5f9;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.gd-lh-wbs { width: 60px; text-align: center; padding: 0 4px; border-right: 1px solid #e2e8f0; position: relative; display: flex; align-items: center; justify-content: center; }
.gd-lh-name { flex: 1; padding: 0 8px; border-right: 1px solid #e2e8f0; position: relative; display: flex; align-items: center; }
.gd-lh-pct { width: 48px; text-align: center; position: relative; display: flex; align-items: center; justify-content: center; }

.gd-left-rows {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 300px);
    min-height: 350px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

.gd-left-rows::-webkit-scrollbar { width: 6px; }
.gd-left-rows::-webkit-scrollbar-track { background: #f8fafc; }
.gd-left-rows::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Individual row */
.gd-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.78rem;
    transition: background 0.12s;
    cursor: default;
}
.gd-row:hover { background: #f8fafc; }

.gd-row-wbs {
    width: 60px;
    text-align: center;
    font-weight: 700;
    color: #475569;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
    border-right: 1px solid #f1f5f9;
}

.gd-row-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 6px;
    border-right: 1px solid #f1f5f9;
}

.gd-row-pct {
    width: 48px;
    text-align: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: #64748b;
    flex-shrink: 0;
}

/* Row type styles */
.gd-row-fase {
    background: #f0f4f8;
    font-weight: 800;
    color: var(--brand);
}
.gd-row-fase .gd-row-name { font-weight: 800; }
.gd-row-hito { background: #fffbeb; color: #92400e; font-weight: 700; }
.gd-row-entregable { background: #faf5ff; color: #7c3aed; font-weight: 700; }
.gd-row-subtarea { color: #64748b; font-size: 0.74rem; }
.gd-row-critical { border-left: 3px solid #ef4444; }

.gd-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 0.5rem;
    cursor: pointer;
    border-radius: 3px;
    background: var(--brand);
    color: #fff;
    flex-shrink: 0;
    margin-right: 2px;
    transition: 0.15s;
    user-select: none;
}
.gd-toggle:hover { background: var(--brand-2); transform: scale(1.15); }
.gd-toggle-task { background: #cbd5e1; color: #475569; }
.gd-toggle-task:hover { background: #94a3b8; }

/* Right panel â€” timeline */
.gd-right {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    min-height: 350px;
    position: relative;
    background: #fafbfc;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #f1f5f9;
}

.gd-right::-webkit-scrollbar { height: 10px; width: 6px; }
.gd-right::-webkit-scrollbar-track { background: #f1f5f9; }
.gd-right::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }

.gd-timeline-header {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    background: #f1f5f9;
    border-bottom: 2px solid var(--border-color);
}

.gd-col-header {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #e2e8f0;
    font-size: 0.7rem;
    user-select: none;
}
.gd-col-label { font-weight: 700; color: #334155; }
.gd-col-sub { font-size: 0.6rem; color: #94a3b8; }
.gd-weekend { background: #f8f9fb; }

.gd-timeline-body {
    position: relative;
    min-height: 100px;
}

/* Grid columns */
.gd-grid-col {
    position: absolute;
    top: 0;
    border-right: 1px solid #f1f5f9;
    pointer-events: none;
}
.gd-grid-weekend { background: rgba(241,245,249,0.5); }

/* â”€â”€ Bars â”€â”€ */
.gd-bar {
    position: absolute;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    z-index: 3;
    display: flex;
    align-items: center;
}
.gd-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    z-index: 8;
}

.gd-bar-fase {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 2px 6px rgba(0,51,102,0.2);
}
.gd-bar-task {
    background: #3b82f6;
    box-shadow: 0 1px 4px rgba(59,130,246,0.25);
}
.gd-bar-subtarea {
    background: #94a3b8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.gd-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(34,197,94,0.5);
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

.gd-bar-text {
    position: relative;
    z-index: 2;
    padding: 0 6px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    width: 100%;
}

/* Critical path bars */
.gd-bar-critical {
    box-shadow: 0 0 0 2px #ef4444, 0 2px 8px rgba(239,68,68,0.3) !important;
}

/* â”€â”€ Diamonds (Hito / Entregable) â”€â”€ */
.gd-diamond {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 3;
    cursor: pointer;
    transition: transform 0.12s;
}
.gd-diamond:hover { transform: scale(1.15); z-index: 10; }

.gd-diamond-shape {
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.gd-diamond-hito .gd-diamond-shape { background: #d97706; }
.gd-diamond-entregable .gd-diamond-shape { background: #7c3aed; }

.gd-diamond-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* â”€â”€ TODAY line â”€â”€ */
.gd-today-line {
    position: absolute;
    top: 0;
    width: 0;
    border-left: 2.5px dashed var(--nok);
    z-index: 5;
    pointer-events: none;
}

.gd-today-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--nok);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 0 0 6px 6px;
    white-space: nowrap;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 6px rgba(239,68,68,0.35);
    animation: ganttTodayPulse 2.5s ease-in-out infinite;
}

/* â”€â”€ Footer KPIs â”€â”€ */
.gd-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

.gd-footer-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.gd-footer-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand);
}

.gd-footer-critical { color: #ef4444 !important; }

.gd-footer-lbl {
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* â”€â”€ Empty state â”€â”€ */
.gd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #94a3b8;
    text-align: center;
}

.gd-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

.gd-empty-text {
    font-size: 0.9rem;
    max-width: 400px;
    line-height: 1.6;
}

/* â”€â”€ Responsive â”€â”€ */
@media (max-width: 768px) {
    .gd-left { width: 200px; min-width: 200px; }
    .gd-header { padding: 12px; }
    .gd-legend { display: none; }
    .gd-footer { gap: 20px; flex-wrap: wrap; }
}

@media print {
    .gd-header .gd-scale-group { display: none; }
    .gd-today-badge { animation: none; }
}

/* =========================================
   DEPENDENCY SELECTOR â€” Predecesoras
   ========================================= */

/* Deps cell in workplan table */
.wp-deps-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
}

.wp-deps-tags {
    flex: 1;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.wp-deps-btn {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.65rem;
    padding: 2px 4px;
    transition: 0.15s;
    flex-shrink: 0;
}
.wp-deps-btn:hover {
    background: #dbeafe;
    border-color: var(--brand);
    transform: scale(1.1);
}

/* Modal */
.wp-deps-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.wp-deps-modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 440px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wp-deps-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.wp-deps-modal-header button {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #94a3b8;
    transition: 0.15s;
}
.wp-deps-modal-header button:hover { color: var(--nok); }

.wp-deps-modal-body {
    overflow-y: auto;
    padding: 8px 0;
    max-height: 50vh;
}

.wp-dep-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.1s;
}
.wp-dep-option:hover { background: #f1f5f9; }
.wp-dep-option input[type="checkbox"] { accent-color: var(--brand); }

.wp-dep-wbs {
    font-weight: 700;
    color: var(--brand);
    min-width: 40px;
    font-size: 0.72rem;
}

.wp-deps-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
}

.wp-deps-cancel {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.15s;
}
.wp-deps-cancel:hover { background: #e2e8f0; }

.wp-deps-save {
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.15s;
}
.wp-deps-save:hover { background: var(--brand-2); }


/* ============================================================
   GAUGE WIDGETS Â· Indicadores & OKRs Â· v1.0
   Sprint Visual Upgrade Â· 14 mayo 2026
   Agregar siempre AL FINAL â€” no insertar en medio del archivo
   ============================================================ */

/* â”€â”€â”€ Grid responsivo: 4 cols desktop / 2 tablet / 1 mobile â”€â”€â”€ */
.kpi-grid.gauge-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
@media (max-width: 1024px) {
    .kpi-grid.gauge-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 640px) {
    .kpi-grid.gauge-grid { grid-template-columns: 1fr; gap: 10px; }
}

/* â”€â”€â”€ Card gauge individual â”€â”€â”€ */
.gauge-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    position: relative;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.gauge-card--clickable { cursor: pointer; }
.gauge-card--clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 51, 102, 0.08);
    border-color: rgba(0, 173, 239, 0.30);
}
/* Mantiene la visibilidad del botÃ³n de eliminar al hover */
.gauge-card:hover .kpi-delete-btn { opacity: 0.6; }

/* â”€â”€â”€ Cabecera de la card â”€â”€â”€ */
.gauge-card__category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6B7280;
    margin-bottom: 3px;
}
.gauge-card__name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
    line-height: 1.3;
    padding-right: 16px;
    min-height: 32px;
}
.gauge-card__direction {
    font-size: 10px;
    color: #9CA3AF;
    display: block;
    margin-bottom: 4px;
}

/* â”€â”€â”€ Status dot (semÃ¡foro) â”€â”€â”€ */
.gauge-card__status-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.gauge-card__status-dot--green  { background: #B3D235; }
.gauge-card__status-dot--amber  { background: #f59e0b; }
.gauge-card__status-dot--red    { background: #ef4444; }
.gauge-card__status-dot--gray   { background: #9CA3AF; }

/* â”€â”€â”€ Contenedor del SVG â”€â”€â”€ */
.gauge-card__svg-wrap {
    display: flex;
    justify-content: center;
    margin: 2px 0 4px;
}

/* â”€â”€â”€ SVG base â”€â”€â”€ */
.gauge-svg          { width: 100%; max-width: 200px; height: auto; display: block; }
.gauge-svg--sm      { max-width: 140px; }
.gauge-svg--md      { max-width: 200px; }
.gauge-svg--lg      { max-width: 260px; }

/* â”€â”€â”€ AnimaciÃ³n de entrada: arco barre 0 â†’ valor en 1.2s â”€â”€â”€ */
@keyframes gaugeSweep {
    from { stroke-dasharray: 0 999; }
}
.gauge-progress--animate {
    animation: gaugeSweep 1.2s cubic-bezier(0.34, 0.99, 0.55, 1) both;
}

/* â”€â”€â”€ Footer de la card â”€â”€â”€ */
.gauge-card__footer {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #9CA3AF;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 6px;
    margin-top: 4px;
}

/* â”€â”€â”€ Gauge-detail-header: hero header dentro del detail-panel â”€â”€â”€ */
.gauge-detail-header {
    padding: 16px 20px 14px;
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.04) 0%, rgba(0, 173, 239, 0.04) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    margin-bottom: 16px;
}
.gauge-detail-header__title {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    margin: 2px 0 4px;
}

/* â”€â”€â”€ Meta-pills grid del panel de detalle â”€â”€â”€ */
.gauge-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.gauge-detail-meta-item {
    background: rgba(0, 51, 102, 0.04);
    padding: 8px 10px;
    border-radius: 8px;
}
.gauge-detail-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6B7280;
    margin-bottom: 2px;
}
.gauge-detail-meta-value {
    font-size: 13px;
    color: #111827;
    font-weight: 600;
}

/* â”€â”€â”€ BotÃ³n Editar KPI dentro del gauge-detail-header â”€â”€â”€ */
.btn-kpi-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    margin-top: 12px;
    padding: 7px 14px;
    background: white;
    border: 1px solid rgba(0, 51, 102, 0.18);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.btn-kpi-edit:hover {
    background: rgba(0, 51, 102, 0.05);
    border-color: rgba(0, 51, 102, 0.35);
}

/* â”€â”€â”€ Grid de gauges dentro del Steering Committee â”€â”€â”€ */
.st-gauge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 4px;
}
/* Cards mÃ¡s compactas dentro del panel de Steering */
.st-gauge-grid .gauge-card {
    padding: 10px 12px;
}
.st-gauge-grid .gauge-card__name {
    font-size: 12px;
    min-height: 28px;
}
@media (max-width: 900px) {
    .st-gauge-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}
@media (max-width: 600px) {
    .st-gauge-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
    .st-gauge-grid { grid-template-columns: 1fr; }
}

/* â”€â”€â”€ Drag & Drop en Indicadores EstratÃ©gicos (Steering) â”€â”€â”€ */
.st-gauge-grid .gauge-card       { cursor: grab; user-select: none; }
.st-gauge-grid .gauge-card:active { cursor: grabbing; }
.st-gauge-sortable-ghost  {
    opacity: 0.35;
    background: rgba(0, 51, 102, 0.04) !important;
    border: 2px dashed var(--brand) !important;
    border-radius: 12px;
}
.st-gauge-sortable-chosen {
    box-shadow: 0 8px 24px rgba(0, 51, 102, 0.18);
    transform: scale(1.025);
    z-index: 10;
}
.st-gauge-sortable-drag   {
    opacity: 0.96;
    box-shadow: 0 16px 40px rgba(0, 51, 102, 0.22);
}
/* Link de reseteo de orden en el header */
.st-kpi-reset-link {
    float: right;
    font-size: 11px;
    font-weight: 500;
    color: var(--brand);
    text-decoration: none;
    opacity: 0.6;
    margin-top: 2px;
    transition: opacity 0.15s;
}
.st-kpi-reset-link:hover { opacity: 1; text-decoration: underline; }

/* ============================================================
   FIN BLOQUE GAUGE WIDGETS
   ============================================================ */

