/* =============================
   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; 
}

/* ================
   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-alg { 
    border-color: #F4D03F; 
}

.btn-alg:hover:not(:disabled) { 
    border-color: #F4D03F; 
    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: 60px;
    text-align: center;
    font-size: 1rem;
}

/* ===========================
   ÁREA DE SIMULACIÓN Y BARRAS
   =========================== */
.bars-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 350px;
    gap: 8px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.bar {
    width: 40px;
    background-color: #5DADE2;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5px;
    color: #ffffff;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.2s, height 0.2s ease-in-out;
    min-height: 25px; 
}

.bar.comparando { 
    background-color: #F4D03F; 
    color: #333333; 
}

.bar.intercambiando { 
    background-color: #FF69B4; 
    color: #ffffff; 
}

.bar.ordenado { 
    background-color: #2ecc71; 
    color: #ffffff; 
}

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

.playback-controls button { 
    padding: 0.6rem 1.2rem; 
    border-radius: 6px; 
}

.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;
}

/* =================
   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, .search-group {
        border-left: none;
        border-top: 2px solid #444;
        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; }
    .bars-container { overflow-x: auto; justify-content: flex-start; }
    .logo-top-right {display: none;}
}
