/**
 * BUSCAMINAS - ESTILOS DEL JUEGO
 * ==============================
 * 
 * Estilos específicos para el juego Buscaminas:
 * - Tablero y celdas
 * - Estados de las celdas (abierta, mina, bandera)
 * - Animaciones y efectos
 * - Controles del juego
 * - Responsive design
 */

/* ====================================
   LAYOUT PRINCIPAL DEL JUEGO
   ==================================== */

main {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    padding: 0 20px;
}

/* ====================================
   TABLERO DEL JUEGO
   ==================================== */

#tablero {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.buscaminas-tabla {
    border-collapse: collapse;
    background: #bdbdbd;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
}

.buscaminas-tabla td {
    padding: 0;
}

.celda {
    width: 36px;
    height: 36px;
    background: #e0e0e0;
    border: 2px solid #9e9e9e;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: background 0.1s, border 0.1s;
    box-shadow: 0 1px 0 #fff inset;
    user-select: none;
}

.celda:active {
    background: #bdbdbd;
    border: 2px solid #757575;
}

.celda[disabled], .celda.abierta {
    background: #fff;
    border: 2px solid #bdbdbd;
    color: #222;
    cursor: default;
}

.celda.bandera {
    background: #ffe082;
    color: #d84315;
}

.celda.mina {
    background: #f44336;
    color: #fff;
}

.buscaminas-tabla {
    margin: 0 auto;
} 

.titulo-buscaminas {
    text-align: center;
    font-size: 2.5em;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 10px;
    letter-spacing: 2px;
    color: #009688;
}

/* Selector de nivel de dificultad */
.selector-nivel {
    text-align: center;
    margin: 20px 0 30px 0;
}

.selector-nivel h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.botones-nivel {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.boton-nivel {
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    background: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    min-width: 180px;
}

.boton-nivel:hover {
    background: #e0e0e0;
    color: #333;
}

.boton-nivel.activo {
    background: #009688;
    color: #fff;
    border-color: #00796b;
}

.boton-nivel.activo:hover {
    background: #00796b;
    color: #fff;
}

#reiniciar {
    display: block;
    margin: 30px auto 0 auto;
    padding: 12px 36px;
    font-size: 1.1em;
    font-weight: 600;
    background: #009688;
    color: #fff;
    border: none;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.1s;
}
#reiniciar:hover {
    background: #00796b;
    color: #fff;
    transform: scale(1.05);
} 

/* Botones del juego */
.botones-juego {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0 0 0;
}

#reiniciar, #cambiar-nivel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.1em;
    font-weight: 600;
    background: #009688;
    color: #fff;
    border: none;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    width: 160px;
    height: 50px;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.2;
    margin: 0;
}
#resetear {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.1em;
    font-weight: 600;
    background: #f44336; 
    color: #fff;
    border: none;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    width: 160px;
    height: 50px;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.2;
    margin: 0;
}

#resetear:hover {
    background: #d32f2f; 
    color: #fff;
    transform: scale(1.05);
}

#reiniciar:hover, #cambiar-nivel:hover {
    background: #00796b;
    color: #fff;
    transform: scale(1.05);
}

#cambiar-nivel {
    background: #ff9800;
}

#cambiar-nivel:hover {
    background: #f57c00;
}

/* Modal para mensajes */
#modal-mensaje {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
#modal-mensaje .modal-contenido {
    background: #fff;
    padding: 32px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    min-width: 260px;
    text-align: center;
    position: relative;
}
#modal-texto {
    font-size: 1.3em;
    color: #222;
}
#modal-cerrar {
    margin-top: 18px;
    padding: 8px 24px;
    background: #009688;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
} 

/* Temporizador */
.temporizador {
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    color: #009688;
    margin: 10px 0 20px 0;
    padding: 8px 16px;
    background: #f0f8f7;
    border-radius: 6px;
    display: inline-block;
    margin-left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Contador de minas */
.contador-minas {
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    color: #d84315;
    margin: 10px 0 20px 0;
    padding: 8px 16px;
    background: #fff3e0;
    border-radius: 6px;
    display: inline-block;
    margin-left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    border: 2px solid #ffcc02;
}

/* Media Queries para Responsive Mobile */
@media (max-width: 768px) {
    /* Contenedor principal */
    main {
        padding: 0 10px;
    }
    
    /* Título */
    .titulo-buscaminas {
        font-size: 1.8em;
        margin-top: 20px;
        margin-bottom: 15px;
    }
    
    /* Selector de nivel */
    .selector-nivel {
        margin: 15px 0 20px 0;
    }
    
    .selector-nivel h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .botones-nivel {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .boton-nivel {
        min-width: 200px;
        padding: 15px 20px;
        font-size: 0.95em;
    }
    
    /* Tablero */
    .celda {
        width: 32px;
        height: 32px;
        font-size: 1em;
    }
    
    /* Para pantallas muy pequeñas */
    @media (max-width: 480px) {
        .celda {
            width: 28px;
            height: 28px;
            font-size: 0.9em;
        }
    }
    
    /* Temporizador y contador */
    .temporizador,
    .contador-minas {
        font-size: 1em;
        padding: 10px 12px;
        margin: 8px 0 15px 0;
    }
    
    /* Botones del juego */
    .botones-juego {
        flex-direction: column;
        gap: 10px;
        margin: 20px 0 0 0;
    }
    
    #reiniciar, 
    #cambiar-nivel {
        width: 200px;
        height: 50px;
        font-size: 1em;
        padding: 12px 20px;
    }
    
    /* Modal */
    #modal-mensaje .modal-contenido {
        padding: 24px 20px;
        min-width: 280px;
        margin: 20px;
    }
    
    #modal-texto {
        font-size: 1.1em;
    }
    
    #modal-cerrar {
        padding: 10px 20px;
        font-size: 1em;
        min-height: 44px;
    }
} 