/* Estilos para diagramas de flujo */
.diagram-container {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

.diagram-title {
    text-align: center;
    color: var(--gray-800);
    margin-bottom: 2rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.diagram-title i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Contenedor del diagrama */
.flowchart {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    min-width: 800px;
    padding: 1rem;
}

/* Nodos del diagrama */
.flow-node {
    position: relative;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    color: var(--white);
    text-align: center;
    font-weight: 500;
    min-width: 200px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.flow-node:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Tipos de nodos */
.flow-start {
    background: linear-gradient(135deg, var(--success-color), #059669);
    border-radius: 50px;
}

.flow-end {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    border-radius: 50px;
}

.flow-process {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.flow-decision {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    transform: rotate(45deg);
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flow-decision .node-content {
    transform: rotate(-45deg);
    text-align: center;
}

.flow-input {
    background: linear-gradient(135deg, var(--info-color), #0891b2);
    border-radius: 0;
    clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
}

.flow-document {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    position: relative;
}

.flow-document::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 0;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid #8b5cf6;
    border-bottom: 10px solid #8b5cf6;
}

/* Conectores */
.flow-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.flow-arrow {
    width: 3px;
    height: 40px;
    background: var(--gray-400);
    position: relative;
}

.flow-arrow::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--gray-400);
}

.flow-arrow.success {
    background: var(--success-color);
}

.flow-arrow.success::after {
    border-top-color: var(--success-color);
}

.flow-arrow.danger {
    background: var(--danger-color);
}

.flow-arrow.danger::after {
    border-top-color: var(--danger-color);
}

/* Etiquetas de decisión */
.decision-label {
    background: var(--white);
    color: var(--gray-700);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--gray-200);
}

.decision-label.yes {
    border-color: var(--success-color);
    color: var(--success-color);
}

.decision-label.no {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Ramas del diagrama */
.flow-branch {
    display: flex;
    justify-content: space-around;
    width: 100%;
    gap: 3rem;
    margin: 1rem 0;
}

.flow-branch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

/* Contenedor de pasos paralelos */
.parallel-steps {
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    width: 100%;
    margin: 1rem 0;
}

.parallel-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Iconos en nodos */
.flow-node i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Notas y advertencias */
.flow-note {
    background: var(--gray-100);
    border-left: 4px solid var(--info-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.flow-warning {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    color: #92400e;
    font-size: 0.9rem;
}

.flow-danger {
    background: #fee2e2;
    border-left: 4px solid var(--danger-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    color: #991b1b;
    font-size: 0.9rem;
}

/* Leyenda del diagrama */
.diagram-legend {
    background: var(--gray-50);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 2rem;
}

.diagram-legend h4 {
    color: var(--gray-800);
    margin-bottom: 1rem;
    text-align: center;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.legend-symbol {
    width: 40px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-symbol.start {
    background: var(--success-color);
    border-radius: 20px;
}

.legend-symbol.end {
    background: var(--danger-color);
    border-radius: 20px;
}

.legend-symbol.process {
    background: var(--primary-color);
}

.legend-symbol.decision {
    background: var(--warning-color);
    transform: rotate(45deg);
    width: 20px;
    height: 20px;
}

.legend-symbol.input {
    background: var(--info-color);
    clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
}

.legend-symbol.document {
    background: #8b5cf6;
    position: relative;
}

.legend-symbol.document::before {
    content: '';
    position: absolute;
    top: -3px;
    right: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid #8b5cf6;
    border-bottom: 3px solid #8b5cf6;
}

.legend-text {
    color: var(--gray-700);
    font-size: 0.9rem;
}

/* Responsive para diagramas */
@media (max-width: 768px) {
    .diagram-container {
        padding: 1rem;
        overflow-x: scroll;
    }

    .flowchart {
        min-width: 600px;
    }

    .flow-node {
        min-width: 150px;
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .flow-decision {
        width: 120px;
        height: 120px;
    }

    .flow-branch {
        gap: 1.5rem;
    }

    .parallel-steps {
        gap: 1rem;
    }

    .legend-items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .flowchart {
        min-width: 400px;
    }

    .flow-node {
        min-width: 120px;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .flow-decision {
        width: 100px;
        height: 100px;
    }

    .flow-branch {
        flex-direction: column;
        gap: 1rem;
    }

    .parallel-steps {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Animaciones para diagramas */
@keyframes flowIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flow-node {
    animation: flowIn 0.6s ease-out;
}

.flow-node:nth-child(1) { animation-delay: 0.1s; }
.flow-node:nth-child(2) { animation-delay: 0.2s; }
.flow-node:nth-child(3) { animation-delay: 0.3s; }
.flow-node:nth-child(4) { animation-delay: 0.4s; }
.flow-node:nth-child(5) { animation-delay: 0.5s; }

/* Efectos hover para interactividad */
.flow-node:hover {
    cursor: pointer;
}

.flow-node:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.flow-node:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--gray-800);
    z-index: 1000;
}