/* =============================
   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-accion {
    border-color: #5DADE2;
    color: #2E86C1;
}

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

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

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

.btn-info {
    border-color: #FF69B4;
    color: #E91E63;
}

.btn-info:hover:not(:disabled) {
    border-color: #FF69B4;
    box-shadow: 0 0 8px rgba(255, 105, 180, 0.3);
}

.btn-crear {
    border-color: #2ecc71;
    color: #27ae60;
    font-size: 1rem;
}

.btn-crear:hover:not(:disabled) {
    border-color: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
}

.array-toolbar {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.btn-toggle {
    border-color: #cccccc;
    color: #777777;
    background-color: #f8f9fa;
}

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

.btn-toggle.activo {
    border-color: #FF69B4;
    color: #d81b60;
    background-color: #fff0f5;
}

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

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

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

/* =========================================
   ESTILOS ESPECÍFICOS: SIMULADOR DE VECTORES
   ========================================= */

#array-wrapper {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 2px;
    padding: 40px 20px;
    overflow-x: auto;
    align-items: center;
}

.cell-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.cell {
    width: 60px;
    height: 60px;
    background-color: #ffffff;
    border: 2px solid #5DADE2;
    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);
    transition: all 0.3s ease;
    border-radius: 0;
}

.cell-container:first-child .cell {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}
.cell-container:last-child .cell {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.index {
    position: absolute;
    bottom: -25px;
    font-size: 12px;
    color: #777777;
    font-weight: normal;
}

/* ===============================
   ESTADOS VISUALES DEL VECTOR
   =============================== */

.cell.garbage {
    background-color: #f8f9fa;
    border-color: #cccccc;
    color: #aaaaaa;
    box-shadow: none;
}

.cell.highlight {
    border-color: #F4D03F;
    background-color: #fdfae6;
    box-shadow: 0 0 15px rgba(244, 208, 63, 0.4);
    transform: scale(1.1);
    z-index: 10;
    border-radius: 6px;
}

.cell.found {
    border-color: #2ecc71;
    background-color: #eafaf1;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
    transform: scale(1.1);
    z-index: 10;
    border-radius: 6px;
}

.cell.removing {
    border-color: #FF69B4;
    background-color: #fff0f5;
    transform: scale(0.9);
    opacity: 0.7;
}

/* =================
   DISEÑO RESPONSIVO
   ================= */
@media (max-width: 768px) {
    .btn-volver-sim {
        padding: 7px 14px;
        font-size: 13px;
    }
    .logo-top-right { display: none; }
    .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;
    }
    .algorithms {
        border-left: none;
        border-top: 2px solid #cccccc;
        padding-left: 0;
        padding-top: 1rem;
        width: 100%;
    }
    .playback-controls { flex-wrap: wrap; }
    .playback-controls button { flex: 1 1 auto; margin: 0.25rem !important; }
    .cell {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    .index {
        bottom: -20px;
        font-size: 11px;
    }
}
