/* =============================
   ESTILOS GLOBALES Y NAVEGACIÓN
   ============================= */
body {
    font-family: sans-serif;
    background-color: #FFF9E6;
    color: #333333;
    margin: 0;
    padding: 0;
}

.btn-volver-sim {
    position: absolute;
    top: 20px;
    left: 20px;
    display: inline-block;
    padding: 12px 24px;
    background-color: transparent;
    color: #FF69B4;
    text-decoration: none;
    border-radius: 6px;
    font-size: 21px;
    border: 2px solid #FF69B4;
    transition: all 0.2s ease;
    z-index: 1000;
}

.btn-volver-sim:hover {
    background-color: rgba(255, 105, 180, 0.1); 
    color: #E91E63; 
    border-color: #E91E63;
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.2);
}

.logo-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    height: 52px;
    z-index: 1000;
}

/* ==============================
   ESTRUCTURA PRINCIPAL Y PANELES
   ============================== */
.container {
    max-width: 900px;
    margin: 4rem auto 2rem;
    padding: 1rem;
    text-align: center;
}

h1 { 
    color: #5DADE2;
}

.controls-panel {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

.control-group { 
    display: flex; 
    align-items: center; 
    gap: 0.8rem; 
}

.algorithms { 
    border-left: 2px solid #cccccc; 
    padding-left: 1.5rem; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 0.5rem; 
}

/* ================
   BOTONES E INPUTS
   ================ */
button {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 0.6rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

button:hover:not(:disabled) {
    background-color: #f4f8fb;
    border-color: #5DADE2;
    box-shadow: 0 0 8px rgba(93, 173, 226, 0.3);
}

button:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
    background-color: #eeeeee; 
}

.btn-accion { 
    border-color: #5DADE2; 
}

.btn-accion:hover:not(:disabled) { 
    box-shadow: 0 0 8px rgba(93, 173, 226, 0.4); 
}

.btn-alg { 
    border-color: #FF69B4; 
}

.btn-alg:hover:not(:disabled) { 
    box-shadow: 0 0 8px rgba(255, 105, 180, 0.4); 
}

.btn-info { 
    border-color: #F4D03F; 
}
.btn-info:hover:not(:disabled) { 
    box-shadow: 0 0 8px rgba(244, 208, 63, 0.4); 
}

input[type="number"] {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    padding: 0.5rem;
    border-radius: 4px;
    width: 70px;
    text-align: center;
    font-size: 1rem;
}

/* =========================
   CONTROLES DE REPRODUCCIÓN
   ========================= */
.playback-controls {
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px dashed #cccccc;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.btn-play { 
    background-color: #eaf2f8; 
    border-color: #5DADE2; 
    color: #5DADE2; 
}

.btn-play:hover:not(:disabled) { 
    background-color: #5DADE2; 
    color: white; 
}

.btn-play.pausado { 
    background-color: #fdfae6; 
    border-color: #F4D03F; 
    color: #b89714; 
}

.btn-play.pausado:hover:not(:disabled) { 
    background-color: #F4D03F; 
    color: white; 
}

.btn-step { 
    background-color: #ffffff; 
    border-color: #cccccc; 
}

.btn-cancel { 
    background-color: #fff0f5; 
    border-color: #FF69B4; 
    color: #d81b60; 
    margin-left: 1rem; 
}

.btn-cancel:hover:not(:disabled) { 
    background-color: #FF69B4; 
    color: white; 
}

/* ===========================
   ESTADO Y ÁREA DE SIMULACIÓN
   =========================== */
.status-message {
    font-size: 1.2rem;
    color: #E91E63;
    margin-bottom: 1.5rem;
    min-height: 3rem; 
    height: auto;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tda-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    gap: 15px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow-x: auto;
}

.tda-container.layout-pila { 
    flex-direction: column-reverse;
}

.tda-container.layout-cola { 
    flex-direction: row; 
}

.tda-container.layout-lista { 
    flex-direction: row; 
}

.tda-node {
    width: 60px;
    height: 60px;
    background-color: #ffffff;
    border: 2px solid #5DADE2;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333333;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    position: relative;
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
}

.tda-node::after {
    content: attr(data-index);
    position: absolute;
    bottom: -25px;
    font-size: 12px;
    color: #777777;
    white-space: nowrap;
}

/* ===============
   ESTADO DINÁMICO
   =============== */
.tda-node.highlight {
    border-color: #2ecc71;
    background-color: #eafaf1;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
    transform: scale(1.1);
}

.tda-node.removing {
    border-color: #FF69B4;
    background-color: #fff0f5;
    box-shadow: 0 0 15px rgba(255, 105, 180, 0.4);
    opacity: 0.7;
}

.tda-node.info {
    border-color: #F4D03F;
    background-color: #fdfae6;
    box-shadow: 0 0 15px rgba(244, 208, 63, 0.4);
}

/* ===================
   FLECHAS PARA LISTAS
   =================== */
.tda-arrow {
    width: 30px;
    height: 4px;
    background-color: #cccccc;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.tda-arrow::after {
    content: '';
    position: absolute;
    right: -10px;
    top: -6px;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid #cccccc;
    transition: all 0.3s ease;
}

.tda-arrow.arrow-highlight { 
    background-color: #2ecc71;
}

.tda-arrow.arrow-highlight::after { 
    border-left-color: #2ecc71;
}

.tda-arrow.arrow-removing { 
    background-color: #FF69B4;
    opacity: 0.5;
}

.tda-arrow.arrow-removing::after { 
    border-left-color: #FF69B4; 
    opacity: 0.5; 
}

/* =================
   DISEÑO RESPONSIVO
   ================= */
@media (max-width: 768px) {
    .btn-volver-sim {
        padding: 7px 14px;
        font-size: 13px;
    }
    .container { margin-top: 5rem; padding: 0.5rem; }
    .controls-panel { flex-direction: column; gap: 1rem; padding: 1rem; }
    .control-group { 
        flex-wrap: wrap; 
        justify-content: center; 
        width: 100%; 
        text-align: center; 
    }
    .control-group label {
        width: 100%;
        display: block;
        margin-bottom: 0.8rem;
    }
    .algorithms { 
        border-left: none; 
        border-top: 2px solid #cccccc; 
        padding-left: 0; 
        padding-top: 1rem; 
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
    .playback-controls { flex-wrap: wrap; }
    .playback-controls button { flex: 1 1 auto; margin: 0.25rem !important; }
    .tda-container { justify-content: flex-start; }
    .logo-top-right {display: none;}
}
